dynamicgraph::PoolStorage Class Reference

Singleton that keeps track of all the entities. More...

#include <dynamic-graph/pool.h>

Collaboration diagram for dynamicgraph::PoolStorage:
[legend]

Public Member Functions

 ~PoolStorage ()
 Default destructor. More...
 
SignalBase< int > & getSignal (std::istringstream &sigpath)
 Get a signal by name. More...
 
void writeGraph (const std::string &aFileName)
 This method write a graph description on the file named FileName. More...
 
void writeCompletionList (std::ostream &os)
 
Method related to the handling of entities.
void registerEntity (const std::string &entname, Entity *ent)
 Register an entity. More...
 
void deregisterEntity (const std::string &entname)
 Unregister an entity. More...
 
void deregisterEntity (const Entities::iterator &entity)
 Unregister an entity. More...
 
EntitygetEntity (const std::string &name)
 Get an entity. More...
 
const EntitiesgetEntityMap () const
 Const access to entity map. More...
 
bool existEntity (const std::string &name)
 Test if the entity exists. More...
 
bool existEntity (const std::string &name, Entity *&ptr)
 Test if the entity exists. If it does, return a pointer on it. More...
 
void clearPlugin (const std::string &name)
 Disallocate an entity. More...
 

Define types to simplify the writing

typedef std::map< std::string, Entity * > Entities
 Sorted set of entities with unique key (name). More...
 
static PoolStoragegetInstance ()
 Get unique instance of the class. More...
 
static void destroy ()
 Destroy the unique instance of the class. More...
 

Fields of the class to manage the three entities.

Also the name is singular, those are true sets.

Entities entityMap
 Set of basic objects of the SoT. More...
 

Detailed Description

Singleton that keeps track of all the entities.

This class gives access to and remembers all the entities created during its life.

This class provides the necessary operations to register, unregister each instance of thoses classes. As tasks and features derived from Entities, they should be registered as such.

Note
From the code it is not very clear why we should not unregister from the tasks and the features...

Member Typedef Documentation

◆ Entities

typedef std::map<std::string, Entity *> dynamicgraph::PoolStorage::Entities

Sorted set of entities with unique key (name).

Constructor & Destructor Documentation

◆ ~PoolStorage()

dynamicgraph::PoolStorage::~PoolStorage ( )

Default destructor.

Member Function Documentation

◆ clearPlugin()

void dynamicgraph::PoolStorage::clearPlugin ( const std::string &  name)

Disallocate an entity.

[in] entname: The name of the entity,

◆ deregisterEntity() [1/2]

void dynamicgraph::PoolStorage::deregisterEntity ( const std::string &  entname)

Unregister an entity.

[in] entname: The name of the entity,

◆ deregisterEntity() [2/2]

void dynamicgraph::PoolStorage::deregisterEntity ( const Entities::iterator &  entity)

Unregister an entity.

[in] entity: iterator in the map,

◆ destroy()

static void dynamicgraph::PoolStorage::destroy ( )
static

Destroy the unique instance of the class.

◆ existEntity() [1/2]

bool dynamicgraph::PoolStorage::existEntity ( const std::string &  name)

Test if the entity exists.

◆ existEntity() [2/2]

bool dynamicgraph::PoolStorage::existEntity ( const std::string &  name,
Entity *&  ptr 
)

Test if the entity exists. If it does, return a pointer on it.

◆ getEntity()

Entity& dynamicgraph::PoolStorage::getEntity ( const std::string &  name)

Get an entity.

[in] entname: The name of the entity,
Returns
Pointer towards the entity.

◆ getEntityMap()

const Entities& dynamicgraph::PoolStorage::getEntityMap ( ) const

Const access to entity map.

◆ getInstance()

static PoolStorage* dynamicgraph::PoolStorage::getInstance ( )
static

Get unique instance of the class.

Referenced by dynamicgraph::g_pool().

◆ getSignal()

SignalBase<int>& dynamicgraph::PoolStorage::getSignal ( std::istringstream &  sigpath)

Get a signal by name.

Parameters
sigpathstream containing a string of the form "entity.signal"

◆ registerEntity()

void dynamicgraph::PoolStorage::registerEntity ( const std::string &  entname,
Entity ent 
)

Register an entity.

[in] entname: The name of the entity,
[in] ent: Pointer towards the entity.

◆ writeCompletionList()

void dynamicgraph::PoolStorage::writeCompletionList ( std::ostream &  os)

◆ writeGraph()

void dynamicgraph::PoolStorage::writeGraph ( const std::string &  aFileName)

This method write a graph description on the file named FileName.

Member Data Documentation

◆ entityMap

Entities dynamicgraph::PoolStorage::entityMap
protected

Set of basic objects of the SoT.