RSC
0.16.0
|
An interface-independent factory interface, mainly used as a base class for more specific factories. More...
#include <Factory.h>
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, CreateFunction > | ImplMap |
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 ImplMapProxy & | implsBase () 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... | |
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.
typedef boost::function1<void*, const runtime::Properties&> rsc::patterns::FactoryBase< Key >::CreateFunction |
typedef std::map<Key, CreateFunction> rsc::patterns::FactoryBase< Key >::ImplMap |
typedef Key rsc::patterns::FactoryBase< Key >::KeyType |
typedef std::pair<const std::type_info*, void*> rsc::patterns::FactoryBase< Key >::type_and_storage |
|
pure virtual |
Create and return an instance of the implementation designated by key.
properties_ is passed to the create function.
key | The name of a registered implementation. |
properties_ | A set of properties. The interpretation is up the selected create function. |
NoSuchImpl | If key does not name a registered implementation. |
ConstructError | If the selected create function produced an exception during execution. |
Implemented in rsc::patterns::Factory< Key, Interface >.
Referenced by rsc::patterns::FactoryBase< Key >::ImplMapProxy::ImplMapProxy().
|
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().
|
pure virtual |
Return a container-like object holding all registered implementations.
Implemented in rsc::patterns::Factory< Key, Interface >.
Referenced by rsc::patterns::FactoryBase< Key >::ImplMapProxy::ImplMapProxy().