class TGenericTable: public TTable


TGenericTable

This is the class to represent the array of C-struct
defined at run-time

Example: see $ROOTSYS/tutorials/tree/staff.C

 !{
 !//   example of macro to read data from an ascii file and
 !//   create a root file with an histogram and an ntuple.
 !//   A'la the famous ROOT/PAW staff data example
 !//   ( see PAW - Long write up, CERN, page33. )
 !
 !   gROOT->Reset();
 !   gSystem->Load("libRootKernel");
 !
 !   struct staff_t {
 !                Int_t cat;
 !                Int_t division;
 !                Int_t flag;
 !                Int_t age;
 !                Int_t service;
 !                Int_t children;
 !                Int_t grade;
 !                Int_t step;
 !                Int_t nation;
 !                Int_t hrweek;
 !                Int_t cost;
 !    };
 !
 !   staff_t staff;
 !
 !   // open ASCII data file
 !   FILE *fp = fopen("staff.dat","r");
 !
 !   char line[81];
 !
 !   // Create the generic table for 1000 rows (it may grow then)
 !   TGenericTable *allStaff = new TGenericTable("staff_t","Staff-data",1000);
 !
 !   // Fill the memory resident table
 !   while (fgets(&line,80,fp)) {
 !      sscanf(&line[0] ,"%d%d%d%d", &staff.cat,&staff.division,&staff.flag,&staff.age);
 !      sscanf(&line[13],"%d%d%d%d", &staff.service,&staff.children,&staff.grade,&staff.step);
 !      sscanf(&line[24],"%d%d%d",   &staff.nation,&staff.hrweek,&staff.cost);
 !      allStaff->AddAt(&staff);
 !   }
 !   fclose(fp);
 !   // Delete unused space;
 !   allStaff->Purge();
 !
 !   allStaff->Print(0,10);
 !
 !//  Create ROOT file
 !   TFile *f = new TFile("aptuple.root","RECREATE");
 !          allStaff->Write();
 !   f->Write();
 !
 !   // We should close  TFile otherwise all histograms we create below
 !   // may be written to the file too occasionaly
 !   f->Close();
 !
 !//  Create ROOT Browser
 !   new TBrowser("staff",allStaff);
 !
 !//  Create couple of the histograms
 !   TCanvas *canva = new TCanvas("Staff","CERN Population",600,600);
 !   canva->Divide(1,2);
 !
 !
 !// one can use 2 meta variable:
 !//  n$ - the total number of the rows in the table
 !//  i$ - stands for the current row index i = [0 -> (n$-1)]
 !
 !   gStyle->SetHistFillColor(10);
 !   gStyle->SetHistFillStyle(3013);
 !   canva->cd(1);
 !   allStaff->Draw("age");
 !   canva->Update();
 !   canva->cd(2);
 !   allStaff->Draw("cost");
 !   canva->Update();
 !}


Function Members (Methods)

