TClassTable.h

Go to the documentation of this file.
00001 // @(#)root/cont:$Id: TClassTable.h 33854 2010-06-12 14:09:50Z pcanal $
00002 // Author: Fons Rademakers   11/08/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TClassTable
00013 #define ROOT_TClassTable
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TClassTable                                                          //
00019 //                                                                      //
00020 // This class registers for all classes their name, id and dictionary   //
00021 // function in a hash table.                                            //
00022 //                                                                      //
00023 //////////////////////////////////////////////////////////////////////////
00024 
00025 #ifndef ROOT_TObject
00026 #include "TObject.h"
00027 #endif
00028 #ifndef ROOT_TString
00029 #include "TString.h"
00030 #endif
00031 
00032 class TClassRec {
00033 public:
00034    char            *fName;
00035    Version_t        fId;
00036    Int_t            fBits;
00037    VoidFuncPtr_t    fDict;
00038    const type_info *fInfo;
00039    TClassRec       *fNext;
00040 };
00041 
00042 namespace ROOT {
00043    class TMapTypeToClassRec;
00044 }
00045 
00046 class TClassTable : public TObject {
00047 
00048 friend  void ROOT::ResetClassVersion(TClass*, const char*, Short_t);
00049 
00050 private:
00051    typedef ROOT::TMapTypeToClassRec IdMap_t;
00052 
00053    static TClassRec  **fgTable;
00054    static TClassRec  **fgSortedTable;
00055    static IdMap_t     *fgIdMap;
00056    static int          fgSize;
00057    static int          fgTally;
00058    static Bool_t       fgSorted;
00059    static int          fgCursor;
00060 
00061    TClassTable();
00062 
00063    static TClassRec   *FindElementImpl(const char *cname, Bool_t insert);
00064    static TClassRec   *FindElement(const char *cname, Bool_t insert=kFALSE);
00065    static void         SortTable();
00066 
00067 public:
00068    // bits that can be set in pragmabits
00069    enum { kNoStreamer = 0x01, kNoInputOperator = 0x02, kAutoStreamer = 0x04 };
00070 
00071    ~TClassTable();
00072 
00073    static void          Add(const char *cname, Version_t id,
00074                             const type_info &info, VoidFuncPtr_t dict,
00075                             Int_t pragmabits);
00076    static char         *At(int index);
00077    int                  Classes();
00078    static Version_t     GetID(const char *cname);
00079    static Int_t         GetPragmaBits(const char *name);
00080    static VoidFuncPtr_t GetDict(const char *cname);
00081    static VoidFuncPtr_t GetDict(const type_info& info);
00082    static void          Init();
00083    static char         *Next();
00084    void                 Print(Option_t *option="") const;
00085    static void          PrintTable();
00086    static void          Remove(const char *cname);
00087    static void          Terminate();
00088 
00089    ClassDef(TClassTable,0)  //Table of known classes
00090 };
00091 
00092 R__EXTERN TClassTable *gClassTable;
00093 
00094 namespace ROOT {
00095    extern void AddClass(const char *cname, Version_t id, VoidFuncPtr_t dict,
00096                         Int_t pragmabits);
00097    extern void RemoveClass(const char *cname);
00098 }
00099 
00100 #endif

Generated on Tue Jul 5 14:11:26 2011 for ROOT_528-00b_version by  doxygen 1.5.1