13 #ifndef ROOT_TIndexTable
14 #define ROOT_TIndexTable
33 const int *fCurrentRow;
34 iterator(): fTable(0), fCurrentRow(0) {}
36 iterator(
const TTable &t,
const int &rowPtr): fTable(&t), fCurrentRow(&rowPtr){}
38 iterator(
const iterator& iter) : fTable(iter.fTable), fCurrentRow(iter.fCurrentRow){}
39 iterator &operator=(
const iterator& iter) {fTable = iter.fTable; fCurrentRow = iter.fCurrentRow;
return *
this;}
40 iterator &operator++() {
if (fCurrentRow) ++fCurrentRow;
return *
this;}
41 void operator++(
int) {
if (fCurrentRow) fCurrentRow++;}
42 iterator &operator--() {
if (fCurrentRow) --fCurrentRow;
return *
this;}
43 void operator--(
int) {
if (fCurrentRow) fCurrentRow--;}
44 iterator &operator+(Int_t idx) {
if (fCurrentRow) fCurrentRow+=idx;
return *
this;}
45 iterator &operator-(Int_t idx) {
if (fCurrentRow) fCurrentRow-=idx;
return *
this;}
46 Int_t operator-(
const iterator &it)
const {
return fCurrentRow-it.fCurrentRow; }
47 void *operator *(){
return (
void *)(fTable?((
char *)fTable->GetArray())+(*fCurrentRow)*(fTable->
GetRowSize()):0);}
48 operator int() {
return *fCurrentRow;}
49 Bool_t operator==(
const iterator &t)
const {
return (fCurrentRow == t.fCurrentRow); }
50 Bool_t operator!=(
const iterator &t)
const {
return !operator==(t); }
54 int *GetTable(Int_t i=0);
55 Bool_t IsValid()
const;
56 void push_back(Long_t next);
59 iterator begin() {
return ((
const TIndexTable *)
this)->begin();}
60 iterator begin()
const {
return GetNRows() ? iterator(*
Table(),*GetTable(0)):end();}
61 iterator end() {
return ((
const TIndexTable *)
this)->end(); }
62 iterator end()
const {Long_t i =
GetNRows();
return i? iterator(*
Table(), *GetTable(i)):iterator(*this);}
78 const int *GetTable(Int_t i=0)
const;
79 int &operator[](Int_t i){ assert(i>=0 && i <
GetNRows());
return *GetTable(i); }
80 const int &operator[](Int_t i)
const { assert(i>=0 && i <
GetNRows());
return *((
const int *)(GetTable(i))); }
85 inline int *TIndexTable::GetTable(Int_t i) {
return ((
int *)GetArray())+i;}
87 inline const int *TIndexTable::GetTable(Int_t i)
const {
return ((
int *)GetArray())+i;}
89 inline Bool_t TIndexTable::IsValid()
const
93 if (!cont)
return kFALSE;
96 iterator finish = end();
99 for (; i != finish; i++) {
101 if ( th == -1 || (0 <= th && th < totalSize) )
continue;
107 inline void TIndexTable::push_back(Long_t next){
AddAt(&next); }
virtual Long_t GetRowSize() const
Returns the size (in bytes) of one table row.
const TTable * Table() const
to be documented
virtual void SetDescriptorPointer(TTableDescriptor *list)
set table descriptor
virtual void SetType(const char *const type)
to be documented
virtual Long_t GetNRows() const
Returns the number of the used rows for the wrapped table.
virtual Int_t AddAt(const void *c)
static TTableDescriptor * CreateDescriptor()
to be documented
virtual TTableDescriptor * GetDescriptorPointer() const
return column descriptor