#include <simlpy/Registry.h>
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 Entity * | lookup (const std::string &id) |
| Retrieve the dummy instance of a type with a particular identifier. | |
| static void | clean () |
| Free all of the registered Entitys. | |
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.
| void Registry::insert | ( | Entity * | e | ) | [static] |
Add a subclass of Entity to the registry.
| e | A pointer to a concrete subclass of Entity |
| 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.
| id | The unique identifier of a concrete subclass of Entity |
| 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().
1.5.4