RSC
0.17.1
|
Objects of this class manage a family of named implementations of a particular interface. More...
#include <Factory.h>
Classes | |
class | ImplMapProxy |
This object presents the registered implementations in a form very similar to a STL container. More... | |
Public Types | |
typedef FactoryBase< Key > | base |
typedef base::KeyType | KeyType |
typedef Interface | InterfaceType |
typedef boost::function1< InterfaceType *, const runtime::Properties & > | CreateFunction |
typedef std::map< Key, CreateFunction > | ImplMap |
typedef base::ImplMap | ImplMapBase |
typedef base::ImplMapProxy | ImplMapBaseProxy |
Public Types inherited from rsc::patterns::FactoryBase< Key > | |
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 | |
Factory () | |
virtual | ~Factory () |
const std::type_info & | GetInterfaceType () const throw () |
Return the type information of the interface type of the factory. More... | |
const ImplMapBaseProxy & | implsBase () const throw () |
Return a container-like object holding all registered implementations. More... | |
ImplMapProxy & | impls () throw () |
Return a container-like object holding all registered implementations. More... | |
const ImplMapProxy & | impls () const throw () |
Return a container-like object holding all registered implementations. More... | |
FactoryBase< Key >::type_and_storage | createBase (const Key &key, const runtime::Properties &properties_=runtime::Properties()) |
Interface * | createInst (const Key &key, const runtime::Properties &properties_=runtime::Properties()) |
Create and return an instance of the implementation designated by key. More... | |
Protected Member Functions | |
virtual void | register_ (const Key &key, const CreateFunction &create_function_) |
virtual void | unregister (const Key &key) |
Protected Attributes | |
ImplMapBase | impl_map_base_ |
ImplMapBaseProxy | impl_map_base_proxy_ |
ImplMap | impl_map_ |
ImplMapProxy | impl_map_proxy_ |
Friends | |
class | ImplMapProxy |
Objects of this class manage a family of named implementations of a particular interface.
typedef FactoryBase<Key> rsc::patterns::Factory< Key, Interface >::base |
typedef boost::function1<InterfaceType*, const runtime::Properties&> rsc::patterns::Factory< Key, Interface >::CreateFunction |
typedef std::map<Key, CreateFunction> rsc::patterns::Factory< Key, Interface >::ImplMap |
typedef base::ImplMap rsc::patterns::Factory< Key, Interface >::ImplMapBase |
typedef base::ImplMapProxy rsc::patterns::Factory< Key, Interface >::ImplMapBaseProxy |
typedef Interface rsc::patterns::Factory< Key, Interface >::InterfaceType |
typedef base::KeyType rsc::patterns::Factory< Key, Interface >::KeyType |
rsc::patterns::Factory< Key, Interface >::Factory | ( | ) |
|
virtual |
|
virtual |
NoSuchImpl | |
ConstructError |
Implements rsc::patterns::FactoryBase< Key >.
Definition at line 341 of file Factory.h.
References rsc::patterns::Factory< Key, Interface >::createInst(), and rsc::patterns::detail::make_pair().
Interface * rsc::patterns::Factory< Key, Interface >::createInst | ( | const Key & | key, |
const runtime::Properties & | properties_ = runtime::Properties() |
||
) |
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. |
Definition at line 350 of file Factory.h.
References rsc::patterns::Factory< Key, Interface >::impl_map_, rsc::runtime::typeName(), and rsc::runtime::typeString().
Referenced by rsc::patterns::Factory< Key, Interface >::createBase().
|
virtual |
Return the type information of the interface type of the factory.
Implements rsc::patterns::FactoryBase< Key >.
Factory< Key, Interface >::ImplMapProxy & rsc::patterns::Factory< Key, Interface >::impls | ( | ) | ||
throw | ( | |||
) |
Return a container-like object holding all registered implementations.
Definition at line 297 of file Factory.h.
References rsc::patterns::Factory< Key, Interface >::impl_map_proxy_.
Referenced by rsc::patterns::operator<<().
const Factory< Key, Interface >::ImplMapProxy & rsc::patterns::Factory< Key, Interface >::impls | ( | ) | const | |
throw | ( | |||
) |
Return a container-like object holding all registered implementations.
Definition at line 303 of file Factory.h.
References rsc::patterns::Factory< Key, Interface >::impl_map_proxy_.
|
virtual |
Return a container-like object holding all registered implementations.
Implements rsc::patterns::FactoryBase< Key >.
Definition at line 291 of file Factory.h.
References rsc::patterns::Factory< Key, Interface >::impl_map_base_proxy_.
|
protectedvirtual |
std::invalid_ |
Definition at line 308 of file Factory.h.
References rsc::patterns::Factory< Key, Interface >::impl_map_, rsc::patterns::Factory< Key, Interface >::impl_map_base_, and rsc::runtime::typeString().
Referenced by rsc::patterns::ObservableFactory< Key, Interface >::register_().
|
protectedvirtual |
NoSuchImpl |
Reimplemented in rsc::patterns::ObservableFactory< Key, Interface >.
Definition at line 322 of file Factory.h.
References rsc::patterns::Factory< Key, Interface >::impl_map_, rsc::patterns::Factory< Key, Interface >::impl_map_base_, and rsc::runtime::typeString().
Referenced by rsc::patterns::ObservableFactory< Key, Interface >::unregister().
|
friend |
|
protected |
|
protected |
Definition at line 224 of file Factory.h.
Referenced by rsc::patterns::Factory< Key, Interface >::register_(), and rsc::patterns::Factory< Key, Interface >::unregister().
|
protected |
Definition at line 225 of file Factory.h.
Referenced by rsc::patterns::Factory< Key, Interface >::implsBase().
|
protected |
Definition at line 228 of file Factory.h.
Referenced by rsc::patterns::Factory< Key, Interface >::impls().