Logo ROOT   6.10/09
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 
28 class TProtoClass;
29 
30 namespace ROOT {
31  class TClassAlt;
32  class TClassRec;
33  class TMapTypeToClassRec;
34 }
35 
36 class TClassTable : public TObject {
37 
38 friend void ROOT::ResetClassVersion(TClass*, const char*, Short_t);
39 friend class TROOT;
40 
41 private:
42  typedef ROOT::TMapTypeToClassRec IdMap_t;
43 
44  static ROOT::TClassAlt **fgAlternate;
45  static ROOT::TClassRec **fgTable;
46  static ROOT::TClassRec **fgSortedTable;
47  static IdMap_t *fgIdMap;
48  static UInt_t fgSize;
49  static UInt_t fgTally;
50  static Bool_t fgSorted;
51  static UInt_t fgCursor;
52 
53  TClassTable();
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 
59 public:
60  // bits that can be set in pragmabits
61  enum {
62  kNoStreamer = 0x01, kNoInputOperator = 0x02, kAutoStreamer = 0x04,
63  kHasVersion = 0x08, kHasCustomStreamerMember = 0x10
64  };
65 
66  ~TClassTable();
67 
68  static void Add(const char *cname, Version_t id,
69  const std::type_info &info, DictFuncPtr_t dict,
70  Int_t pragmabits);
71  static void Add(TProtoClass *protoClass);
72  static void AddAlternate(const char *normname, const char *alternate);
73  static char *At(UInt_t index);
74  int Classes();
75  static Bool_t Check(const char *cname, std::string &normname);
76  static Version_t GetID(const char *cname);
77  static Int_t GetPragmaBits(const char *name);
78  static DictFuncPtr_t GetDict(const char *cname);
79  static DictFuncPtr_t GetDict(const std::type_info& info);
80  static DictFuncPtr_t GetDictNorm(const char *cname);
81  static TProtoClass *GetProto(const char *cname);
82  static TProtoClass *GetProtoNorm(const char *cname);
83  static void Init();
84  static char *Next();
85  void Print(Option_t *option="") const;
86  static void PrintTable();
87  static void Remove(const char *cname);
88  static void Terminate();
89 
90  ClassDef(TClassTable,0) //Table of known classes
91 };
92 
94 
95 namespace ROOT {
96  extern void AddClass(const char *cname, Version_t id, DictFuncPtr_t dict,
97  Int_t pragmabits);
98  extern void RemoveClass(const char *cname);
99 }
100 
101 #endif
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).
static ROOT::TClassRec ** fgSortedTable
Definition: TClassTable.h:46
ROOT top level object description.
Definition: TROOT.h:100
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
short Version_t
Definition: RtypesCore.h:61
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:93
const char Option_t
Definition: RtypesCore.h:62
Persistent version of a TClass.
Definition: TProtoClass.h:35
ROOT::TMapTypeToClassRec IdMap_t
Definition: TClassTable.h:42
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
This class registers for all classes their name, id and dictionary function in a hash table...
Definition: TClassTable.h:36
#define ClassDef(name, id)
Definition: Rtypes.h:297
static ROOT::TClassRec ** fgTable
Definition: TClassTable.h:45
TClass *(* DictFuncPtr_t)()
Definition: Rtypes.h:70
void ResetClassVersion(TClass *, const char *, Short_t)
Global function to update the version number.
void RemoveClass(const char *cname)
Global function called by the dtor of a class's init class (see the ClassImp macro).
static UInt_t fgTally
Definition: TClassTable.h:49
unsigned int UInt_t
Definition: RtypesCore.h:42
short Short_t
Definition: RtypesCore.h:35
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
static UInt_t fgSize
Definition: TClassTable.h:48
const Bool_t kFALSE
Definition: RtypesCore.h:92
static IdMap_t * fgIdMap
Definition: TClassTable.h:47
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO... > &to, const THist< DIMENSIONS, PRECISION_FROM, STAT_FROM... > &from)
Add two histograms.
Definition: THist.hxx:336
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
void Print(std::ostream &os, const OptionType &opt)
static UInt_t fgCursor
Definition: TClassTable.h:51
Mother of all ROOT objects.
Definition: TObject.h:37
#define R__EXTERN
Definition: DllImport.h:27
static Bool_t fgSorted
Definition: TClassTable.h:50
static ROOT::TClassAlt ** fgAlternate
Definition: TClassTable.h:44