template<class Derived, bool PerThread = true, class Holder = Tf_StackedStorage<Derived, PerThread>>
class TfStacked< Derived, PerThread, Holder >
A TfStacked is used where a class needs to keep a stack of the objects currently in existence. This class follows the CRTP and is a base class that is parameterized on its derived classes.
TfStacked is thread-safe by default and each thread will get its own stack. This behavior may be disabled by passing false for the PerThread template parameter.
Derived classes must instantiate the stack themselves by putting
TF_INSTANTIATE_STACKED(YourStackedClass)
in a single .cpp file.
Note that Stacked objects that differ only by PerThread will not share stacks.
Definition at line 137 of file stacked.h.
template<class Derived , bool PerThread = true, class Holder = Tf_StackedStorage<Derived, PerThread>>
static Derived const* TfStacked< Derived, PerThread, Holder >::GetStackPrevious |
( |
| ) |
|
|
inlinestatic |
Returns the element under the top of the stack. If the stack contains only one element, or is empty, returns 0. Derived classes can befriend TfStackedAccess and hide (override) _InitializeStack() to pre-populate the stack if desired. This way, a stack can be made never to be empty.
Definition at line 169 of file stacked.h.
template<class Derived , bool PerThread = true, class Holder = Tf_StackedStorage<Derived, PerThread>>
static Derived const* TfStacked< Derived, PerThread, Holder >::GetStackTop |
( |
| ) |
|
|
inlinestatic |
Returns the top of the stack. If the stack is empty, returns 0. Derived classes can befriend TfStackedAccess and hide (override) _InitializeStack() to pre-populate the stack if desired. This way, a stack can be made never to be empty.
Definition at line 159 of file stacked.h.