Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <string>
27#include <atomic>
28
29class TProtoClass;
30
31namespace ROOT {
32 class TClassAlt;
33 class TClassRec;
34 class TMapTypeToClassRec;
35}
36
37class TClassTable : public TObject {
38
39friend void ROOT::ResetClassVersion(TClass*, const char*, Short_t);
40friend class TROOT;
41
42private:
45
50 static UInt_t fgSize;
51 static std::atomic<UInt_t> fgTally;
54
56
57 static ROOT::TClassRec *FindElement(const char *cname, Bool_t insert);
58 static void SortTable();
59
61
62public:
63 // bits that can be set in pragmabits
64 // clang-format off
65 enum {
73 };
74 // clang-format on
75
77
78 static void Add(const char *cname, Version_t id,
79 const std::type_info &info, DictFuncPtr_t dict,
80 Int_t pragmabits);
81 static void Add(TProtoClass *protoClass);
82 static ROOT::TClassAlt *AddAlternate(const char *normname, const char *alternate);
83 static char *At(UInt_t index);
84 int Classes();
85 static Bool_t Check(const char *cname, std::string &normname);
86 static Version_t GetID(const char *cname);
87 static Int_t GetPragmaBits(const char *name);
88 static DictFuncPtr_t GetDict(const char *cname);
89 static DictFuncPtr_t GetDict(const std::type_info& info);
90 static DictFuncPtr_t GetDictNorm(const char *cname);
91 static TProtoClass *GetProto(const char *cname);
92 static TProtoClass *GetProtoNorm(const char *cname);
93 static void Init();
94 static char *Next();
95 void Print(Option_t *option="") const override;
96 static void PrintTable();
97 static void Remove(const char *cname);
98 static void RemoveAlternate(ROOT::TClassAlt *alt);
99 static void Terminate();
100
101 ClassDefOverride(TClassTable,0) //Table of known classes
102};
103
105
106namespace ROOT {
107 extern void AddClass(const char *cname, Version_t id, DictFuncPtr_t dict,
108 Int_t pragmabits);
109 extern void RemoveClass(const char *cname, TClass *cl);
110}
111
112#endif
#define R__EXTERN
Definition DllImport.h:26
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
short Version_t
Definition RtypesCore.h:65
unsigned int UInt_t
Definition RtypesCore.h:46
short Short_t
Definition RtypesCore.h:39
const char Option_t
Definition RtypesCore.h:66
TClass *(* DictFuncPtr_t)()
Definition Rtypes.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
R__EXTERN TClassTable * gClassTable
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
char name[80]
Definition TGX11.cxx:110
This class registers for all classes their name, id and dictionary function in a hash table.
Definition TClassTable.h:37
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.
ROOT::TMapTypeToClassRec IdMap_t
Definition TClassTable.h:43
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 ROOT::TClassAlt ** fgAlternate
Definition TClassTable.h:46
void Print(Option_t *option="") const override
Print the class table.
static void Terminate()
Deletes the class table (this static class function calls the dtor).
static TProtoClass * GetProto(const char *cname)
Given the class name returns the TClassProto object for the class.
static std::atomic< UInt_t > fgTally
Definition TClassTable.h:51
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()
@ kHasCustomStreamerMember
Definition TClassTable.h:70
static void Remove(const char *cname)
Remove a class from the class table.
static ROOT::TClassRec ** fgSortedTable
Definition TClassTable.h:48
static ROOT::TClassRec ** fgTable
Definition TClassTable.h:47
static IdMap_t * fgIdMap
Definition TClassTable.h:49
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 void RemoveAlternate(ROOT::TClassAlt *alt)
static ROOT::TClassRec * FindElement(const char *cname, Bool_t insert)
Find a class by name in the class table (using hash of name).
static Bool_t fgSorted
Definition TClassTable.h:52
static UInt_t fgSize
Definition TClassTable.h:50
static ROOT::TClassAlt * AddAlternate(const char *normname, const char *alternate)
static UInt_t fgCursor
Definition TClassTable.h:53
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Mother of all ROOT objects.
Definition TObject.h:41
Persistent version of a TClass.
Definition TProtoClass.h:38
ROOT top level object description.
Definition TROOT.h:94
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
void RemoveClass(const char *cname, TClass *cl)
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.