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
26class TList;
27class TClass;
28class TDataType;
29class TMethodCall;
30
31class TDataMember : public TDictionary {
32
33private:
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
62protected:
65
66public:
67
68 TDataMember(DataMemberInfo_t *info = 0, TClass *cl = 0);
69 virtual ~TDataMember();
70 Int_t GetArrayDim() const;
71 DeclId_t GetDeclId() const;
72 Int_t GetMaxIndex(Int_t dim) const;
73 TClass *GetClass() const { return fClass; }
74 TDataType *GetDataType() const { return fDataType; } //only for basic type
75 Long_t GetOffset() const;
76 Long_t GetOffsetCint() const;
77 const char *GetTypeName() const;
78 const char *GetFullTypeName() const;
79 const char *GetTrueTypeName() const;
80 const char *GetArrayIndex() const;
81 Int_t GetUnitSize() const;
82 TList *GetOptions() const;
85
86 Bool_t IsBasic() const;
87 Bool_t IsEnum() const;
88 Bool_t IsaPointer() const;
92 Long_t Property() const;
93 void SetClass(TClass* cl) { fClass = cl; }
94 virtual bool Update(DataMemberInfo_t *info);
95
96 ClassDef(TDataMember,2) //Dictionary for a class data member
97};
98
99
100// This class implements one option in options list. All Data members are public
101// for convenience reasons.
102
103class TOptionListItem : public TObject {
104
105public:
106 TDataMember *fDataMember; //!Data member to which this option belongs
107 Long_t fValue; //Numerical value assigned to option
108 Long_t fValueMaskBit; //Not used yet: bitmask used when option is a toggle group
109 Long_t fToggleMaskBit; //Not used yet: bitmask used when toggling value
110 TString fOptName; //Text assigned to option which appears in option menu
111 TString fOptLabel; //Text (or enum) value assigned to option.
114 {}
115 TOptionListItem(TDataMember *m,Long_t val, Long_t valmask, Long_t tglmask,
116 const char *name, const char *label);
117
118 ClassDef(TOptionListItem,2); //Element in the list of options.
119};
120
121#endif
int Int_t
Definition: RtypesCore.h:41
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:326
#define BIT(n)
Definition: Rtypes.h:83
char name[80]
Definition: TGX11.cxx:109
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
virtual ~TDataMember()
TDataMember dtor deletes adopted CINT DataMemberInfo object.
Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
TDataMember(const TDataMember &)
copy constructor
Long_t fProperty
Definition: TDataMember.h:44
TString fFullTypeName
Definition: TDataMember.h:50
TString fTypeName
Definition: TDataMember.h:49
TMethodCall * SetterMethod(TClass *cl)
Return a TMethodCall method responsible for setting the value of data member.
virtual bool Update(DataMemberInfo_t *info)
Update the TFunction to reflect the new info.
TDataMember & operator=(const TDataMember &)
assignment operator
const char * GetTrueTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
Bool_t IsPersistent() const
Definition: TDataMember.h:89
DataMemberInfo_t * fInfo
Definition: TDataMember.h:38
Int_t * fArrayMaxIndex
Definition: TDataMember.h:46
Long_t GetOffset() const
Get offset from "this".
TString fTrueTypeName
Definition: TDataMember.h:51
TMethodCall * fValueGetter
Definition: TDataMember.h:56
Int_t GetArrayDim() const
Return number of array dimensions.
Bool_t IsEnum() const
Return true if data member is an enum.
void Init(bool afterReading)
Routines called by the constructor and Update to reset the member's information.
Int_t GetUnitSize() const
Get the sizeof the underlying type of the data member (i.e.
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Int_t IsSTLContainer()
The return type is defined in TDictionary (kVector, kList, etc.)
Bool_t IsaPointer() const
Return true if data member is a pointer.
Bool_t IsValid()
Return true if this data member object is pointing to a currently loaded data member.
TClass * fClass
pointer to CINT data member info
Definition: TDataMember.h:39
TList * GetOptions() const
Returns list of options - list of TOptionListItems.
TDataType * GetDataType() const
Definition: TDataMember.h:74
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
DeclId_t GetDeclId() const
TMethodCall * fValueSetter
method that returns a value;
Definition: TDataMember.h:57
TMethodCall * GetterMethod(TClass *cl=0)
Return a TMethodCall method responsible for getting the value of data member.
TList * fOptions
method which sets value;
Definition: TDataMember.h:58
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:43
TDataType * fDataType
pointer to the class
Definition: TDataMember.h:40
const char * GetFullTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
TString fArrayIndex
Definition: TDataMember.h:47
Long_t GetOffsetCint() const
Get offset from "this" using the information in CINT only.
@ kObjIsPersistent
Definition: TDataMember.h:35
Long_t fOffset
pointer to data basic type descriptor
Definition: TDataMember.h:42
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
TClass * GetClass() const
Definition: TDataMember.h:73
void SetClass(TClass *cl)
Definition: TDataMember.h:93
Int_t fArrayDim
Definition: TDataMember.h:45
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:162
const void * DeclId_t
Definition: TDictionary.h:209
A doubly linked list.
Definition: TList.h:44
Method or function calling interface.
Definition: TMethodCall.h:37
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
EStatusBits
Definition: TObject.h:57
Long_t fToggleMaskBit
Definition: TDataMember.h:109
TString fOptName
Definition: TDataMember.h:110
Long_t fValueMaskBit
Definition: TDataMember.h:108
TDataMember * fDataMember
Definition: TDataMember.h:106
Long_t fValue
Data member to which this option belongs.
Definition: TDataMember.h:107
TString fOptLabel
Definition: TDataMember.h:111
Basic string class.
Definition: TString.h:131
auto * m
Definition: textangle.C:8