Entity Class Reference
[sim]

Basic event dispatcher. More...

#include <simlpy/Entity.h>

Inheritance diagram for Entity:

Inheritance graph
[legend]

List of all members.

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 Entitycreate () 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.


Detailed Description

Basic event dispatcher.

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.

See also:
Event

Definition at line 59 of file Entity.h.


Member Function Documentation

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.

Returns:
pointer to a new Entity of the derived type

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().

Parameters:
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.

Parameters:
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.

Parameters:
args The attribute specification
Returns:
the attribute, in the interpreter's format

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.

Returns:
the derived type's unique identifier

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]

Collect current information from an Entity.

By default, this will do nothing.

Reimplemented in WrapNode.

Definition at line 56 of file Entity.cc.

void Entity::finalize (  )  const [virtual]

Perform some final actions before the simulator exits.

By default, this will do nothing.

Reimplemented in WrapNode.

Definition at line 61 of file Entity.cc.


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