Logo ROOT   6.16/01
Reference Guide
TTableDescriptor.h
Go to the documentation of this file.
1// @(#)root/table:$Id$
2// Author: Valery Fine 09/08/99 (E-mail: fine@bnl.gov)
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TTableDescriptor
13#define ROOT_TTableDescriptor
14
15#include "TTable.h"
16#include "tableDescriptor.h"
17
18class TClass;
19//______________________________________________________________________________
20//
21// TTableDescriptor - run-time descriptor of the TTable object rows.
22//______________________________________________________________________________
23
24
25class TTableDescriptor : public TTable {
26private:
27 TTableDescriptor &operator=(const TTableDescriptor &dsc); // Intentionally not implemented.
28protected:
29 friend class TTable;
30 TClass *fRowClass; // TClass defining
31 // the table row C-structure
32 TTableDescriptor *fSecondDescriptor; // shadow descriptor
33 // to back TTable::Streamer
34 static TString fgCommentsName; // The name of dataset to keep the comments fields
35 virtual void Init(TClass *classPtr);
36 static void SetCommentsSetName(const char *name=".comments");
37
38public:
39
40 TTableDescriptor(const TTable *parentTable);
41 TTableDescriptor(TClass *classPtr);
43 virtual ~TTableDescriptor();
44 virtual Int_t AddAt(const void *c);
45 virtual void AddAt(const void *c, Int_t i);
46 virtual void AddAt(const tableDescriptor_st &element, const char *comment,Int_t indx);
47 virtual void AddAt(TDataSet *dataset,Int_t idx=0);
48 TString CreateLeafList() const;
49 void LearnTable(const TTable *parentTable);
50 void LearnTable(TClass *classPtr);
51 const Char_t *ColumnName(Int_t columnIndex) const;
52 Int_t ColumnByName(const Char_t *columnName=0) const;
53 UInt_t NumberOfColumns() const;
54 const UInt_t *IndexArray(Int_t columnIndex) const;
55 UInt_t Offset(Int_t columnIndex) const;
56 Int_t Offset(const Char_t *columnName=0) const;
57 UInt_t ColumnSize(Int_t columnIndex) const;
58 Int_t ColumnSize(const Char_t *columnName=0) const;
59 UInt_t TypeSize(Int_t columnIndex) const;
60 Int_t TypeSize(const Char_t *columnName=0) const;
61 UInt_t Dimensions(Int_t columnIndex) const;
62 Int_t Dimensions(const Char_t *columnName=0) const;
63 TTable::EColumnType ColumnType(Int_t columnIndex) const;
64 TTable::EColumnType ColumnType(const Char_t *columnName=0) const;
65 TClass *RowClass() const;
66 void SetOffset(UInt_t offset,Int_t column);
67 void SetSize(UInt_t size,Int_t column);
68 void SetTypeSize(UInt_t size,Int_t column);
69 void SetDimensions(UInt_t dim,Int_t column);
70 Int_t Sizeof() const;
72 virtual Int_t UpdateOffsets(const TTableDescriptor *newDesciptor);
73
74 static TTableDescriptor *MakeDescriptor(const char *structName);
76
77// ClassDefTable(TTableDescriptor,tableDescriptor_st)
78protected:
81 virtual void SetDescriptorPointer(TTableDescriptor *list);
82public:
84 TTableDescriptor() : TTable("TTableDescriptor",sizeof(tableDescriptor_st)), fRowClass(0), fSecondDescriptor(0) {SetType("tableDescriptor_st");}
85 TTableDescriptor(const char *name) : TTable(name,sizeof(tableDescriptor_st)), fRowClass(0), fSecondDescriptor(0) {SetType("tableDescriptor_st");}
86 TTableDescriptor(Int_t n) : TTable("TTableDescriptor",n,sizeof(tableDescriptor_st)), fRowClass(0), fSecondDescriptor(0) {SetType("tableDescriptor_st");}
87 TTableDescriptor(const char *name,Int_t n) : TTable(name,n,sizeof(tableDescriptor_st)), fRowClass(0), fSecondDescriptor(0) {SetType("tableDescriptor_st");}
89 tableDescriptor_st &operator[](Int_t i){ assert(i>=0 && i < GetNRows()); return *GetTable(i); }
90 const tableDescriptor_st &operator[](Int_t i) const { assert(i>=0 && i < GetNRows()); return *((const tableDescriptor_st *)(GetTable(i))); }
91 tableDescriptor_st *begin() const { return GetNRows()? GetTable(0):0;}
92 tableDescriptor_st *end() const {Long_t i = GetNRows(); return i? GetTable(i):0;}
93 static const char *TableDictionary();
94 ClassDef(TTableDescriptor,0) // descrpitor defining the internal layout of TTable objects
95};
96
97//______________________________________________________________________________
98// inline TTableDescriptor(const TTableDescriptor &dsc) : TTable(dsc), fRowClass(dsc.fRowClass),fSecondDescriptor(0){}
99inline const Char_t *TTableDescriptor::ColumnName(Int_t column)const {return ((tableDescriptor_st *)At(column))->fColumnName;}
100inline UInt_t TTableDescriptor::Offset(Int_t column) const {return ((tableDescriptor_st *)At(column))->fOffset; }
101inline const UInt_t *TTableDescriptor::IndexArray(Int_t column)const {return ((tableDescriptor_st *)At(column))->fIndexArray;}
103inline UInt_t TTableDescriptor::ColumnSize(Int_t column) const {return ((tableDescriptor_st *)At(column))->fSize; }
104inline UInt_t TTableDescriptor::TypeSize(Int_t column) const {return ((tableDescriptor_st *)At(column))->fTypeSize; }
105inline UInt_t TTableDescriptor::Dimensions(Int_t column) const {return ((tableDescriptor_st *)At(column))->fDimensions;}
108inline void TTableDescriptor::SetOffset(UInt_t offset,Int_t column) {((tableDescriptor_st *)At(column))->fOffset = offset;}
109inline void TTableDescriptor::SetSize(UInt_t size,Int_t column) {((tableDescriptor_st *)At(column))->fSize = size; }
110inline void TTableDescriptor::SetTypeSize(UInt_t size,Int_t column) {((tableDescriptor_st *)At(column))->fTypeSize = size; }
111inline void TTableDescriptor::SetDimensions(UInt_t dim,Int_t column) {((tableDescriptor_st *)At(column))->fDimensions = dim; }
113
114#endif
PyObject * fType
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:41
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:324
int type
Definition: TGX11.cxx:120
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
Basic string class.
Definition: TString.h:131
TTableDescriptor(const TTableDescriptor &dsc)
const Char_t * ColumnName(Int_t columnIndex) const
void SetSize(UInt_t size, Int_t column)
TTableDescriptor(const char *name, Int_t n)
UInt_t Offset(Int_t columnIndex) const
void SetColumnType(TTable::EColumnType type, Int_t column)
tableDescriptor_st & operator[](Int_t i)
UInt_t NumberOfColumns() const
void SetDimensions(UInt_t dim, Int_t column)
TString CreateLeafList() const
Create a list of leaf to be useful for TBranch::TBranch ctor.
virtual void Init(TClass *classPtr)
Create a descriptor of the C-structure defined by TClass TClass *classPtr must be a valid pointer to ...
Int_t ColumnByName(const Char_t *columnName=0) const
Find the column index but the column name.
UInt_t TypeSize(Int_t columnIndex) const
virtual TTableDescriptor * GetDescriptorPointer() const
return column descriptor
UInt_t ColumnSize(Int_t columnIndex) const
const UInt_t * IndexArray(Int_t columnIndex) const
TTableDescriptor(const char *name)
virtual void SetDescriptorPointer(TTableDescriptor *list)
set table descriptor
Int_t Sizeof() const
to be documented
static void SetCommentsSetName(const char *name=".comments")
set comments name
TTableDescriptor * fSecondDescriptor
TDataSet * MakeCommentField(Bool_t createFlag=kTRUE)
Instantiate a comment dataset if any.
TTable::EColumnType ColumnType(Int_t columnIndex) const
TTableDescriptor(Int_t n)
UInt_t Dimensions(Int_t columnIndex) const
void SetOffset(UInt_t offset, Int_t column)
TClass * RowClass() const
static TTableDescriptor * fgColDescriptors
tableDescriptor_st * begin() const
const tableDescriptor_st & operator[](Int_t i) const
tableDescriptor_st * GetTable(Int_t i=0) const
void LearnTable(const TTable *parentTable)
to be documented
tableDescriptor_st * iterator
virtual ~TTableDescriptor()
class destructor
void SetTypeSize(UInt_t size, Int_t column)
virtual Int_t UpdateOffsets(const TTableDescriptor *newDesciptor)
virtual Int_t AddAt(const void *c)
Append one row pointed by "c" to the descriptor.
static const char * TableDictionary()
TTableDescriptor & operator=(const TTableDescriptor &dsc)
static TTableDescriptor * MakeDescriptor(const char *structName)
MakeDescriptor(const char *structName) - static method structName - the name of the C structure to cr...
static TString fgCommentsName
tableDescriptor_st * end() const
Definition: TTable.h:48
void * GetArray() const
Definition: TTable.h:280
Long_t fSize
Definition: TTable.h:52
EColumnType
Definition: TTable.h:82
const void * At(Int_t i) const
Returns a pointer to the i-th row of the table.
Definition: TTable.cxx:302
virtual void SetType(const char *const type)
to be documented
Definition: TTable.cxx:1972
virtual Long_t GetNRows() const
Returns the number of the used rows for the wrapped table.
Definition: TTable.cxx:1387
const Int_t n
Definition: legend1.C:16