#include <PtrStack.h>
Public Member Functions | |
void | Add (T *t) |
Add a new pointer on the stack. More... | |
T * | At (S which) const |
void | Clear () |
void | Delete () |
S | GetSize () const |
to get the current position in the stack More... | |
PtrStack (S max_size=16) | |
void | SetBottom () |
The object at position c is now on the top of the stack. More... | |
void | SetOwner (Bool_t own=false) |
~PtrStack () | |
Protected Member Functions | |
void | Expand (S) |
void | Init () |
Because of some problems using std containers with pointer (with memory management) this "light" class is to be used as a stack of pointers.
new objects (pointers) are added via the Add method. Once added, an individual pointer cannot be removed ... but all the stack can be cleared using the Clear method. The Delete method makes a similar job but also delete the pointers if this is set to owner via the SetOwner method.
MaxSize:
Max size (allocated) of the stack. This is not a problem since any call of Add will expand the stack if required.
FilledSize:
To get the position of the last non-null pointer
CurrentSize:
Current position in the stack. The At methods allows to get one by one the pointer stored in the stack. (At(GetSize()) checks then is the next pointer exist or not).
TO BE USED only with S as UShort_t or UInt_t.
Definition at line 59 of file PtrStack.h.