casacore
|
#include <ObjectStack.h>
Public Member Functions | |
~ObjectStack () | |
Destructor. More... | |
T * | get () |
Get a pointer to an object in the stack. More... | |
void | put (T *obj) |
Return an object to the stack for re-use. More... | |
void | clear () |
Decimate the stack by getting rid of all unused elements in it. More... | |
Bool | empty () |
Test if stack empty. More... | |
uInt | nelements () const |
return the stack extend (for debugging use and checking mainly) More... | |
Static Public Member Functions | |
static ObjectStack< T > & | stack () |
Create a singleton stack. More... | |
Private Member Functions | |
ObjectStack () | |
All ctor and assignment constructors and assignment (not implemented) More... | |
ObjectStack (const ObjectStack< T > &other) | |
ObjectStack< T > & | operator= (const ObjectStack< T > &other) |
Private Attributes | |
std::vector< T * > | stack_p |
The Stack. More... | |
std::mutex | mutex_p |
A stack of re-usable objects
Public interface
An ObjectStack contains a set of pre-allocated Objects of the type T
. The stack is a very simple stack, without the linking/unlinking of a normal Stack implementation. This lightweight implementation was especially designed for use with the AutoDiff classes, but can be used independently. The stack works best with small object sizes, or letter/envelope classes.
The class is fully thread-safe, thus the same object can be used safely in multiple threads.
To improve the speed for the auto differentiating classes.
Definition at line 94 of file ObjectStack.h.
casacore::ObjectStack< T >::~ObjectStack | ( | ) |
Destructor.
|
inlineprivate |
All ctor and assignment constructors and assignment (not implemented)
Definition at line 129 of file ObjectStack.h.
|
private |
void casacore::ObjectStack< T >::clear | ( | ) |
Decimate the stack by getting rid of all unused elements in it.
|
inline |
Test if stack empty.
Definition at line 115 of file ObjectStack.h.
References casacore::ObjectStack< T >::stack_p.
T* casacore::ObjectStack< T >::get | ( | ) |
Get a pointer to an object in the stack.
The stack will be extended if no objects left.
|
inline |
return the stack extend (for debugging use and checking mainly)
Definition at line 118 of file ObjectStack.h.
References casacore::ObjectStack< T >::stack_p.
|
private |
|
inline |
Return an object to the stack for re-use.
Definition at line 109 of file ObjectStack.h.
References casacore::ObjectStack< T >::stack_p.
|
static |
Create a singleton stack.
|
private |
Definition at line 124 of file ObjectStack.h.
|
private |
The Stack.
Definition at line 123 of file ObjectStack.h.
Referenced by casacore::ObjectStack< T >::empty(), casacore::ObjectStack< T >::nelements(), and casacore::ObjectStack< T >::put().