SUMO - Simulation of Urban MObility
|
A pool of resuable instances. More...
#include <InstancePool.h>
Public Member Functions | |
void | addFreeInstance (T *instance) |
Adds a free, reusable instance. | |
void | addFreeInstances (const std::vector< T * > instances) |
Adds some free, reusable instances. | |
T * | getFreeInstance () |
Returns a free instance or 0 if no such exists. | |
InstancePool (bool deleteOnQuit) | |
Constructor. | |
~InstancePool () | |
Destructor. | |
Private Attributes | |
bool | myDeleteOnQuit |
Information whether the stored instances shall be deleted. | |
std::vector< T * > | myFreeInstances |
List of reusable instances. |
A pool of resuable instances.
Definition at line 46 of file InstancePool.h.
InstancePool< T >::InstancePool | ( | bool | deleteOnQuit | ) | [inline] |
Constructor.
[in] | deleteOnQuit | Information whether stored instances shall be deleted when this container is deleted |
Definition at line 52 of file InstancePool.h.
InstancePool< T >::~InstancePool | ( | ) | [inline] |
Destructor.
Definition at line 56 of file InstancePool.h.
void InstancePool< T >::addFreeInstance | ( | T * | instance | ) | [inline] |
Adds a free, reusable instance.
[in] | instance | An instance to add |
Definition at line 88 of file InstancePool.h.
Referenced by TraCIDijkstraRouter< E >::clearTemporaryStorages().
void InstancePool< T >::addFreeInstances | ( | const std::vector< T * > | instances | ) | [inline] |
Adds some free, reusable instances.
[in] | instances | A vector of instances to add |
Definition at line 97 of file InstancePool.h.
T* InstancePool< T >::getFreeInstance | ( | ) | [inline] |
Returns a free instance or 0 if no such exists.
If any free instance is stored, it is returned and removed from the storage. If no one is stored, 0 is returned.
Definition at line 73 of file InstancePool.h.
Referenced by TraCIDijkstraRouter< E >::compute().
bool InstancePool< T >::myDeleteOnQuit [private] |
Information whether the stored instances shall be deleted.
Definition at line 108 of file InstancePool.h.
Referenced by InstancePool< std::vector< bool > >::~InstancePool().
std::vector<T*> InstancePool< T >::myFreeInstances [private] |
List of reusable instances.
Definition at line 105 of file InstancePool.h.
Referenced by InstancePool< std::vector< bool > >::addFreeInstance(), InstancePool< std::vector< bool > >::addFreeInstances(), InstancePool< std::vector< bool > >::getFreeInstance(), and InstancePool< std::vector< bool > >::~InstancePool().