00001 // @(#)root/meta:$Id: TDataMember.h 24077 2008-05-31 19:39:09Z brun $ 00002 // Author: Fons Rademakers 04/02/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_TDataMember 00013 #define ROOT_TDataMember 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TDataMember // 00019 // // 00020 // Dictionary interface for a class data member. // 00021 // // 00022 ////////////////////////////////////////////////////////////////////////// 00023 00024 #ifndef ROOT_TDictionary 00025 #include "TDictionary.h" 00026 #endif 00027 00028 class TList; 00029 class TClass; 00030 class TDataType; 00031 class TMethodCall; 00032 00033 class TDataMember : public TDictionary { 00034 00035 private: 00036 enum { kObjIsPersistent = BIT(2) }; 00037 00038 DataMemberInfo_t *fInfo; //pointer to CINT data member info 00039 TClass *fClass; //pointer to the class 00040 TDataType *fDataType; //pointer to data basic type descriptor 00041 00042 Long_t fOffset; //offset 00043 Int_t fSTLCont; //STL type 00044 Long_t fProperty; //Property 00045 00046 TString fTypeName; //data member type, e,g.: "class TDirectory*" -> "TDirectory". 00047 TString fFullTypeName; //full type description of data member, e,g.: "class TDirectory*". 00048 TString fTrueTypeName; //full type description with no typedef 00049 00050 // The following fields allows to access all (even private) datamembers and 00051 // provide a possibility of having options with names and strings. 00052 // These options are defined in a comment to a field! 00053 TMethodCall *fValueGetter; //method that returns a value; 00054 TMethodCall *fValueSetter; //method which sets value; 00055 TList *fOptions; //list of possible values 0=no restrictions 00056 00057 protected: 00058 TDataMember(const TDataMember&); 00059 TDataMember& operator=(const TDataMember&); 00060 00061 public: 00062 00063 TDataMember(DataMemberInfo_t *info = 0, TClass *cl = 0); 00064 virtual ~TDataMember(); 00065 Int_t GetArrayDim() const; 00066 Int_t GetMaxIndex(Int_t dim) const; 00067 TClass *GetClass() const { return fClass; } 00068 TDataType *GetDataType() const { return fDataType; } //only for basic type 00069 Long_t GetOffset() const; 00070 Long_t GetOffsetCint() const; 00071 const char *GetTypeName() const; 00072 const char *GetFullTypeName() const; 00073 const char *GetTrueTypeName() const; 00074 const char *GetArrayIndex() const; 00075 Int_t GetUnitSize() const; 00076 TList *GetOptions() const; 00077 TMethodCall *SetterMethod(TClass *cl); 00078 TMethodCall *GetterMethod(TClass *cl = 0); 00079 00080 Bool_t IsBasic() const; 00081 Bool_t IsEnum() const; 00082 Bool_t IsaPointer() const; 00083 Bool_t IsPersistent() const { return TestBit(kObjIsPersistent); } 00084 Int_t IsSTLContainer(); 00085 Long_t Property() const; 00086 ClassDef(TDataMember,0) //Dictionary for a class data member 00087 }; 00088 00089 00090 // This class implements one option in options list. All Data members are public 00091 // for cenvenience reasons. 00092 00093 class TOptionListItem : public TObject { 00094 00095 protected: 00096 TOptionListItem(const TOptionListItem&); 00097 TOptionListItem& operator=(const TOptionListItem&); 00098 00099 public: 00100 TDataMember *fDataMember; //Data member to which this option belongs 00101 Long_t fValue; //Numerical value assigned to option 00102 Long_t fValueMaskBit; //Not used yet: bitmask used when option is a toggle group 00103 Long_t fToggleMaskBit; //Not used yet: bitmask used when toggling value 00104 char *fOptName; //Text assigned to option which appears in option menu 00105 char *fOptLabel; //Text (or enum) value assigned to option. 00106 00107 TOptionListItem(TDataMember *m,Long_t val, Long_t valmask, Long_t tglmask, 00108 const char *name, const char *label); 00109 ~TOptionListItem(); 00110 }; 00111 00112 #endif