Classes | Public Types | Public Member Functions | Private Attributes | List of all members
coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor > Class Template Reference

Factory template class. More...

#include <Factory.h>

Inheritance diagram for coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >:
Inheritance graph
[legend]

Classes

class  FactoryEntry
 FactoryEntry class. More...
 

Public Types

typedef std::map< Identifier, FactoryEntryFactoryMap
 
typedef FactoryMap::iterator FactoryMapIt
 
enum  ReturnCode {
  FACTORY_OK, FACTORY_ERROR, ALREADY_EXISTS, NOT_FOUND,
  INVALID_ARG, UNKNOWN_ERROR
}
 

Public Member Functions

ReturnCode addFactory (const Identifier &id, Creator creator, Destructor destructor)
 Add factory. More...
 
AbstractClass * createObject (const Identifier &id)
 Create factory object. More...
 
void deleteObject (const Identifier &id, AbstractClass *&obj)
 Delete factory object. More...
 
void deleteObject (AbstractClass *&obj)
 Delete factory object. More...
 
std::vector< Identifier > getIdentifiers ()
 Get factory ID list. More...
 
bool hasFactory (const Identifier &id)
 Factory presence check. More...
 
ReturnCode removeFactory (const Identifier &id)
 Remove factory. More...
 

Private Attributes

FactoryMap m_creators
 

Detailed Description

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
class coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >

Factory template class.

Definition at line 104 of file coil/common/Factory.h.

Member Typedef Documentation

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
typedef std::map<Identifier, FactoryEntry> coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::FactoryMap

Definition at line 106 of file coil/common/Factory.h.

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
typedef FactoryMap::iterator coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::FactoryMapIt

Definition at line 110 of file coil/common/Factory.h.

Member Enumeration Documentation

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
enum coil::Factory::ReturnCode
Enumerator
FACTORY_OK 
FACTORY_ERROR 
ALREADY_EXISTS 
NOT_FOUND 
INVALID_ARG 
UNKNOWN_ERROR 

Definition at line 112 of file coil/common/Factory.h.

Member Function Documentation

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
ReturnCode coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::addFactory ( const Identifier &  id,
Creator  creator,
Destructor  destructor 
)
inline

Add factory.

Add a factory.

Parameters
idFactory ID.
creatorFunctor for creator.
destructorFunctor for destructor.
Returns
FACTORY_OK: Successful ALREADY_EXISTS: already exists. INVALID_ARG: creator or destructor with invalid values.

Definition at line 217 of file coil/common/Factory.h.

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
AbstractClass* coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::createObject ( const Identifier &  id)
inline

Create factory object.

Create a factory object.

Parameters
idFactory ID.
Returns
Pointer of AbstractClass

Definition at line 284 of file coil/common/Factory.h.

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
void coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::deleteObject ( const Identifier &  id,
AbstractClass *&  obj 
)
inline

Delete factory object.

Delete a factory object.

Parameters
idFactory ID.
objFactory object.

Definition at line 311 of file coil/common/Factory.h.

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
void coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::deleteObject ( AbstractClass *&  obj)
inline

Delete factory object.

Delete a factory object.

Parameters
objFactory object.

Definition at line 336 of file coil/common/Factory.h.

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
std::vector<Identifier> coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::getIdentifiers ( )
inline

Get factory ID list.

Return a list of factory ID.

Returns
ID list

Definition at line 170 of file coil/common/Factory.h.

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
bool coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::hasFactory ( const Identifier &  id)
inline

Factory presence check.

Return a factory having ID or not.

Parameters
idFactory ID.
Returns
true: found, false: not found

Definition at line 145 of file coil/common/Factory.h.

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
ReturnCode coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::removeFactory ( const Identifier &  id)
inline

Remove factory.

Remove a factory.

Parameters
idFactory ID.
Returns
FACTORY_OK: Successful NOT_FOUND: ID not found

Definition at line 253 of file coil/common/Factory.h.

Member Data Documentation

template<class AbstractClass, typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
FactoryMap coil::Factory< AbstractClass, Identifier, Compare, Creator, Destructor >::m_creators
private

Definition at line 398 of file coil/common/Factory.h.


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


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:59