Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TDataMember.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: Fons Rademakers   04/02/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_TDataMember
0013 #define ROOT_TDataMember
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TDataMember                                                          //
0019 //                                                                      //
0020 // Dictionary interface for a class data member.                        //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TDictionary.h"
0025 
0026 class TList;
0027 class TClass;
0028 class TDataType;
0029 class TMethodCall;
0030 
0031 class TDataMember : public TDictionary {
0032 
0033 private:
0034    enum EStatusBits {
0035       kObjIsPersistent = BIT(2)
0036    };
0037 
0038    DataMemberInfo_t   *fInfo;         //!pointer to CINT data member info
0039    TClass             *fClass;        //!pointer to the class
0040    TDataType          *fDataType;     //!pointer to data basic type descriptor
0041 
0042    Longptr_t           fOffset;       //offset
0043    Int_t               fSTLCont;      //STL type
0044    Long_t              fProperty;     //Property
0045    Int_t               fArrayDim;     //Number of array dimensions
0046    Int_t              *fArrayMaxIndex;//[fArrayDim] Maximum index for each dimension
0047    TString             fArrayIndex;   //String representation of the index variable name
0048 
0049    TString             fTypeName;     //data member type, e,g.: "class TDirectory*" -> "TDirectory".
0050    TString             fFullTypeName; //full type description of data member, e,g.: "class TDirectory*".
0051    TString             fTrueTypeName; //full type description with no typedef
0052 
0053    // The following fields allows to access all (even private) datamembers and
0054    // provide a possibility of having options with names and strings.
0055    // These options are defined in a comment to a field!
0056    TMethodCall        *fValueGetter;  //!method that returns a value;
0057    TMethodCall        *fValueSetter;  //!method which sets value;
0058    TList              *fOptions;      //list of possible values 0=no restrictions
0059 
0060    void Init(bool afterReading);
0061 
0062    void ExtractOptionsFromComment();
0063 
0064 protected:
0065    TDataMember(const TDataMember&);
0066    TDataMember& operator=(const TDataMember&);
0067 
0068 public:
0069 
0070    TDataMember(DataMemberInfo_t *info = nullptr, TClass *cl = nullptr);
0071    virtual       ~TDataMember();
0072    Int_t          GetArrayDim() const;
0073    DeclId_t       GetDeclId() const;
0074    Int_t          GetMaxIndex(Int_t dim) const;
0075    TClass        *GetClass() const { return fClass; }
0076    TDataType     *GetDataType() const { return fDataType; } //only for basic type
0077    Longptr_t      GetOffset() const;
0078    Longptr_t      GetOffsetCint() const;
0079    const char    *GetTypeName() const;
0080    const char    *GetFullTypeName() const;
0081    const char    *GetTrueTypeName() const;
0082    const char    *GetArrayIndex() const;
0083    Int_t          GetUnitSize() const;
0084    TList         *GetOptions();
0085    TMethodCall   *SetterMethod(TClass *cl);
0086    TMethodCall   *GetterMethod(TClass *cl = nullptr);
0087 
0088    Bool_t         IsBasic() const;
0089    Bool_t         IsEnum() const;
0090    Bool_t         IsaPointer() const;
0091    Bool_t         IsPersistent() const { return TestBit(kObjIsPersistent); }
0092    Int_t          IsSTLContainer();
0093    Bool_t         IsValid();
0094    Long_t         Property() const override;
0095    void           SetClass(TClass* cl) { fClass = cl; }
0096    virtual bool   Update(DataMemberInfo_t *info);
0097 
0098    ClassDefOverride(TDataMember,2)  //Dictionary for a class data member
0099 };
0100 
0101 
0102 // This class implements one option in options list. All Data members are public
0103 // for convenience reasons.
0104 
0105 class TOptionListItem : public TObject {
0106 
0107 public:
0108    TDataMember     *fDataMember;     //!Data member to which this option belongs
0109    Long_t           fValue;          //Numerical value assigned to option
0110    Long_t           fValueMaskBit;   //Not used yet: bitmask used when option is a toggle group
0111    Long_t           fToggleMaskBit;  //Not used yet: bitmask used when toggling value
0112    TString          fOptName;        //Text assigned to option which appears in option menu
0113    TString          fOptLabel;       //Text (or enum) value assigned to option.
0114    TOptionListItem():
0115       fDataMember(nullptr), fValue(0), fValueMaskBit(0), fToggleMaskBit(0)
0116    {}
0117    TOptionListItem(TDataMember *m,Long_t val, Long_t valmask, Long_t tglmask,
0118                    const char *name, const char *label);
0119 
0120    ClassDefOverride(TOptionListItem,2); //Element in the list of options.
0121 };
0122 
0123 #endif