RSC  0.16.0
rsc::patterns::FactoryBase< Key > Class Template Referenceabstract

An interface-independent factory interface, mainly used as a base class for more specific factories. More...

#include <Factory.h>

Inheritance diagram for rsc::patterns::FactoryBase< Key >:
Inheritance graph
Collaboration diagram for rsc::patterns::FactoryBase< Key >:
Collaboration graph

Classes

class  ImplMapProxy
 

Public Types

typedef Key KeyType
 
typedef boost::function1< void *, const runtime::Properties & > CreateFunction
 
typedef std::pair< const std::type_info *, void * > type_and_storage
 
typedef std::map< Key, CreateFunctionImplMap
 

Public Member Functions

virtual const std::type_info & GetInterfaceType () const =0 throw ()
 Return the type information of the interface type of the factory. More...
 
virtual const ImplMapProxyimplsBase () const =0 throw ()
 Return a container-like object holding all registered implementations. More...
 
virtual type_and_storage createBase (const Key &key, const runtime::Properties &properties_=runtime::Properties())=0
 Create and return an instance of the implementation designated by key. More...
 

Detailed Description

template<typename Key>
class rsc::patterns::FactoryBase< Key >

An interface-independent factory interface, mainly used as a base class for more specific factories.

A factory of this kind is basically a mapping of keys to creation functions that create objects of some common base class.

The factory has a list of implementations that can be retrieved using the impls_base method.

Runtime type information for the interface implemented by constructed objects can be retrieved using the GetInterfaceType method.

Objects are constructed by calling create_base with a key identifying the implementation and properties to be used as arguments to the constructor.

Author
Jan Moringen jmori.nosp@m.nge@.nosp@m.techf.nosp@m.ak.u.nosp@m.ni-bi.nosp@m.elef.nosp@m.eld.d.nosp@m.e

Definition at line 68 of file Factory.h.

Member Typedef Documentation

template<typename Key>
typedef boost::function1<void*, const runtime::Properties&> rsc::patterns::FactoryBase< Key >::CreateFunction

Definition at line 71 of file Factory.h.

template<typename Key>
typedef std::map<Key, CreateFunction> rsc::patterns::FactoryBase< Key >::ImplMap

Definition at line 74 of file Factory.h.

template<typename Key>
typedef Key rsc::patterns::FactoryBase< Key >::KeyType

Definition at line 70 of file Factory.h.

template<typename Key>
typedef std::pair<const std::type_info*, void*> rsc::patterns::FactoryBase< Key >::type_and_storage

Definition at line 72 of file Factory.h.

Member Function Documentation

template<typename Key>
virtual type_and_storage rsc::patterns::FactoryBase< Key >::createBase ( const Key &  key,
const runtime::Properties properties_ = runtime::Properties() 
)
pure virtual

Create and return an instance of the implementation designated by key.

properties_ is passed to the create function.

Parameters
keyThe name of a registered implementation.
properties_A set of properties. The interpretation is up the selected create function.
Returns
A pair containing the type information of the created object and a void pointer pointing to it.
Exceptions
NoSuchImplIf key does not name a registered implementation.
ConstructErrorIf the selected create function produced an exception during execution.

Implemented in rsc::patterns::Factory< Key, Interface >.

Referenced by rsc::patterns::FactoryBase< Key >::ImplMapProxy::ImplMapProxy().

Here is the caller graph for this function:

template<typename Key>
virtual const std::type_info& rsc::patterns::FactoryBase< Key >::GetInterfaceType ( ) const
throw (
)
pure virtual

Return the type information of the interface type of the factory.

Implemented in rsc::patterns::Factory< Key, Interface >.

Referenced by rsc::patterns::FactoryBase< Key >::ImplMapProxy::ImplMapProxy().

Here is the caller graph for this function:

template<typename Key>
virtual const ImplMapProxy& rsc::patterns::FactoryBase< Key >::implsBase ( ) const
throw (
)
pure virtual

Return a container-like object holding all registered implementations.

Returns
A constant reference to the implementation list proxy.

Implemented in rsc::patterns::Factory< Key, Interface >.

Referenced by rsc::patterns::FactoryBase< Key >::ImplMapProxy::ImplMapProxy().

Here is the caller graph for this function:


The documentation for this class was generated from the following file: