Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a02434.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a02434.php on line 2
The ARGoS Website

argos::CFactory< TYPE > Class Template Reference

Basic factory template. More...

#include <factory.h>

Classes

struct  STypeInfo
 A struct containing the information about the registered types. More...
 

Public Types

typedef TYPE * TCreator()
 Pointer to the function that creates objects of type TYPE More...
 
typedef std::map< std::string, STypeInfo * > TTypeMap
 The map of registered TYPEs. More...
 

Static Public Member Functions

static TTypeMapGetTypeMap ()
 Creates and returns the TYPE map. More...
 
static void Register (const std::string &str_label, const std::string &str_author, const std::string &str_version, const std::string &str_brief_desc, const std::string &str_long_desc, const std::string &str_status, TCreator *pc_creator)
 Registers a new TYPE creator in the factory. More...
 
static TYPE * New (const std::string &str_label)
 Creates a new object of type TYPE More...
 
static bool Exists (const std::string &str_label)
 Returns true if the given label exists in the TYPE map. More...
 
static void Print (std::ostream &c_os)
 Prints the list of registered labels. More...
 
static void Destroy ()
 Frees up all used memory. More...
 

Detailed Description

template<typename TYPE>
class argos::CFactory< TYPE >

Basic factory template.

Definition at line 59 of file factory.h.

Member Typedef Documentation

◆ TCreator

template<typename TYPE>
typedef TYPE* argos::CFactory< TYPE >::TCreator()

Pointer to the function that creates objects of type TYPE

Definition at line 65 of file factory.h.

◆ TTypeMap

template<typename TYPE>
typedef std::map<std::string, STypeInfo*> argos::CFactory< TYPE >::TTypeMap

The map of registered TYPEs.

Definition at line 82 of file factory.h.

Member Function Documentation

◆ Destroy()

template<typename TYPE>
void CFactory::Destroy ( )
static

Frees up all used memory.

Definition at line 85 of file factory_impl.h.

◆ Exists()

template<typename TYPE>
bool CFactory::Exists ( const std::string &  str_label)
static

Returns true if the given label exists in the TYPE map.

Returns
true if the given label exists in the TYPE map

Definition at line 62 of file factory_impl.h.

◆ GetTypeMap()

template<typename TYPE>
CFactory< TYPE >::TTypeMap & CFactory::GetTypeMap ( )
static

Creates and returns the TYPE map.

Returns
The TYPE map
Author
Carlo Pinciroli - ilpin.nosp@m.cy@g.nosp@m.mail..nosp@m.com

Definition at line 18 of file factory_impl.h.

◆ New()

template<typename TYPE>
TYPE * CFactory::New ( const std::string &  str_label)
static

Creates a new object of type TYPE

Parameters
str_labelThe label of the TYPE to create
Returns
A new object of type TYPE

Definition at line 48 of file factory_impl.h.

◆ Print()

template<typename TYPE>
void CFactory::Print ( std::ostream &  c_os)
static

Prints the list of registered labels.

Parameters
c_osThe std::ostream to write into

Definition at line 71 of file factory_impl.h.

◆ Register()

template<typename TYPE>
void CFactory::Register ( const std::string &  str_label,
const std::string &  str_author,
const std::string &  str_version,
const std::string &  str_brief_desc,
const std::string &  str_long_desc,
const std::string &  str_status,
TCreator pc_creator 
)
static

Registers a new TYPE creator in the factory.

Parameters
str_labelThe label associated to the TYPE creator
str_authorThe author of the plugin
str_versionThe version of the plugin
str_brief_descThe brief description of the plugin
str_long_descThe long description of the plugin
str_statusThe status of the plugin
pc_creatorThe TYPE creator of the factory

Definition at line 27 of file factory_impl.h.