|
casacore
|
#include <ObjectStack.h>
Public Member Functions | |
| ~ObjectStack () | |
| Destructor. | |
| T * | get () |
| Get a pointer to an object in the stack. | |
| void | put (T *obj) |
| Return an object to the stack for re-use. | |
| void | clear () |
| Decimate the stack by getting rid of all unused elements in it. | |
| Bool | empty () |
| Test if stack empty. | |
| uInt | nelements () const |
| return the stack extend (for debugging use and checking mainly) | |
Static Public Member Functions | |
| static ObjectStack< T > & | stack () |
| Create a singleton stack. | |
Private Member Functions | |
| ObjectStack () | |
| All ctor and assignment constructors and assignment (not implemented) | |
| ObjectStack (const ObjectStack< T > &other) | |
| ObjectStack< T > & | operator= (const ObjectStack< T > &other) |
Private Attributes | |
| std::vector< T * > | stack_p |
| The Stack. | |
| 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 92 of file ObjectStack.h.
| casacore::ObjectStack< T >::~ObjectStack | ( | ) |
Destructor.
|
inlineprivate |
All ctor and assignment constructors and assignment (not implemented)
Definition at line 127 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 113 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 116 of file ObjectStack.h.
References casacore::ObjectStack< T >::stack_p.
|
private |
|
inline |
Return an object to the stack for re-use.
Definition at line 107 of file ObjectStack.h.
References casacore::ObjectStack< T >::stack_p.
|
static |
Create a singleton stack.
|
private |
Definition at line 122 of file ObjectStack.h.
|
private |
The Stack.
Definition at line 121 of file ObjectStack.h.
Referenced by casacore::ObjectStack< T >::empty(), casacore::ObjectStack< T >::nelements(), and casacore::ObjectStack< T >::put().