GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ADF::PtrStack< T, S > Class Template Reference

PtrStack. More...

#include <PtrStack.h>

Inheritance diagram for ADF::PtrStack< T, S >:

Public Member Functions

void Add (T *t)
 Add a new pointer on the stack. More...
 
T * At (S which) const
 
void Clear ()
 
void Delete ()
 
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 ()
 

Detailed Description

template<typename T, typename S = UInt_t>
class ADF::PtrStack< T, S >

PtrStack.

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.

Warning
Don't store pointers on array of objects in this since the delete method called is without [] (delete intead of delete []).

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.


The documentation for this class was generated from the following file: