Logo ROOT  
Reference Guide
TClassTable.h
Go to the documentation of this file.
1 // @(#)root/cont:$Id$
2 // Author: Fons Rademakers 11/08/95
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_TClassTable
13 #define ROOT_TClassTable
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TClassTable //
19 // //
20 // This class registers for all classes their name, id and dictionary //
21 // function in a hash table. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TObject.h"
26 
27 class TProtoClass;
28 
29 namespace ROOT {
30  class TClassAlt;
31  class TClassRec;
32  class TMapTypeToClassRec;
33 }
34 
35 class TClassTable : public TObject {
36 
37 friend void ROOT::ResetClassVersion(TClass*, const char*, Short_t);
38 friend class TROOT;
39 
40 private:
41  typedef ROOT::TMapTypeToClassRec IdMap_t;
42 
43  static ROOT::TClassAlt **fgAlternate;
44  static ROOT::TClassRec **fgTable;
45  static ROOT::TClassRec **fgSortedTable;
46  static IdMap_t *fgIdMap;
47  static UInt_t fgSize;
48  static UInt_t fgTally;
49  static Bool_t fgSorted;
50  static UInt_t fgCursor;
51 
52  TClassTable();
53 
54  static ROOT::TClassRec *FindElementImpl(const char *cname, Bool_t insert);
55  static ROOT::TClassRec *FindElement(const char *cname, Bool_t insert=kFALSE);
56  static void SortTable();
57 
58  static Bool_t CheckClassTableInit();
59 
60 public:
61  // bits that can be set in pragmabits
62  enum {
63  kNoStreamer = 0x01, kNoInputOperator = 0x02, kAutoStreamer = 0x04,
65  };
66 
67  ~TClassTable();
68 
69  static void Add(const char *cname, Version_t id,
70  const std::type_info &info, DictFuncPtr_t dict,
71  Int_t pragmabits);
72  static void Add(TProtoClass *protoClass);
73  static void AddAlternate(const char *normname, const char *alternate);
74  static char *At(UInt_t index);
75  int Classes();
76  static Bool_t Check(const char *cname, std::string &normname);
77  static Version_t GetID(const char *cname);
78  static Int_t GetPragmaBits(const char *name);
79  static DictFuncPtr_t GetDict(const char *cname);
80  static DictFuncPtr_t GetDict(const std::type_info& info);
81  static DictFuncPtr_t GetDictNorm(const char *cname);
82  static TProtoClass *GetProto(const char *cname);
83  static TProtoClass *GetProtoNorm(const char *cname);
84  static void Init();
85  static char *Next();
86  void Print(Option_t *option="") const;
87  static void PrintTable();
88  static void Remove(const char *cname);
89  static void Terminate();
90 
91  ClassDef(TClassTable,0) //Table of known classes
92 };
93 
95 
96 namespace ROOT {
97  extern void AddClass(const char *cname, Version_t id, DictFuncPtr_t dict,
98  Int_t pragmabits);
99  extern void RemoveClass(const char *cname);
100 }
101 
102 #endif
gClassTable
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:94
TClassTable::fgAlternate
static ROOT::TClassAlt ** fgAlternate
Definition: TClassTable.h:43
Version_t
short Version_t
Definition: RtypesCore.h:63
Option_t
const char Option_t
Definition: RtypesCore.h:64
ROOT::AddClass
void AddClass(const char *cname, Version_t id, const std::type_info &info, DictFuncPtr_t dict, Int_t pragmabits)
Global function called by the ctor of a class's init class (see the ClassImp macro).
Definition: TClassTable.cxx:763
TClassTable::IdMap_t
ROOT::TMapTypeToClassRec IdMap_t
Definition: TClassTable.h:41
TClassTable::Init
static void Init()
Definition: TClassTable.cxx:334
TClassTable::GetID
static Version_t GetID(const char *cname)
Returns the ID of a class.
Definition: TClassTable.cxx:553
TClassTable::kAutoStreamer
@ kAutoStreamer
Definition: TClassTable.h:63
TClassTable::CheckClassTableInit
static Bool_t CheckClassTableInit()
Return true fs the table exist.
Definition: TClassTable.cxx:263
Int_t
int Int_t
Definition: RtypesCore.h:43
TClassTable::Check
static Bool_t Check(const char *cname, std::string &normname)
Definition: TClassTable.cxx:461
TClassTable::kNoInputOperator
@ kNoInputOperator
Definition: TClassTable.h:63
Bool_t
bool Bool_t
Definition: RtypesCore.h:61
TClassTable::TClassTable
TClassTable()
TClassTable is a singleton (i.e. only one can exist per application).
Definition: TClassTable.cxx:219
TClassTable::Add
static void Add(const char *cname, Version_t id, const std::type_info &info, DictFuncPtr_t dict, Int_t pragmabits)
Add a class to the class table (this is a static function).
Definition: TClassTable.cxx:342
bool
TROOT
ROOT top level object description.
Definition: TROOT.h:93
TClassTable::fgTable
static ROOT::TClassRec ** fgTable
Definition: TClassTable.h:44
TClassTable::AddAlternate
static void AddAlternate(const char *normname, const char *alternate)
Definition: TClassTable.cxx:438
ROOT::RemoveClass
void RemoveClass(const char *cname)
Global function called by the dtor of a class's init class (see the ClassImp macro).
Definition: TClassTable.cxx:840
TProtoClass
Persistent version of a TClass.
Definition: TProtoClass.h:35
TClassTable::kNoStreamer
@ kNoStreamer
Definition: TClassTable.h:63
TClassTable::Print
void Print(Option_t *option="") const
Print the class table.
Definition: TClassTable.cxx:280
TClassTable::fgSize
static UInt_t fgSize
Definition: TClassTable.h:47
TClassTable::Terminate
static void Terminate()
Deletes the class table (this static class function calls the dtor).
Definition: TClassTable.cxx:745
TClassTable::fgIdMap
static IdMap_t * fgIdMap
Definition: TClassTable.h:46
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:90
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:44
Short_t
short Short_t
Definition: RtypesCore.h:37
TClassTable::Next
static char * Next()
Returns next class from sorted class table.
Definition: TClassTable.cxx:681
TClassTable::PrintTable
static void PrintTable()
Print the class table.
Definition: TClassTable.cxx:694
TClassTable::GetDict
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
Definition: TClassTable.cxx:574
unsigned int
TClassTable::fgTally
static UInt_t fgTally
Definition: TClassTable.h:48
TClassTable::Remove
static void Remove(const char *cname)
Remove a class from the class table.
Definition: TClassTable.cxx:486
TClassTable
This class registers for all classes their name, id and dictionary function in a hash table.
Definition: TClassTable.h:35
TClassTable::FindElement
static ROOT::TClassRec * FindElement(const char *cname, Bool_t insert=kFALSE)
Find a class by name in the class table (using hash of name).
Definition: TClassTable.cxx:538
TObject.h
TClassTable::GetPragmaBits
static Int_t GetPragmaBits(const char *name)
Returns the pragma bits as specified in the LinkDef.h file.
Definition: TClassTable.cxx:563
TClassTable::~TClassTable
~TClassTable()
TClassTable singleton is deleted in Terminate().
Definition: TClassTable.cxx:245
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TClassTable::Classes
int Classes()
Definition: TClassTable.cxx:332
TClassTable::At
static char * At(UInt_t index)
Returns class at index from sorted class table.
Definition: TClassTable.cxx:321
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TClassTable::fgCursor
static UInt_t fgCursor
Definition: TClassTable.h:50
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:322
TClassTable::kHasCustomStreamerMember
@ kHasCustomStreamerMember
Definition: TClassTable.h:64
name
char name[80]
Definition: TGX11.cxx:109
ROOT::ResetClassVersion
void ResetClassVersion(TClass *, const char *, Short_t)
Global function to update the version number.
Definition: TClassTable.cxx:808
TClassTable::fgSorted
static Bool_t fgSorted
Definition: TClassTable.h:49
R__EXTERN
#define R__EXTERN
Definition: DllImport.h:27
DictFuncPtr_t
TClass *(* DictFuncPtr_t)()
Definition: Rtypes.h:78
TClassTable::GetDictNorm
static DictFuncPtr_t GetDictNorm(const char *cname)
Given the normalized class name returns the Dictionary() function of a class (uses hash of name).
Definition: TClassTable.cxx:608
TClassTable::FindElementImpl
static ROOT::TClassRec * FindElementImpl(const char *cname, Bool_t insert)
Find a class by name in the class table (using hash of name).
Definition: TClassTable.cxx:516
TClassTable::kHasVersion
@ kHasVersion
Definition: TClassTable.h:64
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21
TClassTable::fgSortedTable
static ROOT::TClassRec ** fgSortedTable
Definition: TClassTable.h:45
TClassTable::GetProtoNorm
static TProtoClass * GetProtoNorm(const char *cname)
Given the class normalized name returns the TClassProto object for the class.
Definition: TClassTable.cxx:648
TClassTable::SortTable
static void SortTable()
Sort the class table by ascending class ID's.
Definition: TClassTable.cxx:726
TClassTable::GetProto
static TProtoClass * GetProto(const char *cname)
Given the class name returns the TClassProto object for the class.
Definition: TClassTable.cxx:626