File kernel/src/modelingTools/RelationFactory.hpp#

Go to the source code of this file

Factory to generate user-defined Relations.

Defines

AUTO_REGISTER_RELATION(class_name, class_type)#
namespace RelationFactory#

Namespace for Relation factory related objects.

Typedefs

typedef SP::Relation (*object_creator)(int)#

A pointer to function, returning a pointer to Relation, built with its type (related to the class name)

typedef std::map<int, object_creator> MapFactory#

The type of the factory map.

typedef MapFactory::iterator MapFactoryIt#

An iterator through the MapFactory.

Functions

template<class SubType>
SP::Relation factory(int name)#

Template function to return a new object of type SubType.

Parameters:

name – an int, the name of the object added

Returns:

SP::Relation

class Registry#
#include <RelationFactory.hpp>

Registry Class for sensors.

Relation factory. Use: RelationFactory::Registry& regRelation(RelationFactory::Registry::get()) ; SP::Relation yourRelation = regRelation.instantiate(type, x0);

Public Functions

void add(int name, object_creator obj)#

Add an object_creator into the factory_map, factory_map[name] = object.

Parameters:
  • name – an int, the name of the object added

  • obj – an object creator

SP::Relation instantiate(int name)#

Function to instantiate a new Relation.

Parameters:

name – an int, the name of the object added (type name!)

Returns:

SP::Relation

Public Static Functions

static Registry &get()#

Access function to the Registry.

Returns:

Registry&

Private Members

MapFactory factory_map#

map that links a std::string, the type of the class, to a pointer to function, used to build the object.

class Registration#
#include <RelationFactory.hpp>

Registration Class for relations.

Class used for auto-registration of Relation-type objects.

Public Functions

Registration(int name, object_creator obj)#

To register some new object into the factory.

Parameters:
  • name – an int, the name of the object to be registered

  • obj – an object creator