green::InstancePool Class Reference

#include <InstancePool.h>

Inheritance diagram for green::InstancePool:

green::EntityPool List of all members.

Public Member Functions

ID AddInstance (VariableTableInstancePtr inst)
bool HasInstance (ID id) const
VariableTableInstancePtr GetInstance (ID id) const
void RemoveInstance (ID id)

Protected Types

typedef std::map< ID, VariableTableInstancePtr > _idMap

Protected Member Functions

ID _getUnusedID ()

Protected Attributes

_idMap mIDMap
std::stack< IDmReusedIDs

Detailed Description

InstancePool is a class which manages VariableTableInstance objects. You can add new ones and delete old ones dynamically. Instances are assigned a VariableTableInstance::ID when they are added to the pool, and instances can therafter be referenced by this ID. ID's are reused after objects are destroyed.


Member Typedef Documentation

typedef std::map<ID, VariableTableInstancePtr> green::InstancePool::_idMap [protected]

A std::map type that associates IDs with Instances


Member Function Documentation

ID green::InstancePool::AddInstance ( VariableTableInstancePtr  inst  )  [inline]

Add a new instance to the pool.

Parameters:
inst The instance to add to the pool
Returns:
Returns the ID assigned to the instance

bool green::InstancePool::HasInstance ( ID  id  )  const [inline]

Check if an instance is in the pool

Parameters:
id The VariableTableInstance::ID of the instance to check for.
Returns:
Returns true if the instance is in the pool. False otherwise.

VariableTableInstancePtr green::InstancePool::GetInstance ( ID  id  )  const [inline]

Get an instance from the pool, if it exists

Parameters:
id The VariableTableInstance::ID of the instance to get.
Returns:
Returns the instance.

void green::InstancePool::RemoveInstance ( ID  id  )  [inline]

Remove an instance from the pool, if it exists.

Parameters:
id The VariableTableInstance::ID of the instance to remove.

ID green::InstancePool::_getUnusedID (  )  [inline, protected]

Get an unused ID to assign to an added instance.


Member Data Documentation

_idMap green::InstancePool::mIDMap [protected]

A std::map that associates IDs with Instances

std::stack<ID> green::InstancePool::mReusedIDs [protected]

a stack used to keep track of reused IDs


The documentation for this class was generated from the following file:
Generated on Fri Apr 27 10:27:39 2007 for Green Engine by  doxygen 1.5.1