Container for all elements in the simulation. More...
#include <EvSimObjectPool.h>
Classes | |
class | Iterator |
Public Member Functions | |
virtual | ~EvSimObjectPool () |
EvSimObject::ID | createObject (EvSimObjectFactory const &objFactory) |
Add a new instance of the specified object by using a factory. | |
EvSimObject::ID | addObject (EvSimObject *o) |
Add an already created sim object in the pool. | |
EvSimObject * | getObject (EvSimObject::ID oid) const |
Get a pointer to the specified objects. | |
void | initObjects (EvSimNetwork &net) |
A call to this function makes sure that all objects contained in the pool are initialized properly and ready for simulation. | |
void | resetObjects (InitializeContext &sim_ctxt) |
int | numOfObjects () |
Returns the number of objects. | |
EvSimObject::ID | getLastId () |
Return the highest id value. | |
Iterator | begin () |
Returns an iterator for looping over all objects. | |
Iterator | end () |
End iterator corresponding to begin(). | |
Protected Member Functions | |
EvSimObject::ID | addObject (EvSimObjectFactory const &objFactory, RandomEngine *rng) |
Protected Attributes | |
vector< EvSimObject * > | pool |
Container for all elements in the simulation.
EvSimObjectPool::~EvSimObjectPool | ( | ) | [virtual] |
Destructor. All sim objects that the pool contains are also deleted from the heap.
EvSimObject::ID EvSimObjectPool::addObject | ( | EvSimObject * | o | ) |
Add an already created sim object in the pool.
Adds object in the pool. the object is assigned id.
EvSimObject * EvSimObjectPool::getObject | ( | EvSimObject::ID | oid | ) | const |
Get a pointer to the specified objects.
Returns a pointer to the object identified by its id.
void EvSimObjectPool::initObjects | ( | EvSimNetwork & | net | ) |
A call to this function makes sure that all objects contained in the pool are initialized properly and ready for simulation.
Calls init() of every evsimobject in the pool.
void EvSimObjectPool::resetObjects | ( | InitializeContext & | sim_ctxt | ) |
Calls init() of every evsimobject in the pool.