Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:36

0001 // @(#)root/cont:$Id$
0002 // Author: Fons Rademakers   11/08/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TClassTable
0013 #define ROOT_TClassTable
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TClassTable                                                          //
0019 //                                                                      //
0020 // This class registers for all classes their name, id and dictionary   //
0021 // function in a hash table.                                            //
0022 //                                                                      //
0023 //////////////////////////////////////////////////////////////////////////
0024 
0025 #include "TObject.h"
0026 #include <string>
0027 #include <atomic>
0028 
0029 class TProtoClass;
0030 
0031 namespace ROOT {
0032    class TClassAlt;
0033    class TClassRec;
0034    class TMapTypeToClassRec;
0035 }
0036 
0037 class TClassTable : public TObject {
0038 
0039 friend  void ROOT::ResetClassVersion(TClass*, const char*, Short_t);
0040 friend  class TROOT;
0041 
0042 private:
0043    typedef ROOT::TMapTypeToClassRec IdMap_t;
0044    class NormalizeThenLock;
0045 
0046    static ROOT::TClassAlt   **fgAlternate;
0047    static ROOT::TClassRec   **fgTable;
0048    static ROOT::TClassRec   **fgSortedTable;
0049    static IdMap_t            *fgIdMap;
0050    static UInt_t              fgSize;
0051    static std::atomic<UInt_t> fgTally;
0052    static Bool_t              fgSorted;
0053    static UInt_t              fgCursor;
0054 
0055    TClassTable();
0056 
0057    static ROOT::TClassRec   *FindElement(const char *cname, Bool_t insert);
0058    static void         SortTable();
0059 
0060    static Bool_t CheckClassTableInit();
0061 
0062 public:
0063    // bits that can be set in pragmabits
0064    enum {
0065       kNoStreamer = 0x01, kNoInputOperator = 0x02, kAutoStreamer = 0x04,
0066       kHasVersion = 0x08, kHasCustomStreamerMember = 0x10
0067    };
0068 
0069    ~TClassTable();
0070 
0071    static void             Add(const char *cname, Version_t id,
0072                                const std::type_info &info, DictFuncPtr_t dict,
0073                                Int_t pragmabits);
0074    static void             Add(TProtoClass *protoClass);
0075    static ROOT::TClassAlt *AddAlternate(const char *normname, const char *alternate);
0076    static char            *At(UInt_t index);
0077    int                     Classes();
0078    static Bool_t           Check(const char *cname, std::string &normname);
0079    static Version_t        GetID(const char *cname);
0080    static Int_t            GetPragmaBits(const char *name);
0081    static DictFuncPtr_t    GetDict(const char *cname);
0082    static DictFuncPtr_t    GetDict(const std::type_info& info);
0083    static DictFuncPtr_t    GetDictNorm(const char *cname);
0084    static TProtoClass     *GetProto(const char *cname);
0085    static TProtoClass     *GetProtoNorm(const char *cname);
0086    static void             Init();
0087    static char            *Next();
0088    void                    Print(Option_t *option="") const override;
0089    static void             PrintTable();
0090    static void             Remove(const char *cname);
0091    static void             RemoveAlternate(ROOT::TClassAlt *alt);
0092    static void             Terminate();
0093 
0094    ClassDefOverride(TClassTable,0)  //Table of known classes
0095 };
0096 
0097 R__EXTERN TClassTable *gClassTable;
0098 
0099 namespace ROOT {
0100    extern void AddClass(const char *cname, Version_t id, DictFuncPtr_t dict,
0101                         Int_t pragmabits);
0102    extern void RemoveClass(const char *cname, TClass *cl);
0103 }
0104 
0105 #endif