Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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  static Bool_t CheckClassTableInit();
60 
61 public:
62  // bits that can be set in pragmabits
63  enum {
64  kNoStreamer = 0x01, kNoInputOperator = 0x02, kAutoStreamer = 0x04,
65  kHasVersion = 0x08, kHasCustomStreamerMember = 0x10
66  };
67 
68  ~TClassTable();
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 
95 R__EXTERN TClassTable *gClassTable;
96 
97 namespace 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