A base class for object pools. More...
#include <ObjectPool.h++>

Public Member Functions | |
| ObjectPool (size_t size) | |
| Constructor. | |
| virtual | ~ObjectPool () throw () |
| Destructor. | |
| virtual T * | reserve ()=0 throw (ObjectPoolException) |
| Reserve an object from the pool. | |
| virtual void | release (T *elem)=0 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. | |
A base class for object pools.
See DynamicObjectPool and StaticObjectPool for concrete implementations.
| ObjectPool | ( | size_t | size | ) | [inline] |
Constructor.
| size | The number of objects to allocate in the pool. |
| virtual ~ObjectPool | ( | ) | throw () [inline, virtual] |
Destructor.
| uint_t getAvailable | ( | ) | const throw () [inline] |
Get the number of available (unreserved) objects in the pool.
| size_t getSize | ( | ) | const throw () [inline] |
Get the size of the pool, i.e., the total number of objects (both reserved and available) in the pool.
| virtual void release | ( | T * | elem | ) | throw (ObjectPoolException) [pure virtual] |
Release an object back to the pool.
The object's destructor is called before the object is released back to the pool.
| elem | The object to release. |
| ObjectPoolException | If elem is NULL. |
Implemented in DynamicObjectPool< T >, StaticObjectPool< T >, StaticObjectPool< StreamSocket >, StaticObjectPool< _Datum >, and StaticObjectPool< _Node >.
| virtual T* reserve | ( | ) | throw (ObjectPoolException) [pure virtual] |
Reserve an object from the pool.
| ObjectPoolException | If no objects are available in the pool. |
Implemented in DynamicObjectPool< T >, StaticObjectPool< T >, StaticObjectPool< StreamSocket >, StaticObjectPool< _Datum >, and StaticObjectPool< _Node >.
size_t _size [protected] |
The size of the pool (i.e., the maximum number of objects managed by the pool).
1.6.3