#include <DynamicObjectPool.h++>


Classes | |
| struct | Link |
Public Member Functions | |
| DynamicObjectPool (size_t size, void(*resetFunc)(T *), bool lazy=false) | |
| Construct a new DynamicObjectPool of the given size. | |
| ~DynamicObjectPool () throw () | |
| Destructor. | |
| T * | reserve () throw (ObjectPoolException) |
| Reserve an object from the pool. | |
| void | release (T *elem) throw (ObjectPoolException) |
| Release an object back to the pool. | |
| size_t | getSize () const throw () |
| Get the size of the pool, i.e., the total number of objects (both reserved and available) in the pool. | |
| uint_t | getAvailable () const throw () |
| Get the number of available (unreserved) objects in the pool. | |
Protected Attributes | |
| size_t | _size |
| The size of the pool (i.e., the maximum number of objects managed by the pool). | |
| uint_t | _avail |
| The number of objects currently available (not reserved) in the pool. | |
DynamicObjectPool allocates objects on the heap, either all at once when the pool is constructed, or on an as-needed basis, up to the specified limit.
The template parameter T must be a class which has a default constructor. This constructor is used to create new instances of the object.
| DynamicObjectPool | ( | size_t | size, | |
| void(*)(T *) | resetFunc, | |||
| bool | lazy = false | |||
| ) | [inline] |
Construct a new DynamicObjectPool of the given size.
| size | The maximum number of objects to allocate in the pool. | |
| resetFunc | A function that will be used to "reset" objects to their initial state when they are returned to the pool. | |
| lazy | A flag indicating whether objects will be allocated as needed or initially all at once. |
| ~DynamicObjectPool | ( | ) | throw () [inline] |
Destructor.
Deletes all of the objects managed the pool, whether or not they are reserved.
| uint_t getAvailable | ( | ) | const throw () [inline, inherited] |
Get the number of available (unreserved) objects in the pool.
| size_t getSize | ( | ) | const throw () [inline, inherited] |
Get the size of the pool, i.e., the total number of objects (both reserved and available) in the pool.
| void release | ( | T * | elem | ) | throw (ObjectPoolException) [inline, virtual] |
Release an object back to the pool.
The object's reset member function is called before the object is released back to the pool.
| elem | The object to release. |
| ObjectPoolException | If elem is NULL. |
Implements ObjectPool< T >.
| T * reserve | ( | ) | throw (ObjectPoolException) [inline, virtual] |
Reserve an object from the pool.
| ObjectPoolException | If there are no more objects available in the pool. |
Implements ObjectPool< T >.
The number of objects currently available (not reserved) in the pool.
size_t _size [protected, inherited] |
The size of the pool (i.e., the maximum number of objects managed by the pool).
1.5.9