Eclipse 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 34 of file InstancePool.h.
|
inline |
Constructor.
[in] | deleteOnQuit | Information whether stored instances shall be deleted when this container is deleted |
Definition at line 40 of file InstancePool.h.
|
inline |
Destructor.
Definition at line 44 of file InstancePool.h.
References InstancePool< T >::myDeleteOnQuit, and InstancePool< T >::myFreeInstances.
|
inline |
Adds a free, reusable instance.
[in] | instance | An instance to add |
Definition at line 76 of file InstancePool.h.
References InstancePool< T >::myFreeInstances.
|
inline |
Adds some free, reusable instances.
[in] | instances | A vector of instances to add |
Definition at line 85 of file InstancePool.h.
References InstancePool< T >::myFreeInstances.
|
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 61 of file InstancePool.h.
References InstancePool< T >::myFreeInstances.
|
private |
Information whether the stored instances shall be deleted.
Definition at line 96 of file InstancePool.h.
Referenced by InstancePool< T >::~InstancePool().
|
private |
List of reusable instances.
Definition at line 93 of file InstancePool.h.
Referenced by InstancePool< T >::addFreeInstance(), InstancePool< T >::addFreeInstances(), InstancePool< T >::getFreeInstance(), and InstancePool< T >::~InstancePool().