4 #ifndef ROOT_TGenericTable
5 #define ROOT_TGenericTable
8 #include "TTableDescriptor.h"
30 iterator(): fRowSize(0), fCurrentRow(0) {}
32 iterator(UInt_t size,
char &rowPtr): fRowSize(size), fCurrentRow(&rowPtr){}
35 iterator(
const iterator& iter) : fRowSize (iter.fRowSize), fCurrentRow(iter.fCurrentRow){}
36 iterator &operator=(
const iterator& iter) { fRowSize = iter.fRowSize; fCurrentRow = iter.fCurrentRow;
return *
this;}
37 iterator &operator++() {
if (fCurrentRow) fCurrentRow+=fRowSize;
return *
this;}
38 void operator++(
int) {
if (fCurrentRow) fCurrentRow+=fRowSize;}
39 iterator &operator--() {
if (fCurrentRow) fCurrentRow-=fRowSize;
return *
this;}
40 void operator--(
int) {
if (fCurrentRow) fCurrentRow-=fRowSize;}
41 iterator &operator+(Int_t idx) {
if (fCurrentRow) fCurrentRow+=idx*fRowSize;
return *
this;}
42 iterator &operator-(Int_t idx) {
if (fCurrentRow) fCurrentRow-=idx*fRowSize;
return *
this;}
43 Int_t operator-(
const iterator &it)
const {
return (fCurrentRow-it.fCurrentRow)/fRowSize; }
44 char *operator *(){
return fCurrentRow;}
45 Bool_t operator==(
const iterator &t)
const {
return (fCurrentRow == t.fCurrentRow); }
46 Bool_t operator!=(
const iterator &t)
const {
return !operator==(t); }
53 TGenericTable(
const char *structName,
const char *name,Int_t n);
62 char *GetTable(Int_t i=0)
const {
return ((
char *)GetArray())+i*
GetRowSize();}
65 char &operator[](Int_t i){ assert(i>=0 && i <
GetNRows());
return *GetTable(i); }
66 const char &operator[](Int_t i)
const { assert(i>=0 && i <
GetNRows());
return *((
const char *)(GetTable(i))); }
67 iterator begin() {
return ((
const TGenericTable *)
this)->begin();}
68 iterator begin()
const {
return GetNRows() ? iterator(*
this, *GetTable(0)):end();}
69 iterator end() {
return ((
const TGenericTable *)
this)->end(); }
70 iterator end()
const {Long_t i =
GetNRows();
return i? iterator(*
this, *GetTable(i)):iterator(*this);}
virtual void SetDescriptorPointer(TTableDescriptor *list)
to be documented
virtual Long_t GetRowSize() const
Returns the size (in bytes) of one table row.
virtual TTableDescriptor * GetDescriptorPointer() const
to be documented
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 ~TGenericTable()
destructor
TTableDescriptor * GetRowDescriptors() const
to be documented
TTableDescriptor * GetTableDescriptors() const
protected: create a new TTableDescriptor descriptor for this table