#include <ObjectPool.hpp>
Collaboration diagram for Ionflux::Tools::ObjectPool:
Public Member Functions | |
ObjectPool () | |
Constructor. | |
virtual | ~ObjectPool () |
Destructor. | |
virtual bool | findObject (ManagedObject *searchObject) |
Find object. | |
virtual bool | addObject (ManagedObject *newObject) |
Add object. | |
virtual void | removeObject (ManagedObject *rmObject) |
Remove object. | |
virtual void | cleanup () |
Cleanup pool. | |
virtual void | clear () |
Clear pool. | |
virtual Ionflux::Tools::Reporter & | getLog () |
Get Console output/logging facility. | |
virtual void | setWatchMode (bool newWatchMode) |
Set watch mode flag. | |
virtual bool | getWatchMode () const |
Get watch mode flag. | |
Protected Member Functions | |
virtual void | unrefAll () |
Unreference all objects. | |
virtual void | removeUnused (unsigned int threshold=0) |
Remove unused objects. | |
Protected Attributes | |
Ionflux::Tools::Reporter | log |
Console output/logging. | |
std::map< ManagedObject *, bool > | objects |
Objects managed by the pool. | |
bool | watchMode |
Watch mode flag. |
A pool of reference counted objects. The purpose of the pool is to delete objects at the end of the lifetime, or on a forced cleanup of the pool, if they are not needed anymore. An object managed by the pool will be deleted if its reference count is zero upon cleanup of the pool.
true
. Such objects will never be added to a pool and a warning message may be issued if an attempt is made to add an explicitly managed object to a pool.
|
Constructor. Construct new ObjectPool object. |
|
Destructor. Destruct ObjectPool object. |
|
Add object. Add an object to the pool.
|
|
Cleanup pool. Clean up the pool. All objects that are not in use by any object (besides the pool itself) are removed from the pool and deleted. |
|
Clear pool. Clear the pool. All objects in the pool will be unreferenced and removed from the pool. Objects will also be deleted if their reference count is zero. |
|
Find object. Check whether an object is in the pool.
|
|
Get Console output/logging facility. The console output/logging facility used by this object.
|
|
Get watch mode flag.
|
|
Remove object. Remove an object from the pool.
|
|
Remove unused objects. Remove all objects for which the reference count has dropped to zero (or to specified value).
|
|
Set watch mode flag. Set new value of watch mode flag.
|
|
Unreference all objects. Remove the reference held by the pool for all objects. |
|
Console output/logging.
|
|
Objects managed by the pool.
|
|
Watch mode flag.
|