Registry Class Reference
[sim]

Bookkeeping class for Entitys that should be visible in the interpreter. More...

#include <simlpy/Registry.h>

List of all members.

Public Types

typedef std::map< std::string,
Entity * > 
EntityMap
 The mapping between unique type identifiers and Entity subclasses.

Static Public Member Functions

static void insert (Entity *e)
 Add a subclass of Entity to the registry.
static Entitylookup (const std::string &id)
 Retrieve the dummy instance of a type with a particular identifier.
static void clean ()
 Free all of the registered Entitys.


Detailed Description

Bookkeeping class for Entitys that should be visible in the interpreter.

Each subclass of Entity has a unique identifying string, which is used to key a map to a dummy instance of the subclass. This string can then be used to retrieve the dummy instance and clone a new instance using Entity::create(). This allows the interpreter to generate instances of C++ classes without those classes having to be mirrored into the interpreter as anything more complex than string.

Definition at line 54 of file Registry.h.


Member Function Documentation

void Registry::insert ( Entity e  )  [static]

Add a subclass of Entity to the registry.

Parameters:
e A pointer to a concrete subclass of Entity
Exceptions:
SimulationException e is NULL
SimulationException An instance of this type has already been registered

Definition at line 42 of file Registry.cc.

References Entity::identifier().

Referenced by add_entity().

Entity * Registry::lookup ( const std::string &  id  )  [static]

Retrieve the dummy instance of a type with a particular identifier.

Parameters:
id The unique identifier of a concrete subclass of Entity
Exceptions:
SimulationException No instance of this type has been registered

Definition at line 55 of file Registry.cc.

Referenced by WrapNode::configure(), and sim_entity().

void Registry::clean (  )  [static]

Free all of the registered Entitys.

This should only be called at the end of a simulation job.

Definition at line 66 of file Registry.cc.

Referenced by cleanup().


The documentation for this class was generated from the following files:
Generated on Mon Mar 24 11:15:47 2008 for Pydtn Simulator by  doxygen 1.5.4