Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TRealData.cxx
Go to the documentation of this file.
1// @(#)root/meta:$Id$
2// Author: Rene Brun 05/03/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#include "TRealData.h"
13#include "TDataMember.h"
14#include "TClass.h"
15#include "TClassEdit.h"
16#include "TStreamer.h"
17
18
19/** \class TRealData
20The TRealData class manages the effective list of all data members
21for a given class. For example for an object of class TLine that inherits
22from TObject and TAttLine, the TRealData object for a line contains the
23complete list of all data members of the 3 classes.
24
25The list of TRealData members in TClass is built when functions like
26object.Inspect or object.DrawClass are called.
27*/
28
29////////////////////////////////////////////////////////////////////////////////
30/// RealData default constructor.
31
32TRealData::TRealData() : TObject(), fDataMember(nullptr), fThisOffset(-1),
33 fStreamer(nullptr), fIsObject(kFALSE)
34{
35}
36
37
38////////////////////////////////////////////////////////////////////////////////
39/// Constructor to define one persistent data member.
40/// datamember is the pointer to the data member descriptor.
41
43 : TObject(), fDataMember(datamember), fThisOffset(offset), fName(name),
44 fStreamer(nullptr), fIsObject(kFALSE)
45{
46}
47
48////////////////////////////////////////////////////////////////////////////////
49/// RealData default destructor.
50
52{
53 delete fStreamer;
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// Write one persistent data member on output buffer.
58/// pointer points to the current persistent data member
59
60void TRealData::WriteRealData(void *, char *&)
61{
62}
63
64////////////////////////////////////////////////////////////////////////////////
65
67{
68// fDataMember->SetStreamer(str);
69// delete fStreamer;
70 fStreamer = str;
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Return the name of the data member as represented in the list of
75/// real data.
76
78{
79 output.Clear();
80 const char* dmType = dm->GetTypeName();
82 std::string typeNameBuf;
83 Int_t ndim = dm->GetArrayDim();
84 std::array<Int_t, 5> maxIndices; // 5 is the maximum supported in TStreamerElement::SetMaxIndex
88 ndim);
89 output = dm->GetName();
90 for (Int_t idim = 0; idim < ndim; ++idim) {
92 }
93 return;
94 }
95
96 // keep an empty name if data member is not found
97 if (dm) output = dm->GetName();
98 if (dm->IsaPointer())
99 output = TString("*")+output;
100 else {
101 if (dm && dm->GetArrayDim() > 0) {
102 // in case of array (like fMatrix[2][2] we need to add max index )
103 // this only in case of it os not a pointer
104 for (int idim = 0; idim < dm->GetArrayDim(); ++idim)
105 output += TString::Format("[%d]",dm->GetMaxIndex(idim) );
106 }
107 }
108}
109
110
111////////////////////////////////////////////////////////////////////////////////
112/// Return the associate streamer object.
113
115{
116 return fStreamer; // return fDataMember->GetStreamer();
117}
118
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
char name[80]
Definition TGX11.cxx:110
All ROOT classes may have RTTI (run time type identification) support added.
Definition TDataMember.h:31
Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
Int_t GetArrayDim() const
Return number of array dimensions.
Bool_t IsaPointer() const
Return true if data member is a pointer.
const char * GetTypeName() const
Get the decayed type name of this data member, removing const and volatile qualifiers,...
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Mother of all ROOT objects.
Definition TObject.h:41
const char * GetName() const override
Returns name of object.
Definition TRealData.h:52
void WriteRealData(void *pointer, char *&buffer)
Write one persistent data member on output buffer.
Definition TRealData.cxx:60
TMemberStreamer * fStreamer
Definition TRealData.h:36
void AdoptStreamer(TMemberStreamer *p)
Definition TRealData.cxx:66
TRealData()
RealData default constructor.
Definition TRealData.cxx:32
TMemberStreamer * GetStreamer() const
Return the associate streamer object.
virtual ~TRealData()
RealData default destructor.
Definition TRealData.cxx:51
Basic string class.
Definition TString.h:138
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
bool IsStdArray(std::string_view name)
Definition TClassEdit.h:230
bool GetStdArrayProperties(const char *typeName, std::string &typeNameBuf, std::array< int, 5 > &maxIndices, int &ndim)
static void output()