MBSim

Project Page
Static Public Member Functions | Private Types | Static Private Member Functions | Private Attributes
MBSim::ObjectFactory< BaseType > Class Template Reference

A object factory. More...

#include <objectfactory.h>

List of all members.

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

Detailed Description

template<class BaseType>
class MBSim::ObjectFactory< BaseType >

A object factory.

A object facroty which creates any object derived from BaseType.


Member Function Documentation

template<class BaseType >
template<class ContainerType >
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.

template<class BaseType >
template<class CreateType >
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.

template<class BaseType >
template<class CreateType >
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.

template<class BaseType >
template<class CreateType >
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.

template<class BaseType >
template<class CreateType >
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.


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