Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TIndArray.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/tree:$Id$
0002 // Author:  Lukasz Janyst <ljanyst@cern.ch> 23/01/2008
0003 
0004 //------------------------------------------------------------------------------
0005 // file:   TIndArray.h
0006 //------------------------------------------------------------------------------
0007 
0008 #ifndef ROOT_TIndArray
0009 #define ROOT_TIndArray
0010 
0011 #include "RtypesCore.h"
0012 
0013 
0014 class TIndArray
0015 {
0016    public:
0017       TIndArray():
0018          fElems( 0 ), fCapacity( 0 ), fArr( nullptr ) {};
0019 
0020       virtual ~TIndArray()
0021       {
0022          delete [] fArr;
0023       }
0024 
0025       void ClearAndResize( UInt_t size )
0026       {
0027          delete [] fArr;
0028          fElems = 0;
0029          fArr = new UChar_t[size];
0030          fCapacity = size;
0031       }
0032 
0033       UInt_t   GetCapacity() { return fCapacity; }
0034       UInt_t   GetNumItems() { return fElems; }
0035       void     SetNumItems( UInt_t items ) { fElems = items;}
0036       UChar_t &At( Int_t ind ) { return fArr[ind]; }
0037       void     Clear() { fElems = 0; }
0038 
0039    private:
0040       UInt_t   fElems;     ///<  Number of elements stored in the array
0041       UInt_t   fCapacity;  ///<! Capacity of the array
0042       UChar_t *fArr;       ///<[fElems] The array
0043 
0044 };
0045 
0046 #endif // ROOT_TIndArray