#include <object_pool.hpp>
Public Member Functions | |
bool | acquire (T &obj) |
bool | add (const T &obj) |
bool | busy (void) |
std::vector< T > | getPool () const |
ObjectPool () | |
bool | release (const T &obj) |
unsigned | size (void) |
~ObjectPool () | |
Private Types | |
typedef std::map< T, bool, C > | poolMap |
Private Attributes | |
poolMap | pool |
An object pool class that creates and reuses objects of an arbitrary type.
Definition at line 41 of file object_pool.hpp.
|
private |
Definition at line 143 of file object_pool.hpp.
|
inline |
Default constructor
Definition at line 45 of file object_pool.hpp.
|
inline |
Default destructor
Definition at line 49 of file object_pool.hpp.
|
inline |
When user code demands an object, pool first looks if there is any spare object to return. In case there is not any available object in the pool, a new object will be created and returned.
Definition at line 87 of file object_pool.hpp.
|
inline |
This function enables one to explicitly put an object into the pool.
In case the object is already in the pool, the function returns false. Otherwise, it returns true.
Definition at line 57 of file object_pool.hpp.
|
inline |
Definition at line 70 of file object_pool.hpp.
|
inline |
This function return a vector containing all objects in the pool
Definition at line 125 of file object_pool.hpp.
|
inline |
This function releases an object in the pool
Definition at line 111 of file object_pool.hpp.
|
inline |
Number of objects in the pool
Definition at line 137 of file object_pool.hpp.
|
private |
Definition at line 145 of file object_pool.hpp.