SimObjectPool Class Reference

Container for all elements in the simulation. More...

#include <SimObjectPool.h>

Collaboration diagram for SimObjectPool:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SimObjectPool (int nTypes)
virtual ~SimObjectPool ()
local_objectid_t addObject (SimObjectFactory const &objFactory, RandomEngine *rng)
 Add a new instance (or random variarion thereof) of the specified object.
local_objectid_t addObject (SimObjectFactory const &objFactory)
 Add a new instance of the specified object.
SimObjectgetObject (object_type_t otype, local_objectid_t oid)
 Get a pointer to the specified objects.
void updateObjects (bool dtHasChanged, double dt)
 A call to this function makes sure that all objects contained in the pool are self-consistent.
int numOfTypes ()
 Return the number of different object types stored.
int numOfObjects (object_type_t type)
 Returns the number of a specified type of objects.
object_type_t getLastTypeId ()
 Return the type ID with the higest value.
SimObjectIterator beginObject (object_type_t type)
 Returns an iterator for looping over all objects of the given type.
SimObjectIterator endObject (object_type_t type)
 End iterator corresponding to beginObject( eid, type ).

Protected Types

typedef vector< vector
< SimObject * > > 
eng_type_pool_t

Protected Member Functions

local_objectid_t addObject (SimObject *o, object_type_t type)

Protected Attributes

eng_type_pool_t pool

Classes

class  SimObjectIterator
 Iterator for iterating over the advancable objects in the pool. More...


Detailed Description

Container for all elements in the simulation.

Definition at line 11 of file SimObjectPool.h.


Member Typedef Documentation

typedef vector< vector< SimObject* > > SimObjectPool::eng_type_pool_t [protected]

Definition at line 43 of file SimObjectPool.h.


Constructor & Destructor Documentation

SimObjectPool::SimObjectPool ( int  nTypes  ) 

Definition at line 13 of file SimObjectPool.cpp.

References pool.

SimObjectPool::~SimObjectPool (  )  [virtual]

Destructor. All objects (simulation elements) that are contained in the pool are also deleted from the heap.

Definition at line 76 of file SimObjectPool.cpp.

References pool.


Member Function Documentation

local_objectid_t SimObjectPool::addObject ( SimObjectFactory const &  objFactory,
RandomEngine rng 
) [inline]

Add a new instance (or random variarion thereof) of the specified object.

Definition at line 130 of file SimObjectPool.h.

References SimObjectFactory::create(), SimObjectFactory::getObjectTypeID(), and SimObject::setAllocator().

Referenced by SingleThreadSimEngine::addObject(), and addObject().

Here is the call graph for this function:

local_objectid_t SimObjectPool::addObject ( SimObjectFactory const &  objFactory  )  [inline]

Add a new instance of the specified object.

Definition at line 136 of file SimObjectPool.h.

References addObject(), SimObjectFactory::create(), SimObjectFactory::getObjectTypeID(), and SimObject::setAllocator().

Here is the call graph for this function:

SimObject * SimObjectPool::getObject ( object_type_t  otype,
local_objectid_t  oid 
)

Get a pointer to the specified objects.

Returns a pointer to the object identified by [otype,oid] tuple. The parameters should be in the right range because they are not checked!

Definition at line 61 of file SimObjectPool.cpp.

References pool.

Referenced by SingleThreadSimEngine::addObject(), SingleThreadSimEngine::getObject(), SingleThreadSimEngine::one_way_link(), and SingleThreadSimEngine::two_way_link().

void SimObjectPool::updateObjects ( bool  dtHasChanged,
double  dt 
)

A call to this function makes sure that all objects contained in the pool are self-consistent.

Parameters:
dtHasChanged Flag which idicates whether the simulation time step has changed

Definition at line 46 of file SimObjectPool.cpp.

References pool.

Referenced by SingleThreadSimEngine::reset().

int SimObjectPool::numOfTypes (  )  [inline]

Return the number of different object types stored.

Definition at line 34 of file SimObjectPool.h.

References pool.

Referenced by SingleThreadSimEngine::initialize(), and SingleThreadSimEngine::reset().

int SimObjectPool::numOfObjects ( object_type_t  type  )  [inline]

Returns the number of a specified type of objects.

Definition at line 142 of file SimObjectPool.h.

References pool.

object_type_t SimObjectPool::getLastTypeId (  )  [inline]

Return the type ID with the higest value.

Definition at line 150 of file SimObjectPool.h.

References pool.

SimObjectIterator SimObjectPool::beginObject ( object_type_t  type  )  [inline]

Returns an iterator for looping over all objects of the given type.

Parameters:
type Integer ID specifying the type of objects

Definition at line 91 of file SimObjectPool.h.

References pool.

Referenced by SingleThreadSimEngine::advance(), SingleThreadSimEngine::initialize(), and SingleThreadSimEngine::reset().

SimObjectIterator SimObjectPool::endObject ( object_type_t  type  )  [inline]

End iterator corresponding to beginObject( eid, type ).

Definition at line 102 of file SimObjectPool.h.

References pool.

Referenced by SingleThreadSimEngine::advance(), SingleThreadSimEngine::initialize(), and SingleThreadSimEngine::reset().

local_objectid_t SimObjectPool::addObject ( SimObject o,
object_type_t  type 
) [protected]

Adds object in the element based on the type it belongs, the object is assigned local_id.

Definition at line 24 of file SimObjectPool.cpp.

References pool.


Member Data Documentation


The documentation for this class was generated from the following files:

Generated on Wed Jul 9 16:34:53 2008 for PCSIM by  doxygen 1.5.5