1 // @(#)root/meta:$Id$ 2 // Author: Fons Rademakers 04/02/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_TDataMember 13 #define ROOT_TDataMember 14 15 16 ////////////////////////////////////////////////////////////////////////// 17 // // 18 // TDataMember // 19 // // 20 // Dictionary interface for a class data member. // 21 // // 22 ////////////////////////////////////////////////////////////////////////// 23 24 #ifndef ROOT_TDictionary 25 #include "TDictionary.h" 26 #endif 27 28 class TList; 29 class TClass; 30 class TDataType; 31 class TMethodCall; 32 33 class TDataMember : public TDictionary { 34 35 private: 36 enum { kObjIsPersistent = BIT(2) }; 37 38 DataMemberInfo_t *fInfo; //pointer to CINT data member info 39 TClass *fClass; //pointer to the class 40 TDataType *fDataType; //pointer to data basic type descriptor 41 42 Long_t fOffset; //offset 43 Int_t fSTLCont; //STL type 44 Long_t fProperty; //Property 45 46 TString fTypeName; //data member type, e,g.: "class TDirectory*" -> "TDirectory". 47 TString fFullTypeName; //full type description of data member, e,g.: "class TDirectory*". 48 TString fTrueTypeName; //full type description with no typedef 49 50 // The following fields allows to access all (even private) datamembers and 51 // provide a possibility of having options with names and strings. 52 // These options are defined in a comment to a field! 53 TMethodCall *fValueGetter; //method that returns a value; 54 TMethodCall *fValueSetter; //method which sets value; 55 TList *fOptions; //list of possible values 0=no restrictions 56 57 protected: 58 TDataMember(const TDataMember&); 59 TDataMember& operator=(const TDataMember&); 60 61 public: 62 63 TDataMember(DataMemberInfo_t *info = 0, TClass *cl = 0); 64 virtual ~TDataMember(); 65 Int_t GetArrayDim() const; 66 Int_t GetMaxIndex(Int_t dim) const; 67 TClass *GetClass() const { return fClass; } 68 TDataType *GetDataType() const { return fDataType; } //only for basic type 69 Long_t GetOffset() const; 70 Long_t GetOffsetCint() const; 71 const char *GetTypeName() const; 72 const char *GetFullTypeName() const; 73 const char *GetTrueTypeName() const; 74 const char *GetArrayIndex() const; 75 Int_t GetUnitSize() const; 76 TList *GetOptions() const; 77 TMethodCall *SetterMethod(TClass *cl); 78 TMethodCall *GetterMethod(TClass *cl = 0); 79 80 Bool_t IsBasic() const; 81 Bool_t IsEnum() const; 82 Bool_t IsaPointer() const; 83 Bool_t IsPersistent() const { return TestBit(kObjIsPersistent); } 84 Int_t IsSTLContainer(); 85 Long_t Property() const; 86 ClassDef(TDataMember,0) //Dictionary for a class data member 87 }; 88 89 90 // This class implements one option in options list. All Data members are public 91 // for cenvenience reasons. 92 93 class TOptionListItem : public TObject { 94 95 public: 96 TDataMember *fDataMember; //Data member to which this option belongs 97 Long_t fValue; //Numerical value assigned to option 98 Long_t fValueMaskBit; //Not used yet: bitmask used when option is a toggle group 99 Long_t fToggleMaskBit; //Not used yet: bitmask used when toggling value 100 TString fOptName; //Text assigned to option which appears in option menu 101 TString fOptLabel; //Text (or enum) value assigned to option. 102 103 TOptionListItem(TDataMember *m,Long_t val, Long_t valmask, Long_t tglmask, 104 const char *name, const char *label); 105 }; 106 107 #endif 108