MBSim

Project Page
Static Public Member Functions | Private Types | Static Private Member Functions | Private Attributes
MBSim::ObjectFactory Class Reference

A object factory. More...

#include <objectfactory.h>

List of all members.

Static Public Member Functions

template<class CreateType >
static void registerXMLName (const MBXMLUtils::FQN &name)
 Register the class CreateType which the XML element name name by the object factory.
template<class CreateType >
static void registerXMLNameAsSingleton (const MBXMLUtils::FQN &name)
 Register the class CreateType which the XML element name name by the object factory.
template<class CreateType >
static void deregisterXMLName (const MBXMLUtils::FQN &name)
 Deregister the class CreateType.
template<class CreateType >
static void deregisterXMLNameAsSingleton (const MBXMLUtils::FQN &name)
 Deregister the class CreateType.
template<class ContainerType >
static ContainerType * createAndInit (const xercesc::DOMElement *element)
 Create and initialize an object corresponding to the XML element element and return a pointer of type ContainerType.

Private Types

typedef fmatvec::Atom *(* AllocateFkt )()
typedef void(* DeallocateFkt )(fmatvec::Atom *obj)
typedef boost::tuple
< MBXMLUtils::FQN, AllocateFkt,
DeallocateFkt > 
VectorContent
typedef std::vector
< VectorContent > 
Vector
typedef Vector::iterator VectorIt

Static Private Member Functions

template<class ContainerType >
static std::pair
< ContainerType
*, DeallocateFkt > 
create (const xercesc::DOMElement *element, size_t useMatchNr=1)
 Create an object corresponding to the XML element element and return a pointer of type ContainerType.
static void registerXMLName (const MBXMLUtils::FQN &name, AllocateFkt alloc, DeallocateFkt dealloc)
static void deregisterXMLName (const MBXMLUtils::FQN &name, AllocateFkt alloc)
static ObjectFactory & instance ()
template<class CreateType >
static fmatvec::Atom * allocate ()
static void deallocate (fmatvec::Atom *obj)
template<class CreateType >
static fmatvec::Atom * getSingleton ()
static void deallocateSingleton (fmatvec::Atom *obj)

Private Attributes

Vector registeredType

Detailed Description

A object factory.

A object factory which creates any object derived from fmatvec::Atom.


Member Function Documentation

template<class ContainerType >
static std::pair<ContainerType*, DeallocateFkt> MBSim::ObjectFactory::create ( const xercesc::DOMElement *  element,
size_t  useMatchNr = 1 
) [inline, static, private]

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 ContainerType >
static ContainerType* MBSim::ObjectFactory::createAndInit ( const xercesc::DOMElement *  element) [inline, static]

Create and initialize 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 or no object can be create without errors. This function returns a new object or a singleton object dependent on the registration of the created object.

template<class CreateType >
static void MBSim::ObjectFactory::deregisterXMLName ( const MBXMLUtils::FQN &  name) [inline, static]

Deregister the class CreateType.

You should not use this function directly but see also the macro MBSIM_OBJECTFACTORY_REGISTERXMLNAME.

template<class CreateType >
static void MBSim::ObjectFactory::deregisterXMLNameAsSingleton ( const MBXMLUtils::FQN &  name) [inline, static]

Deregister the class CreateType.

You should not use this function directly but see also the macro MBSIM_OBJECTFACTORY_REGISTERXMLNAMEASSINGLETON.

template<class CreateType >
static void MBSim::ObjectFactory::registerXMLName ( const MBXMLUtils::FQN &  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 CreateType >
static void MBSim::ObjectFactory::registerXMLNameAsSingleton ( const MBXMLUtils::FQN &  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 file: