#include <eosim/core/entity.hpp>
Collaboration diagram for eosim::core::Entity:
This is the parent class of all entities. Entity is a class that represents objects or components of the system whose activities are modeled. EOSimulator provides a primitive entity which has both a BEvent and a time stamp that indicates the entity’s last bounded event, the clock. If your model needs a more specific entity, just implement a new subclass.
There’s a particular issue when it comes to entities: All entities of a system must be created dynamically, even global or permanent entities. And only temporary entities must be deleted when they leave the system.
That's because of the way that EOSimulator containers are implemented. Entity containers have pointers to its elements, in order to avoid copies. When their destructor is called, it destroys every entity stored. When a simulation ends, every entity is scheduled or waiting in a queue, so they are in an EOSimulator’s container. Entity containers have pointers to its elements, in order to avoid copies. When their destructor is called, it destroys every entity stored. This policy is imposed by EOSimulator but it must be controlled by the user (see Collections).
Public Member Functions | |
Entity () | |
The constructor creates an Entity. Remember, all entities must be created dynamically, even global entities. | |
virtual | ~Entity () |
The destructor of Entity. | |
void | setBEvent (BEvent *bEv) |
This operation sets the entity’s next BEvent to bEv. | |
void | setClock (double clock) |
This operation sets the time when the next BEvent is going to occur. | |
double | getClock () |
Returns the time of the last entity’s B event. | |
void | processEvent () |
This operation process the routine of the entity’s actual BEvent. |
void Entity::setBEvent | ( | BEvent * | bEv | ) |
This operation sets the entity’s next BEvent to bEv.
If setBEvent is invoked with null, the simulation aborts immediately displaying an error message.
void Entity::setClock | ( | double | clock | ) |
This operation sets the time when the next BEvent is going to occur.
void Entity::processEvent | ( | ) |
This operation process the routine of the entity’s actual BEvent.