28 #ifndef CASA_OBJECTPOOL_H 29 #define CASA_OBJECTPOOL_H 32 #include <casacore/casa/aips.h> 33 #include <casacore/casa/Containers/PoolStack.h> 34 #include <casacore/casa/Containers/SimOrdMap.h> 35 #include <casacore/casa/OS/Mutex.h> 114 T *
get(
const Key key=Key()) {
return getStack(key).get(); };
122 void release(T *obj,
const Key key=Key());
166 #ifndef CASACORE_NO_AUTO_TEMPLATES 167 #include <casacore/casa/Containers/ObjectPool.tcc> 168 #endif //# CASACORE_NO_AUTO_TEMPLATES void clearStacks()
Decimate the stacks by deleting all unused objects.
Key defKey_p
The default key and stack, and the last referenced one (for caching purposes)
void doClearStack(const Key key)
Do the actual clearing of the stack (without a lock).
~ObjectPool()
Delete the pool.
void release(T *obj, const Key key=Key())
Release an object obtained from the pool through get for re-use.
void clear()
Decimate the stacks and remove any map entry that is completely unused.
Simple map with keys ordered.
PoolStack< T, Key > * defStack_p
uInt nelements() const
Get the number of object stacks in the pool.
A parameterized stack of re-usable objects.
void clearStack(const Key key=Key())
PoolStack< T, Key > & getStack(const Key key)
Get the object stack for the given key.
PoolStack< T, Key > * cacheStack_p
Wrapper around a pthreads mutex.
A parameterized stack of re-usable objects.
ObjectPool< T, Key > & operator=(const ObjectPool< T, Key > &other)
this file contains all the compiler specific defines
SimpleOrderedMap< Key, PoolStack< T, Key > * > map_p
The pool map.
ObjectPool()
Create the pool.