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#include "TString.h"
27
28class TProtoClass;
29
30namespace ROOT {
31 class TClassAlt;
32 class TClassRec;
33 class TMapTypeToClassRec;
34}
35
36class TClassTable : public TObject {
37
38friend void ROOT::ResetClassVersion(TClass*, const char*, Short_t);
39friend class TROOT;
40
41private:
42 typedef ROOT::TMapTypeToClassRec IdMap_t;
43
44 static ROOT::TClassAlt **fgAlternate;
45 static ROOT::TClassRec **fgTable;
46 static ROOT::TClassRec **fgSortedTable;
48 static UInt_t fgSize;
52
54
55 static ROOT::TClassRec *FindElementImpl(const char *cname, Bool_t insert);
56 static ROOT::TClassRec *FindElement(const char *cname, Bool_t insert=kFALSE);
57 static void SortTable();
58
60
61public:
62 // bits that can be set in pragmabits
63 enum {
66 };
67
69
70 static void Add(const char *cname, Version_t id,
71 const std::type_info &info, DictFuncPtr_t dict,
72 Int_t pragmabits);
73 static void Add(TProtoClass *protoClass);
74 static void AddAlternate(const char *normname, const char *alternate);
75 static char *At(UInt_t index);
76 int Classes();
77 static Bool_t Check(const char *cname, std::string &normname);
78 static Version_t GetID(const char *cname);
79 static Int_t GetPragmaBits(const char *name);
80 static DictFuncPtr_t GetDict(const char *cname);
81 static DictFuncPtr_t GetDict(const std::type_info& info);
82 static DictFuncPtr_t GetDictNorm(const char *cname);
83 static TProtoClass *GetProto(const char *cname);
84 static TProtoClass *GetProtoNorm(const char *cname);
85 static void Init();
86 static char *Next();
87 void Print(Option_t *option="") const;
88 static void PrintTable();
89 static void Remove(const char *cname);
90 static void Terminate();
91
92 ClassDef(TClassTable,0) //Table of known classes
93};
94
96
97namespace ROOT {
98 extern void AddClass(const char *cname, Version_t id, DictFuncPtr_t dict,
99 Int_t pragmabits);
100 extern void RemoveClass(const char *cname);
101}
102
103#endif
#define R__EXTERN
Definition: DllImport.h:27
int Int_t
Definition: RtypesCore.h:41
short Version_t
Definition: RtypesCore.h:61
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
short Short_t
Definition: RtypesCore.h:35
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
TClass *(* DictFuncPtr_t)()
Definition: Rtypes.h:78
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:95
char name[80]
Definition: TGX11.cxx:109
This class registers for all classes their name, id and dictionary function in a hash table.
Definition: TClassTable.h:36
static void PrintTable()
Print the class table.
static Int_t GetPragmaBits(const char *name)
Returns the pragma bits as specified in the LinkDef.h file.
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
static Version_t GetID(const char *cname)
Returns the ID of a class.
@ kHasCustomStreamerMember
Definition: TClassTable.h:65
@ kNoInputOperator
Definition: TClassTable.h:64
ROOT::TMapTypeToClassRec IdMap_t
Definition: TClassTable.h:42
static void SortTable()
Sort the class table by ascending class ID's.
static TProtoClass * GetProtoNorm(const char *cname)
Given the class normalized name returns the TClassProto object for the class.
static DictFuncPtr_t GetDictNorm(const char *cname)
Given the normalized class name returns the Dictionary() function of a class (uses hash of name).
static void AddAlternate(const char *normname, const char *alternate)
static ROOT::TClassAlt ** fgAlternate
Definition: TClassTable.h:44
static ROOT::TClassRec * FindElementImpl(const char *cname, Bool_t insert)
Find a class by name in the class table (using hash of name).
static void Terminate()
Deletes the class table (this static class function calls the dtor).
void Print(Option_t *option="") const
Print the class table.
static TProtoClass * GetProto(const char *cname)
Given the class name returns the TClassProto object for the class.
TClassTable()
TClassTable is a singleton (i.e. only one can exist per application).
static char * Next()
Returns next class from sorted class table.
static char * At(UInt_t index)
Returns class at index from sorted class table.
static Bool_t Check(const char *cname, std::string &normname)
static void Init()
static void Remove(const char *cname)
Remove a class from the class table.
static ROOT::TClassRec ** fgSortedTable
Definition: TClassTable.h:46
static ROOT::TClassRec ** fgTable
Definition: TClassTable.h:45
static IdMap_t * fgIdMap
Definition: TClassTable.h:47
static Bool_t CheckClassTableInit()
Return true fs the table exist.
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).
~TClassTable()
TClassTable singleton is deleted in Terminate().
static Bool_t fgSorted
Definition: TClassTable.h:50
static UInt_t fgTally
Definition: TClassTable.h:49
static UInt_t fgSize
Definition: TClassTable.h:48
static ROOT::TClassRec * FindElement(const char *cname, Bool_t insert=kFALSE)
Find a class by name in the class table (using hash of name).
static UInt_t fgCursor
Definition: TClassTable.h:51
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
Mother of all ROOT objects.
Definition: TObject.h:37
Persistent version of a TClass.
Definition: TProtoClass.h:35
ROOT top level object description.
Definition: TROOT.h:102
VSD Structures.
Definition: StringConv.hxx:21
void RemoveClass(const char *cname)
Global function called by the dtor of a class's init class (see the ClassImp macro).
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).
void ResetClassVersion(TClass *, const char *, Short_t)
Global function to update the version number.