Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TProtoClass.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/meta:$Id$
0002 // Author: Axel Naumann 2014-04-28
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2014, 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 
0013 #ifndef ROOT_TProtoClass
0014 #define ROOT_TProtoClass
0015 
0016 #include "TNamed.h"
0017 
0018 #include <vector>
0019 
0020 class TClass;
0021 class TList;
0022 class TRealData;
0023 #ifdef R__LESS_INCLUDES
0024 class TDataMember;
0025 #else
0026 #include "TDataMember.h"
0027 #endif
0028 
0029 //////////////////////////////////////////////////////////////////////////
0030 //                                                                      //
0031 // TProtoClass                                                          //
0032 //                                                                      //
0033 // Stores enough information to create a TClass from a dictionary       //
0034 // without interpreter information.                                     //
0035 //                                                                      //
0036 //////////////////////////////////////////////////////////////////////////
0037 
0038 class TProtoClass: public TNamed {
0039 public:
0040    struct TProtoRealData  {
0041       Long_t fOffset;     // data member offset
0042       Int_t  fDMIndex;    // index of data member in vector of data members
0043       Int_t  fLevel;      // member level (0 : belong to this class, 1 is a data member of a data member object, etc...)
0044       Int_t  fClassIndex; // index of class belonging to in list of dep classes
0045       char   fStatusFlag; // status of the real data member (if bit 0 set is an object, if bit 1 set is transient if bit 2 set is a pointer)
0046 
0047       enum EStatusFlags {
0048          kIsObject    = BIT(0),    // member is object
0049          kIsTransient = BIT(1),    // data member is transient
0050          kIsPointer   = BIT(2),    // data member is a pointer
0051          kBitMask     = 0x000000ff
0052       };
0053 
0054    public:
0055       bool IsAClass() const { return fClassIndex >= 0; }
0056       TProtoRealData() : fOffset(0), fDMIndex(-1), fLevel(0), fClassIndex(-1), fStatusFlag(0) {}
0057       TProtoRealData(const TRealData *rd);
0058       virtual ~TProtoRealData();
0059       TRealData *CreateRealData(TClass *currentClass, TClass *parent, TRealData * parentData, int prevLevel) const;
0060 
0061       Bool_t TestFlag(UInt_t f) const { return (Bool_t) ((fStatusFlag & f) != 0); }
0062       void SetFlag(UInt_t f, Bool_t on = kTRUE) {
0063          if (on)
0064             fStatusFlag |= f & kBitMask;
0065          else
0066             fStatusFlag &= ~(f & kBitMask);
0067       }
0068 
0069       ClassDef(TProtoRealData, 3);//Persistent version of TRealData
0070    };
0071 
0072 private:
0073    TList   *fBase;     // List of base classes
0074    TList   *fEnums;    // List of enums in this scope
0075    std::vector<TProtoRealData> fPRealData;  // List of TProtoRealData
0076    std::vector<TDataMember *>  fData;       // collection of data members
0077    std::vector<TString>        fDepClasses; // list of dependent classes
0078    Int_t    fSizeof;         // Size of the class
0079    UInt_t   fCheckSum;       //checksum of data members and base classes
0080    Int_t    fCanSplit;       // Whether this class can be split
0081    Int_t    fStreamerType;   // Which streaming method to use
0082    Long_t   fProperty;       // Class properties, see EProperties
0083    Long_t   fClassProperty;  // Class C++ properties, see EClassProperties
0084    Long_t   fOffsetStreamer; // Offset to streamer function
0085 
0086    TProtoClass(const TProtoClass &) = delete;
0087    TProtoClass &operator=(const TProtoClass &) = delete;
0088 
0089    const char * GetClassName(Int_t index) const { return (index >= 0) ? fDepClasses[index].Data() : nullptr; }
0090 
0091    // compute index of data member in the list
0092    static Int_t DataMemberIndex(TClass * cl, const char * name);
0093    // find data member  given an index
0094    static TDataMember * FindDataMember(TClass * cl,  Int_t index);
0095 
0096 public:
0097    TProtoClass():
0098       fBase(nullptr), fEnums(nullptr), fSizeof(0), fCheckSum(0), fCanSplit(0),
0099       fStreamerType(0), fProperty(0), fClassProperty(0),
0100       fOffsetStreamer(0) {
0101    }
0102 
0103    TProtoClass(TProtoClass *pc);
0104    TProtoClass(TClass *cl);
0105    virtual ~TProtoClass();
0106 
0107    Bool_t FillTClass(TClass *pcl);
0108    const TList *GetListOfEnums() { return fEnums; };
0109    void Delete(Option_t *opt = "") override;
0110 
0111    int GetSize() { return fSizeof; }
0112    TList * GetBaseList() { return fBase; }
0113    //TList * GetDataList() { return fData; }
0114    TList * GetEnumList() { return fEnums; }
0115    std::vector<TProtoRealData> & GetPRDList() { return fPRealData; }
0116    std::vector<TDataMember *> & GetData() { return fData; }
0117    std::vector<TString> & GetDepClasses() { return fDepClasses; }
0118 
0119    ClassDefOverride(TProtoClass, 2); //Persistent TClass
0120 };
0121 
0122 #endif