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