00001 // @(#)root/tree:$Id: TIndArray.h 30815 2009-10-20 13:49:22Z rdm $ 00002 // Author: Lukasz Janyst <ljanyst@cern.ch> 23/01/2008 00003 00004 //------------------------------------------------------------------------------ 00005 // file: TIndArray.h 00006 //------------------------------------------------------------------------------ 00007 00008 #ifndef ROOT_TIndArray 00009 #define ROOT_TIndArray 00010 00011 #ifndef ROOT_Rtypes 00012 #include "Rtypes.h" 00013 #endif 00014 00015 00016 class TIndArray 00017 { 00018 public: 00019 TIndArray(): 00020 fElems( 0 ), fCapacity( 0 ), fArr( 0 ) {}; 00021 00022 virtual ~TIndArray() 00023 { 00024 delete [] fArr; 00025 } 00026 00027 void Reserve( UInt_t size ) 00028 { 00029 delete fArr; 00030 fElems = 0; 00031 fArr = new UChar_t[size]; 00032 fCapacity = size; 00033 } 00034 00035 UInt_t GetCapacity() { return fCapacity; } 00036 UInt_t GetNumItems() { return fElems; } 00037 void SetNumItems( UInt_t items ) { fElems = items;} 00038 UChar_t &At( Int_t ind ) { return fArr[ind]; } 00039 void Clear() { fElems = 0; } 00040 00041 private: 00042 UInt_t fElems; // Number of elements stored in the array 00043 UInt_t fCapacity; //!Capacity of the array 00044 UChar_t *fArr; //[fElems] The array 00045 00046 }; 00047 00048 #endif // ROOT_TIndArray