public:
TGenericTable()
TGenericTable(const TGenericTable&)
TGenericTable(const char* structName, const Text_t* name)
TGenericTable(const char* structName, Int_t n)
TGenericTable(const TTableDescriptor& dsc, const Text_t* name)
TGenericTable(const TTableDescriptor& dsc, Int_t n)
TGenericTable(const char* structName, const Text_t* name, Int_t n)
TGenericTable(const TTableDescriptor& dsc, const Text_t* name, Int_t n)
virtual~TGenericTable()
voidTObject::AbstractMethod(const char* method) const
virtual voidTDataSet::Add(TDataSet* dataset)
virtual Int_tTTable::AddAt(const void* c)
virtual voidTTable::AddAt(const void* c, Int_t i)
virtual voidTTable::AddAt(TDataSet* dataset, Int_t idx = 0)
virtual voidTDataSet::AddAtAndExpand(TDataSet* dataset, Int_t idx = 0)
virtual voidTDataSet::AddFirst(TDataSet* dataset)
virtual voidTDataSet::AddLast(TDataSet* dataset)
virtual voidTTable::Adopt(Int_t n, void* array)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual Long_tTTable::AppendRows(const void* row, UInt_t nRows)
virtual voidTTable::AsString(void* buf, TTable::EColumnType type, Int_t width, ostream& out) const
const void*TTable::At(Int_t i) const
TGenericTable::iteratorbegin()
TGenericTable::iteratorbegin() const
virtual voidTTable::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual TObject*TDataSet::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
Int_tTTable::CopyRows(const TTable* srcTable, Long_t srcRow = 0, Long_t dstRow = 0, Long_t nRows = 0, Bool_t expand = kFALSE)
virtual voidTTable::CopySet(TTable& array)
virtual voidTTable::DeleteRows(Long_t indx, UInt_t nRows = 1)
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTTable::Draw(Option_t* opt)
virtual TH1*TTable::Draw(TCut varexp, TCut selection, Option_t* option = "", Int_t nentries = 1000000000, Int_t firstentry = 0)
virtual TH1*TTable::Draw(const Text_t* varexp, const Text_t* selection, Option_t* option = "", Int_t nentries = 1000000000, Int_t firstentry = 0)
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
TGenericTable::iteratorend()
TGenericTable::iteratorend() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TDataSet*TDataSet::Find(const char* path) const
virtual TDataSet*TDataSet::FindByName(const char* name, const char* path = "", Option_t* opt = "") const
virtual TDataSet*TDataSet::FindByPath(const char* path) const
virtual TDataSet*TDataSet::FindByTitle(const char* title, const char* path = "", Option_t* opt = "") const
virtual TObject*TDataSet::FindObject(const char* name) const
virtual TObject*TDataSet::FindObject(const TObject* o) const
virtual TDataSet*TDataSet::First() const
virtual voidTTable::Fit(const Text_t* formula, const Text_t* varexp, const Text_t* selection = "", Option_t* option = "", Option_t* goption = "", Int_t nentries = 1000000000, Int_t firstentry = 0)
void*TTable::GetArray() const
virtual TSeqCollection*TDataSet::GetCollection() const
virtual const Char_t*TTable::GetColumnComment(Int_t columnIndex) const
virtual Int_tTTable::GetColumnIndex(const Char_t* columnName) const
virtual const Char_t*TTable::GetColumnName(Int_t columnIndex) const
virtual UInt_tTTable::GetColumnSize(Int_t columnIndex) const
virtual Int_tTTable::GetColumnSize(const Char_t* columnName = 0) const
virtual TTable::EColumnTypeTTable::GetColumnType(Int_t columnIndex) const
virtual TTable::EColumnTypeTTable::GetColumnType(const Char_t* columnName = 0) const
virtual UInt_tTTable::GetDimensions(Int_t columnIndex) const
virtual Int_tTTable::GetDimensions(const Char_t* columnName = 0) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const UInt_t*TTable::GetIndexArray(Int_t columnIndex) const
TList*TDataSet::GetList() const
virtual Int_tTDataSet::GetListSize() const
static TDataSet*TDataSet::GetMainSet()
TObject*TDataSet::GetMother() const
virtual const char*TNamed::GetName() const
virtual Long_tTTable::GetNRows() const
virtual UInt_tTTable::GetNumberOfColumns() const
TObjArray*TDataSet::GetObjArray() const
virtual TObject*TDataSet::GetObject() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual UInt_tTTable::GetOffset(Int_t columnIndex) const
virtual Int_tTTable::GetOffset(const Char_t* columnName = 0) const
virtual Option_t*TObject::GetOption() const
virtual TDataSet*TDataSet::GetParent() const
virtual TClass*TTable::GetRowClass() const
virtual TTableDescriptor*GetRowDescriptors() const
virtual Long_tTTable::GetRowSize() const
Int_tTTable::GetSize() const
char*GetTable(Int_t i = 0) const
virtual TTableDescriptor*GetTableDescriptors() const
virtual Long_tTTable::GetTableSize() const
virtual const char*TNamed::GetTitle() const
virtual const Char_t*TTable::GetType() const
static TTable::EColumnTypeTTable::GetTypeId(const char* typeName)
static const char*TTable::GetTypeName(TTable::EColumnType type)
virtual UInt_tTTable::GetTypeSize(Int_t columnIndex) const
virtual Int_tTTable::GetTypeSize(const Char_t* columnName = 0) const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual Long_tTTable::HasData() const
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual Long_tTTable::InsertRows(const void* rows, Long_t indx, UInt_t nRows = 1)
virtual voidTObject::Inspect() const
virtual TDataSet*TDataSet::Instance() const
static TDataSet*TDataSet::instance()
voidTDataSet::InvertAllMarks()
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTDataSet::IsEmpty() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTTable::IsFolder() const
virtual Bool_tTDataSet::IsMarked() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTDataSet::IsThisDir(const char* dirname, int len = -1, int ignorecase = 0) const
Bool_tTObject::IsZombie() const
virtual TDataSet*TDataSet::Last() const
virtual voidTDataSet::ls(Option_t* option = "") const
virtual voidTDataSet::ls(Int_t depth) const
virtual Char_t*TTable::MakeExpression(const Char_t** expressions, Int_t nExpressions)
voidTDataSet::Mark()
voidTDataSet::Mark(UInt_t flag, TDataSet::EBitOpt reset = kSet)
voidTDataSet::MarkAll()
voidTObject::MayNotUse(const char* method) const
Int_tTTable::NaN()
static TTable*TTable::New(const Char_t* name, const Char_t* type, void* array, UInt_t size)
virtual TDataSet*TDataSet::Next() const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TTable&TTable::operator=(const TTable& rhs)
char&operator[](Int_t i)
const char&operator[](Int_t i) const
virtual voidTObject::Paint(Option_t* option = "")
virtual TDataSet::EDataSetPassTDataSet::Pass(void callback, Int_t depth = 0)
virtual TDataSet::EDataSetPassTDataSet::Pass(void callback, void* user, Int_t depth = 0)
virtual TStringTDataSet::Path() const
virtual voidTObject::Pop()
virtual TDataSet*TDataSet::Prev() const
virtual voidTTable::Print(Option_t* opt = "") const
virtual Char_t*TTable::Print(Char_t* buf, Int_t n) const
virtual const Char_t*TTable::Print(Int_t row, Int_t rownumber = 10, const Char_t* colfirst = "", const Char_t* collast = "") const
virtual voidTTable::PrintContents(Option_t* opt = "") const
virtual const Char_t*TTable::PrintHeader() const
virtual voidTTable::Project(const Text_t* hname, const Text_t* varexp, const Text_t* selection = "", Option_t* option = "", Int_t nentries = 1000000000, Int_t firstentry = 0)
virtual Int_tTTable::Purge(Option_t* opt = "")
virtual Int_tTObject::Read(const char* name)
void*TTable::ReAllocate()
void*TTable::ReAllocate(Int_t newsize)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTDataSet::Remove(TDataSet* set)
virtual TDataSet*TDataSet::RemoveAt(Int_t idx)
virtual voidTTable::Reset(Int_t c = 0)
voidTObject::ResetBit(UInt_t f)
virtual voidTTable::ResetMap(Bool_t wipe = kTRUE)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTTable::SavePrimitive(ostream& out, Option_t* option = "")
virtual voidTTable::Set(Int_t n)
virtual voidTTable::Set(Int_t n, Char_t* array)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
virtual voidTDataSet::SetMother(TDataSet* parent = 0)
virtual voidTNamed::SetName(const char* name)
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
virtual voidTTable::SetNRows(Int_t n)
virtual voidTDataSet::SetObject(TObject* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTDataSet::SetParent(TDataSet* parent = 0)
virtual voidTNamed::SetTitle(const char* title = "")
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidTDataSet::SetWrite()
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidTDataSet::Shunt(TDataSet* newParent = 0)
virtual Int_tTNamed::Sizeof() const
virtual voidTDataSet::Sort()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
static const char*TTable::TableDictionary()
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
voidTDataSet::UnMark()
voidTDataSet::UnMarkAll()
virtual voidTTable::Update()
virtual voidTTable::Update(TDataSet* set, UInt_t opt = 0)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTDataSet::Write(const Text_t* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTDataSet::Write(const Text_t* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
voidTDataSet::AddMain(TDataSet* set)
Bool_tTTable::BoundsOk(const char* where, Int_t at) const
virtual voidTTable::Clear(Option_t* opt = "")
voidTTable::CopyStruct(Char_t* dest, const Char_t* src)
Char_t*TTable::Create()
virtual voidTTable::Delete(Option_t* opt = "")
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
virtual Bool_tTTable::EntryLoop(const Char_t* exprFileName, Int_t& action, TObject* obj, Int_t nentries = 1000000000, Int_t firstentry = 0, Option_t* option = "")
virtual TTableDescriptor*GetDescriptorPointer() const
TDataSet*TDataSet::GetRealParent()
voidTDataSet::MakeCollection()
voidTObject::MakeZombie()
Bool_tTTable::OutOfBoundsError(const char* where, Int_t i) const
voidTTable::ReAlloc(Int_t newsize)
virtual voidSetDescriptorPointer(TTableDescriptor* list)
Int_tTTable::SetfN(Long_t len)
voidSetGenericType()
virtual voidTDataSet::SetMother(TObject* mother)
voidTTable::SetTablePointer(void* table)
virtual voidTTable::SetType(const Text_t *const type)
voidTTable::SetUsedRows(Int_t n)
static TDataSet::EDataSetPassTDataSet::SortIt(TDataSet* ds)
static TDataSet::EDataSetPassTDataSet::SortIt(TDataSet* ds, void* user)
voidTTable::StreamerHeader(TBuffer& b, Version_t version = 3)
voidTTable::StreamerTable(TBuffer& b, Version_t version = 3)
static const char*TTable::TableDictionary(const char* className, const char* structName, TTableDescriptor*& ColDescriptors)

Data Members

public:
enum TTable::EColumnType { kNAN
kFloat
kInt
kLong
kShort
kDouble
kUInt
kULong
kUShort
kUChar
kChar
kPtr
kBool
kEndColumnType
};
enum TTable::ETableBits { kIsNotOwn
};
enum TDataSet::EDataSetPass { kContinue
kPrune
kStop
kUp
kStruct
kAll
kRefs
kMarked
};
enum TDataSet::ESetBits { kMark
kArray
};
enum TDataSet::EBitOpt { kSet
kReset
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
public:
static const char*TTable::fgTypeName[13]
protected:
TTableDescriptor*fColDescriptors
TSeqCollection*TDataSet::fListList of the the the objects included into this dataset
Long_tTTable::fMaxIndexThe used capacity of this array
Int_tTTable::fNNumber of array elements
TStringTNamed::fNameobject identifier
TDataSet*TDataSet::fParentpointer to mother of the directory
Long_tTTable::fSizeSize of the one element (row) of the table
Char_t*TTable::fTableArray of (fN*fSize) longs
TStringTNamed::fTitleobject title
static TDataSet*TDataSet::fgMainSetpointer the main dataset;

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGenericTable(const TTableDescriptor &dsc, const Text_t *name)

   Create TGenericTable by TTableDescriptor pointer:

   dsc   - Pointer to the table descriptor
   name  - The name of this object


TGenericTable(const TTableDescriptor &dsc, Int_t n)

   Create TGenericTable by TTableDescriptor pointer:

   dsc   - Pointer to the table descriptor
   name  - "TGenericTable"
   n     - The initial number of allocated rows


TGenericTable(const TTableDescriptor &dsc,const Text_t *name,Int_t n)

   Create TGenericTable by TTableDescriptor pointer:

   dsc   - Pointer to the table descriptor
   name  - The name of this object
   n     - The initial number of allocated rows


TGenericTable(const char *structName, const Text_t *name)

  Create TGenericTable by C structure name provided:

   dsc   - Pointer to the table descriptor
   name  - The name of this object
   n     - The initial number of allocated rows


TGenericTable(const char *structName, Int_t n)

  Create TGenericTable by C structure name provided:

   dsc   - Pointer to the table descriptor
   name  - The name of this object
   n     - The initial number of allocated rows


TGenericTable(const char *structName, const Text_t *name,Int_t n)

   Create TGenericTable by C structure name provided:

   dsc   - Pointer to the table descriptor
   name  - The name of this object
   n     - The initial number of allocated rows


~TGenericTable()
destructor
TTableDescriptor * GetDescriptorPointer()
{ return fColDescriptors;}
void SetDescriptorPointer(TTableDescriptor* list)
{ fColDescriptors = list;}
void SetGenericType()
{ TTable::SetType(GetDescriptorPointer()->GetName()); }
TGenericTable(const TGenericTable& )
{SetType("generic");}
TGenericTable(const char *structName, const Text_t *name)
 Create TGenericTable by C structure name provided
char * GetTable(Int_t i = 0) const
{ return ((char *)GetArray())+i*GetRowSize();}
TTableDescriptor * GetTableDescriptors()
{ return GetDescriptorPointer();}
TTableDescriptor * GetRowDescriptors()
{ return GetDescriptorPointer();}
char & operator[](Int_t i)
{ assert(i>=0 && i < GetNRows()); return *GetTable(i); }
const char & operator[](Int_t i)
{ assert(i>=0 && i < GetNRows()); return *((const char *)(GetTable(i))); }
iterator begin()
{ return ((const TGenericTable *)this)->begin();}
iterator begin()
{ return GetNRows() ? iterator(*this, *GetTable(0)):end();}
iterator end()
{ return ((const TGenericTable *)this)->end(); }
iterator end()
{Long_t i = GetNRows(); return i? iterator(*this, *GetTable(i)):iterator(*this);}

Author: Valery Fine(fine@bnl.gov) 30/06/2001
Last update: root/table:$Id: TGenericTable.h 20882 2007-11-19 11:31:26Z rdm $

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.