#include <simlpy/Entity.h>

Public Types | |
|
typedef std::vector < InterpreterItem > | ArgList |
| The type for a custom varargs implementation. | |
Public Member Functions | |
| Entity () | |
| Default constructor. | |
| virtual | ~Entity () |
| Virtual destructor. | |
| virtual Entity * | create () const =0 |
| Create a new Entity of the derived type. | |
| virtual void | configure (const ArgList &args)=0 |
| Configure an Entity. | |
| virtual void | emit (const ArgList &args)=0 |
| Create an enqueue an Event. | |
| virtual InterpreterItem | get (const ArgList &args) |
| Get entity state. | |
| virtual std::string | identifier () const =0 |
| The unique identifier string for a derived type. | |
| virtual void | collect () const |
| Collect current information from an Entity. | |
| virtual void | finalize () const |
| Perform some final actions before the simulator exits. | |
This class provides basic event-handling functionality and bookkeeping for automated clean-up. Every type of event should have an accompanying abstract class inheriting Entity as a virtual base. Specific event-handling classes then inherit these abstract classes, permitting the various types of events to ensure at compilation time that they have appropriate destinations.
It is important that Entitys are created using new if automatic deletion via a dead pile is used. Only scheduling, not the actual deletion, is handled here.
Definition at line 59 of file Entity.h.
| virtual Entity* Entity::create | ( | ) | const [pure virtual] |
Create a new Entity of the derived type.
This is a cloning method, which allows us to store a dummy object of a concrete derived type in the Registry and generate new instances without having to know the actual object type. All Entitys use only default constructors.
Implemented in AccelNode::AcceleratedMobileNode, Mobility::MobileNode, Mobility::RandomWaypointNode, Mobility::WirelessLink, NamTracer, ExplicitRoutingEntity, GStatDump, PrefixRoutingEntity, SpaceAvailEntity, TrafficGenerator, WrapLink, WrapNode, RF::RFLink, InterpreterEntity, and Terminator.
Referenced by WrapNode::configure(), and sim_entity().
| virtual void Entity::configure | ( | const ArgList & | args | ) | [pure virtual] |
Configure an Entity.
Once created, most Entitys will need to be configured. This is done with a varargs-type technique, in which the arguments are passed as a vector of strings. String references to other Entitys can be handled by resolve_symbol().
| args | The configuration arguments for this Entity. |
Implemented in TrafficGenerator.
| virtual void Entity::emit | ( | const ArgList & | args | ) | [pure virtual] |
Create an enqueue an Event.
As with configure, this uses varargs-like arguments. The arguments should indicate the type of Event to generate (which need not be uniformly specified for all Entity subtypes) and how to configure the Event. It is recommended that all Entitys use the first argument for the schedule time at which the Event is to be processed.
| args | The description of the Event to emit. |
Implemented in TrafficGenerator.
| InterpreterItem Entity::get | ( | const ArgList & | args | ) | [virtual] |
Get entity state.
The arguments to this method are generally descriptive strings specifying attributes of the entity subclass. Anything that calls the base-class version will throw an exception.
| args | The attribute specification |
Definition at line 49 of file Entity.cc.
Referenced by WrapNode::get(), and WrapLink::get().
| virtual std::string Entity::identifier | ( | ) | const [pure virtual] |
The unique identifier string for a derived type.
Entity subclasses are distinguished by an identifying string. All instances of a subclass will have the same identifier, which is used by the Registry to allow the interpreter to generate new Entitys and by Event handlers to properly cast returned void* pointers in ItemWrapper to their correct types.
Implemented in AccelNode::AcceleratedMobileNode, Mobility::MobileNode, Mobility::RandomWaypointNode, Mobility::WirelessLink, NamTracer, CustodyEntity, ForwardingEntity, GStatDump, TrafficGenerator, WrapLink, WrapNode, RF::RFLink, InterpreterEntity, and Terminator.
Referenced by export_entity(), and Registry::insert().
| void Entity::collect | ( | ) | const [virtual] |
| void Entity::finalize | ( | ) | const [virtual] |
1.5.4