Factory template class.
More...
#include <Factory.h>
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.
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Enumerator |
---|
FACTORY_OK |
|
FACTORY_ERROR |
|
ALREADY_EXISTS |
|
NOT_FOUND |
|
INVALID_ARG |
|
UNKNOWN_ERROR |
|
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Add factory.
Add a factory.
- Parameters
-
id | Factory ID. |
creator | Functor for creator. |
destructor | Functor for destructor. |
- Returns
- FACTORY_OK: Successful ALREADY_EXISTS: already exists. INVALID_ARG: creator or destructor with invalid values.
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Getting created objects.
This operation returns a list of created objects by the factory.
- Returns
- created object list
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Create factory object.
Create a factory object.
- Parameters
-
- Returns
- Pointer of AbstractClass
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Delete factory object.
Delete a factory object.
- Parameters
-
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Delete factory object.
Delete a factory object.
- Parameters
-
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Get factory ID list.
Return a list of factory ID.
- Returns
- ID list
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Factory presence check.
Return a factory having ID or not.
- Parameters
-
- Returns
- true: found, false: not found
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Whether a object is a product of this factory.
- Parameters
-
- Returns
- true: The object is a product of the factory false: The object is not a product of the factory
-
created object list
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Getting destructor of the object.
This operation returns a constructor of the object created by the factory. obj must be a product of the factory. User must check if the object is a product of the factory by using isProducerOf()-function, before using this function.
- Returns
- destructor of the object
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Getting destructor of the object.
This operation returns a destructor of the object created by the factory. obj must be a product of the factory. User must check if the object is a product of the factory by using isProducerOf()-function, before using this function.
- Returns
- destructor of the object
References coil::Destructor().
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Getting class identifier (ID) from a object.
This operation returns a class identifier (ID) from a object.
- Parameters
-
obj | [in] An object to investigate its class ID. |
id | [out] Class identifier (ID) |
- Returns
- Return code NOT_FOUND: ID not found FACTORY_OK: normal return
template<class AbstractClass , typename Identifier = std::string, typename Compare = std::less<Identifier>, typename Creator = AbstractClass* (*)(), typename Destructor = void (*)(AbstractClass*&)>
Remove factory.
Remove a factory.
- Parameters
-
- Returns
- FACTORY_OK: Successful NOT_FOUND: ID not found
The documentation for this class was generated from the following file:
- /home/openrtm/doc-build/OpenRTM-aist-1.2.1/src/lib/coil/include/coil/Factory.h