MBSim |
Project Page |
A object factory. More...
#include <objectfactory.h>
Static Public Member Functions | |
| template<class CreateType > | |
| static void | registerXMLName (const std::string &name) |
| Register the class CreateType which the XML element name name by the object factory. | |
| template<class CreateType > | |
| static void | registerXMLNameAsSingleton (const std::string &name) |
| Register the class CreateType which the XML element name name by the object factory. | |
| template<class CreateType > | |
| static void | deregisterXMLName (const std::string &name) |
| Deregister the class CreateType. | |
| template<class CreateType > | |
| static void | deregisterXMLNameAsSingleton (const std::string &name) |
| Deregister the class CreateType. | |
| template<class ContainerType > | |
| static ContainerType * | create (const MBXMLUtils::TiXmlElement *element) |
| Create an object corresponding to the XML element element and return a pointer of type ContainerType. | |
Private Types | |
| typedef BaseType *(* | allocateFkt )() |
| typedef void(* | deallocateFkt )(BaseType *obj) |
|
typedef std::multimap < std::string, std::pair < allocateFkt, deallocateFkt > > | Map |
| typedef Map::iterator | MapIt |
Static Private Member Functions | |
| static void | registerXMLName (const std::string &name, allocateFkt alloc, deallocateFkt dealloc) |
| static void | deregisterXMLName (const std::string &name, allocateFkt alloc) |
| static ObjectFactory< BaseType > & | instance () |
| template<class CreateType > | |
| static BaseType * | allocate () |
| static void | deallocate (BaseType *obj) |
| template<class CreateType > | |
| static BaseType * | singleton () |
Private Attributes | |
| Map | registeredType |
A object factory.
A object facroty which creates any object derived from BaseType.
| static ContainerType* MBSim::ObjectFactory< BaseType >::create | ( | const MBXMLUtils::TiXmlElement * | element | ) | [inline, static] |
Create an object corresponding to the XML element element and return a pointer of type ContainerType.
Throws if the created object is not of type ContainerType. This function returns a new object or a singleton object dependent on the registration of the created object.
| static void MBSim::ObjectFactory< BaseType >::deregisterXMLName | ( | const std::string & | name | ) | [inline, static] |
Deregister the class CreateType.
You should not use this function directly but see also the macro MBSIM_OBJECTFACTORY_REGISTERXMLNAME.
| static void MBSim::ObjectFactory< BaseType >::deregisterXMLNameAsSingleton | ( | const std::string & | name | ) | [inline, static] |
Deregister the class CreateType.
You should not use this function directly but see also the macro MBSIM_OBJECTFACTORY_REGISTERXMLNAMEASSINGLETON.
| static void MBSim::ObjectFactory< BaseType >::registerXMLName | ( | const std::string & | name | ) | [inline, static] |
Register the class CreateType which the XML element name name by the object factory.
You should not use this function directly but see also the macro MBSIM_OBJECTFACTORY_REGISTERXMLNAME.
| static void MBSim::ObjectFactory< BaseType >::registerXMLNameAsSingleton | ( | const std::string & | name | ) | [inline, static] |
Register the class CreateType which the XML element name name by the object factory.
You should not use this function directly but see also the macro MBSIM_OBJECTFACTORY_REGISTERXMLNAMEASSINGLETON.
1.8.0