Logo ROOT   6.10/09
Reference Guide
TDataMember.h
Go to the documentation of this file.
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 #include "TDictionary.h"
25 
26 class TList;
27 class TClass;
28 class TDataType;
29 class TMethodCall;
30 
31 class TDataMember : public TDictionary {
32 
33 private:
34  enum { kObjIsPersistent = BIT(2) };
35 
36  DataMemberInfo_t *fInfo; //!pointer to CINT data member info
37  TClass *fClass; //!pointer to the class
38  TDataType *fDataType; //!pointer to data basic type descriptor
39 
40  Long_t fOffset; //offset
41  Int_t fSTLCont; //STL type
42  Long_t fProperty; //Property
43  Int_t fArrayDim; //Number of array dimensions
44  Int_t *fArrayMaxIndex;//[fArrayDim] Maximum index for each dimension
45  TString fArrayIndex; //String representation of the index variable name
46 
47  TString fTypeName; //data member type, e,g.: "class TDirectory*" -> "TDirectory".
48  TString fFullTypeName; //full type description of data member, e,g.: "class TDirectory*".
49  TString fTrueTypeName; //full type description with no typedef
50 
51  // The following fields allows to access all (even private) datamembers and
52  // provide a possibility of having options with names and strings.
53  // These options are defined in a comment to a field!
54  TMethodCall *fValueGetter; //!method that returns a value;
55  TMethodCall *fValueSetter; //!method which sets value;
56  TList *fOptions; //list of possible values 0=no restrictions
57 
58  void Init(bool afterReading);
59 
60 protected:
61  TDataMember(const TDataMember&);
63 
64 public:
65 
66  TDataMember(DataMemberInfo_t *info = 0, TClass *cl = 0);
67  virtual ~TDataMember();
68  Int_t GetArrayDim() const;
69  DeclId_t GetDeclId() const;
70  Int_t GetMaxIndex(Int_t dim) const;
71  TClass *GetClass() const { return fClass; }
72  TDataType *GetDataType() const { return fDataType; } //only for basic type
73  Long_t GetOffset() const;
74  Long_t GetOffsetCint() const;
75  const char *GetTypeName() const;
76  const char *GetFullTypeName() const;
77  const char *GetTrueTypeName() const;
78  const char *GetArrayIndex() const;
79  Int_t GetUnitSize() const;
80  TList *GetOptions() const;
83 
84  Bool_t IsBasic() const;
85  Bool_t IsEnum() const;
86  Bool_t IsaPointer() const;
89  Bool_t IsValid();
90  Long_t Property() const;
91  void SetClass(TClass* cl) { fClass = cl; }
92  virtual bool Update(DataMemberInfo_t *info);
93 
94  ClassDef(TDataMember,2) //Dictionary for a class data member
95 };
96 
97 
98 // This class implements one option in options list. All Data members are public
99 // for cenvenience reasons.
100 
101 class TOptionListItem : public TObject {
102 
103 public:
104  TDataMember *fDataMember; //!Data member to which this option belongs
105  Long_t fValue; //Numerical value assigned to option
106  Long_t fValueMaskBit; //Not used yet: bitmask used when option is a toggle group
107  Long_t fToggleMaskBit; //Not used yet: bitmask used when toggling value
108  TString fOptName; //Text assigned to option which appears in option menu
109  TString fOptLabel; //Text (or enum) value assigned to option.
111  fDataMember(0), fValue(0), fValueMaskBit(0), fToggleMaskBit(0)
112  {}
113  TOptionListItem(TDataMember *m,Long_t val, Long_t valmask, Long_t tglmask,
114  const char *name, const char *label);
115 
116  ClassDef(TOptionListItem,2); //Element in the list of options.
117 };
118 
119 #endif
void Init(bool afterReading)
Routines called by the constructor and Update to reset the member's information.
TMethodCall * SetterMethod(TClass *cl)
Return a TMethodCall method responsible for setting the value of data member.
TMethodCall * GetterMethod(TClass *cl=0)
Return a TMethodCall method responsible for getting the value of data member.
Long_t fValueMaskBit
Definition: TDataMember.h:106
const char * GetFullTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
Long_t GetOffsetCint() const
Get offset from "this" using the information in CINT only.
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
Int_t * fArrayMaxIndex
Definition: TDataMember.h:44
Bool_t IsEnum() const
Return true if data member is an enum.
Int_t GetUnitSize() const
Get the sizeof the underlying type of the data member (i.e.
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:159
#define BIT(n)
Definition: Rtypes.h:75
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
TMethodCall * fValueSetter
method that returns a value;
Definition: TDataMember.h:55
TList * GetOptions() const
Returns list of options - list of TOptionListItems.
Basic string class.
Definition: TString.h:129
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TDataMember * fDataMember
Definition: TDataMember.h:104
TString fFullTypeName
Definition: TDataMember.h:48
const void * DeclId_t
Definition: TDictionary.h:205
TMethodCall * fValueGetter
Definition: TDataMember.h:54
Bool_t IsValid()
Return true if this data member object is pointing to a currently loaded data member.
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
#define ClassDef(name, id)
Definition: Rtypes.h:297
TString fOptLabel
Definition: TDataMember.h:109
TString fArrayIndex
Definition: TDataMember.h:45
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
DataMemberInfo_t * fInfo
Definition: TDataMember.h:36
TClass * fClass
pointer to CINT data member info
Definition: TDataMember.h:37
TDataType * GetDataType() const
Definition: TDataMember.h:72
virtual bool Update(DataMemberInfo_t *info)
Update the TFunction to reflect the new info.
virtual ~TDataMember()
TDataMember dtor deletes adopted CINT DataMemberInfo object.
Method or function calling interface.
Definition: TMethodCall.h:37
void SetClass(TClass *cl)
Definition: TDataMember.h:91
TDataMember & operator=(const TDataMember &)
assignment operator
Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
A doubly linked list.
Definition: TList.h:43
TList * fOptions
method which sets value;
Definition: TDataMember.h:56
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:158
Long_t fProperty
Definition: TDataMember.h:42
TString fOptName
Definition: TDataMember.h:108
TMarker * m
Definition: textangle.C:8
Int_t GetArrayDim() const
Return number of array dimensions.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
Long_t GetOffset() const
Get offset from "this".
const char * GetTrueTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
long Long_t
Definition: RtypesCore.h:50
Long_t fValue
Data member to which this option belongs.
Definition: TDataMember.h:105
TString fTrueTypeName
Definition: TDataMember.h:49
TDataType * fDataType
pointer to the class
Definition: TDataMember.h:38
Bool_t IsPersistent() const
Definition: TDataMember.h:87
Int_t fArrayDim
Definition: TDataMember.h:43
Mother of all ROOT objects.
Definition: TObject.h:37
Int_t IsSTLContainer()
The return type is defined in TDictionary (kVector, kList, etc.)
Long_t fOffset
pointer to data basic type descriptor
Definition: TDataMember.h:40
const char * GetArrayIndex() const
If the data member is pointer and has a valid array size in its comments GetArrayIndex returns a stri...
Int_t fSTLCont
Definition: TDataMember.h:41
Long_t fToggleMaskBit
Definition: TDataMember.h:107
TDataMember(const TDataMember &)
copy constructor
TClass * GetClass() const
Definition: TDataMember.h:71
Bool_t IsaPointer() const
Return true if data member is a pointer.
TString fTypeName
Definition: TDataMember.h:47
DeclId_t GetDeclId() const