macro

Preprocessor macros available in mimmo, for executable class registration and factorization. More...

Macros

#define REGISTER(Base, Derived, name)
 
#define REGISTER_CUSTOM(Base, Derived, name, customCreator)
 
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
 

Functions

bool isPORT_REGISTERED (const std::string name)
 
template<class Base >
bool isREGISTERED (const std::string name)
 

Detailed Description

Preprocessor macros available in mimmo, for executable class registration and factorization.

Macro Definition Documentation

◆ REGISTER

#define REGISTER (   Base,
  Derived,
  name 
)
Value:
/* register a Derived class with its xml default constructor that will be instantiate as Base*/ \
__attribute__((unused)) static int factory_##Base##_##Derived = mimmo::Factory<Base>::instance().addCreator(name, new mimmo::Creator<Base, Derived>());

Register an executable mimmo class in the Factory singleton.

Parameters
[in]Basename of Derived's base class
[in]Derivedname of the class
[in]namestring to register the creator's name
Returns
counter of the already registered classes

Definition at line 206 of file factory.hpp.

◆ REGISTER_CUSTOM

#define REGISTER_CUSTOM (   Base,
  Derived,
  name,
  customCreator 
)
Value:
/* register a Derived class a custom xml constructor/creator method that will be instantiate as Base*/ \
__attribute__((unused)) static int factory_##Base##_##Derived = mimmo::Factory<Base>::instance().addCreator(name, new Creator<Base, Derived>(&customCreator));

Register an executable mimmo class in the Factory singleton, and passing with it the method also a custom creator method

Parameters
[in]Basename of Derived's base class
[in]Derivedname of the class
[in]namestring to register the creator's name
[in]customCreatormethod to create the class
Returns
counter of the already registered classes

Definition at line 222 of file factory.hpp.

◆ REGISTER_PORT

#define REGISTER_PORT (   Name,
  Container,
  Datatype,
  ManipBlock 
)
Value:
/* Register a Port in the mimmo::portManager*/ \
__attribute__((unused)) static long port_##Name##_##Container##_##Datatype##_##ManipBlock = mimmo::PortManager::instance().addPort(Name, Container, Datatype, __FILE__);\

Macro to register a port directly on PortManager singleton. If the port does not exist create it, assign a unique id and return the latter. If the port already exists, does nothing.

Parameters
[in]Namename of Derived's base class
[in]Containername of the class
[in]Datatypestring to register the creator's name
[in]ManipBlockname of the mimmo class header where ports are declared.
Returns
counter of the already registered classes

Definition at line 211 of file portManager.hpp.

Function Documentation

◆ isPORT_REGISTERED()

bool isPORT_REGISTERED ( const std::string  name)
inline

Return if a port Name is already registered or not.

Parameters
[in]namestring of the port's name
Returns
boolean true/false if the port name is already registered

Definition at line 224 of file portManager.hpp.

◆ isREGISTERED()

template<class Base >
bool isREGISTERED ( const std::string  name)
inline

Return if a creator name referencing to a Base class is already registered or not.

Parameters
[in]namestring to register the creator's name
Returns
boolean true/false if the creator name is already registered

Definition at line 233 of file factory.hpp.

static PortManager & instance()
Definition: portManager.hpp:85
static Factory & instance()
Definition: factory.hpp:78
int addCreator(const std::string name, const AbstractCreator *creator)
Definition: factory.hpp:109
long addPort(const std::string name, const std::string container_name, const std::string datatype_name, const std::string fileregistration)
Definition: portManager.hpp:99
Template class to create an object Base * = new Derived creator class, where Derived is a generic der...
Definition: factory.hpp:168