openmbvcppinterface 3.1.0 OpenMBV C++ Interface

Static Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
OpenMBV::ObjectFactory Class Reference

`#include <objectfactory.h>`

## Static Public Member Functions

template<class CreateType >
static void | registerXMLName (const MBXMLUtils::FQN &name)
template<class ContainerType >
static std::shared_ptr< ContainerType > | create (const xercesc::DOMElement *element)
template<class CreateType >
static std::shared_ptr< CreateType > | create ()
template<class ContainerType >
static std::shared_ptr< ContainerType > | create (const std::shared_ptr< ContainerType > &t)
static void | addErrorMsg (const std::string &msg)
static std::string | getAndClearErrorMsg ()

## Private Types

using | DefaultCTor = std::shared_ptr< Object >(*)()
using | CopyCTor = std::shared_ptr< Object >(*)(const std::shared_ptr< Object > &)
using | MapName = std::multimap< MBXMLUtils::FQN, DefaultCTor >
using | MapNameIt = typename MapName::iterator
using | MapType = std::map< std::type_index, CopyCTor >
using | MapTypeIt = typename MapType::iterator

## Static Private Member Functions

static void | registerXMLNamePrivate (const MBXMLUtils::FQN &name, DefaultCTor alloc)
template<class CreateType >
static void | registerTypePrivate (CopyCTor alloc)
static ObjectFactory & | instance ()
template<class CreateType >
static std::shared_ptr< Object > | defaultCTor ()
template<class CreateType >
static std::shared_ptr< Object > | copyCTor (const std::shared_ptr< Object > &t)
template<class T >
static void | deleter (T *t)

## Private Attributes

MapName | registeredName
MapType | registeredType

## Static Private Attributes

static std::string | errorMsg

## Detailed Description

A object factory. A object facroty which creates any object derived from Object.

## Member Function Documentation

## ◆ create() [1/3]

template<class ContainerType >

static std::shared_ptr<ContainerType> OpenMBV::ObjectFactory::create | ( | const xercesc::DOMElement * | 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 dependent on the registration of the created object.

## ◆ create() [2/3]

template<class CreateType >

static std::shared_ptr<CreateType> OpenMBV::ObjectFactory::create | ( |  | ) |

inline static

Create an empty object of type CreateType.

## ◆ create() [3/3]

template<class ContainerType >

static std::shared_ptr<ContainerType> OpenMBV::ObjectFactory::create | ( | const std::shared_ptr< ContainerType > & | t | ) |

inline static

Create a copy object of t and return a pointer of type ContainerType. Throws if the created object is not of type ContainerType. This function returns a new object dependent on the registration of the created object.

## ◆ registerXMLName()

template<class CreateType >

static void OpenMBV::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 OPENMBV_OBJECTFACTORY_REGISTERXMLNAME.

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

- /mbsim-env/openmbv/openmbvcppinterface/openmbvcppinterface/objectfactory.h
- /mbsim-env/openmbv/openmbvcppinterface/openmbvcppinterface/objectfactory.cc