Logo ROOT  
Reference Guide
TBufferXML.h
Go to the documentation of this file.
1// @(#)root/xml:$Id: d90d66e8fd2aa9daa4b05bcba9166aee1e2b2e7f $
2// Author: Sergey Linev 10.05.2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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_TBufferXML
13#define ROOT_TBufferXML
14
15#include "Compression.h"
16#include "TBufferText.h"
17#include "TXMLSetup.h"
18#include "TString.h"
19#include "TXMLEngine.h"
20
21#include <string>
22#include <deque>
23#include <memory>
24
25class TExMap;
27class TStreamerInfo;
29class TObjArray;
30class TMemberStreamer;
31class TXMLFile;
32class TXMLStackObj;
33
34class TBufferXML final : public TBufferText, public TXMLSetup {
35
36 friend class TKeyXML;
37
38public:
41 virtual ~TBufferXML();
42
43 static TString ConvertToXML(const TObject *obj, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
44 static TString
45 ConvertToXML(const void *obj, const TClass *cl, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
46
47 template <class T>
48 static TString ToXML(const T *obj, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE)
49 {
50 return ConvertToXML(obj, TClass::GetClass<T>(), GenericLayout, UseNamespaces);
51 }
52
53 static TObject *ConvertFromXML(const char *str, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
54 static void *ConvertFromXMLAny(const char *str, TClass **cl = nullptr, Bool_t GenericLayout = kFALSE,
55 Bool_t UseNamespaces = kFALSE);
56
57 template <class T>
58 static Bool_t FromXML(T *&obj, const char *xml, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE)
59 {
60 if (obj)
61 return kFALSE;
62 obj = (T *)ConvertFromXMLChecked(xml, TClass::GetClass<T>(), GenericLayout, UseNamespaces);
63 return obj != nullptr;
64 }
65
66 Int_t GetIOVersion() const { return fIOVersion; }
68
69 // suppress class writing/reading
70
71 TClass *ReadClass(const TClass *cl = nullptr, UInt_t *objTag = nullptr) final;
72 void WriteClass(const TClass *cl) final;
73
74 // redefined virtual functions of TBuffer
75
76 Version_t ReadVersion(UInt_t *start = nullptr, UInt_t *bcnt = nullptr, const TClass *cl = nullptr) final;
77 UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE) final;
78
79 void *ReadObjectAny(const TClass *clCast) final;
80 void SkipObjectAny() final;
81
83 void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type) final;
85
86 void ClassBegin(const TClass *, Version_t = -1) final;
87 void ClassEnd(const TClass *) final;
88 void ClassMember(const char *name, const char *typeName = nullptr, Int_t arrsize1 = -1, Int_t arrsize2 = -1) final;
89
90 Int_t ReadArray(Bool_t *&b) final;
91 Int_t ReadArray(Char_t *&c) final;
92 Int_t ReadArray(UChar_t *&c) final;
93 Int_t ReadArray(Short_t *&h) final;
94 Int_t ReadArray(UShort_t *&h) final;
95 Int_t ReadArray(Int_t *&i) final;
96 Int_t ReadArray(UInt_t *&i) final;
97 Int_t ReadArray(Long_t *&l) final;
98 Int_t ReadArray(ULong_t *&l) final;
99 Int_t ReadArray(Long64_t *&l) final;
100 Int_t ReadArray(ULong64_t *&l) final;
101 Int_t ReadArray(Float_t *&f) final;
102 Int_t ReadArray(Double_t *&d) final;
103
109 Int_t ReadStaticArray(Int_t *i) final;
110 Int_t ReadStaticArray(UInt_t *i) final;
117
118 void ReadFastArray(Bool_t *b, Int_t n) final;
119 void ReadFastArray(Char_t *c, Int_t n) final;
120 void ReadFastArray(UChar_t *c, Int_t n) final;
121 void ReadFastArray(Short_t *h, Int_t n) final;
122 void ReadFastArray(UShort_t *h, Int_t n) final;
123 void ReadFastArray(Int_t *i, Int_t n) final;
124 void ReadFastArray(UInt_t *i, Int_t n) final;
125 void ReadFastArray(Long_t *l, Int_t n) final;
126 void ReadFastArray(ULong_t *l, Int_t n) final;
127 void ReadFastArray(Long64_t *l, Int_t n) final;
128 void ReadFastArray(ULong64_t *l, Int_t n) final;
129 void ReadFastArray(Float_t *f, Int_t n) final;
130 void ReadFastArray(Double_t *d, Int_t n) final;
131 void ReadFastArrayString(Char_t *c, Int_t n) final;
132 void ReadFastArray(void *start, const TClass *cl, Int_t n = 1, TMemberStreamer *s = nullptr,
133 const TClass *onFileClass = nullptr) final;
134 void ReadFastArray(void **startp, const TClass *cl, Int_t n = 1, Bool_t isPreAlloc = kFALSE,
135 TMemberStreamer *s = nullptr, const TClass *onFileClass = nullptr) final;
136
137 void WriteArray(const Bool_t *b, Int_t n) final;
138 void WriteArray(const Char_t *c, Int_t n) final;
139 void WriteArray(const UChar_t *c, Int_t n) final;
140 void WriteArray(const Short_t *h, Int_t n) final;
141 void WriteArray(const UShort_t *h, Int_t n) final;
142 void WriteArray(const Int_t *i, Int_t n) final;
143 void WriteArray(const UInt_t *i, Int_t n) final;
144 void WriteArray(const Long_t *l, Int_t n) final;
145 void WriteArray(const ULong_t *l, Int_t n) final;
146 void WriteArray(const Long64_t *l, Int_t n) final;
147 void WriteArray(const ULong64_t *l, Int_t n) final;
148 void WriteArray(const Float_t *f, Int_t n) final;
149 void WriteArray(const Double_t *d, Int_t n) final;
150
151 void WriteFastArray(const Bool_t *b, Int_t n) final;
152 void WriteFastArray(const Char_t *c, Int_t n) final;
153 void WriteFastArray(const UChar_t *c, Int_t n) final;
154 void WriteFastArray(const Short_t *h, Int_t n) final;
155 void WriteFastArray(const UShort_t *h, Int_t n) final;
156 void WriteFastArray(const Int_t *i, Int_t n) final;
157 void WriteFastArray(const UInt_t *i, Int_t n) final;
158 void WriteFastArray(const Long_t *l, Int_t n) final;
159 void WriteFastArray(const ULong_t *l, Int_t n) final;
160 void WriteFastArray(const Long64_t *l, Int_t n) final;
161 void WriteFastArray(const ULong64_t *l, Int_t n) final;
162 void WriteFastArray(const Float_t *f, Int_t n) final;
163 void WriteFastArray(const Double_t *d, Int_t n) final;
164 void WriteFastArrayString(const Char_t *c, Int_t n) final;
165 void WriteFastArray(void *start, const TClass *cl, Int_t n = 1, TMemberStreamer *s = nullptr) final;
166 Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n = 1, Bool_t isPreAlloc = kFALSE,
167 TMemberStreamer *s = nullptr) final;
168
169 void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass = nullptr) final;
171
172 void ReadBool(Bool_t &b) final;
173 void ReadChar(Char_t &c) final;
174 void ReadUChar(UChar_t &c) final;
175 void ReadShort(Short_t &s) final;
176 void ReadUShort(UShort_t &s) final;
177 void ReadInt(Int_t &i) final;
178 void ReadUInt(UInt_t &i) final;
179 void ReadLong(Long_t &l) final;
180 void ReadULong(ULong_t &l) final;
181 void ReadLong64(Long64_t &l) final;
182 void ReadULong64(ULong64_t &l) final;
183 void ReadFloat(Float_t &f) final;
184 void ReadDouble(Double_t &d) final;
185 void ReadCharP(Char_t *c) final;
186 void ReadTString(TString &s) final;
187 void ReadStdString(std::string *s) final;
188 using TBuffer::ReadStdString;
189 void ReadCharStar(char *&s) final;
190
191 void WriteBool(Bool_t b) final;
192 void WriteChar(Char_t c) final;
193 void WriteUChar(UChar_t c) final;
194 void WriteShort(Short_t s) final;
195 void WriteUShort(UShort_t s) final;
196 void WriteInt(Int_t i) final;
197 void WriteUInt(UInt_t i) final;
198 void WriteLong(Long_t l) final;
199 void WriteULong(ULong_t l) final;
200 void WriteLong64(Long64_t l) final;
201 void WriteULong64(ULong64_t l) final;
202 void WriteFloat(Float_t f) final;
203 void WriteDouble(Double_t d) final;
204 void WriteCharP(const Char_t *c) final;
205 void WriteTString(const TString &s) final;
206 void WriteStdString(const std::string *s) final;
207 using TBuffer::WriteStdString;
208 void WriteCharStar(char *s) final;
209
211
212protected:
213 // redefined protected virtual functions
214
215 void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse) final;
216
217 // end redefined protected virtual functions
218
219 static void *ConvertFromXMLChecked(const char *xml, const TClass *expectedClass, Bool_t GenericLayout = kFALSE,
220 Bool_t UseNamespaces = kFALSE);
221
222 TXMLFile *XmlFile();
223
227 void SetCompressionAlgorithm(Int_t algorithm = ROOT::RCompressionSetting::EAlgorithm::kUseGlobal);
228 void SetCompressionLevel(Int_t level = ROOT::RCompressionSetting::ELevel::kUseMin);
229 void SetCompressionSettings(Int_t settings = ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault);
230 void SetXML(TXMLEngine *xml) { fXML = xml; }
231
233 XMLNodePointer_t XmlWriteAny(const void *obj, const TClass *cl);
234
236 void *XmlReadAny(XMLNodePointer_t node, void *obj, TClass **cl);
237
238 TXMLStackObj *PushStack(XMLNodePointer_t current, Bool_t simple = kFALSE);
239 TXMLStackObj *PopStack();
240 void ShiftStack(const char *info = nullptr);
241
243 TXMLStackObj *Stack(UInt_t depth = 0)
244 {
245 return (depth < fStack.size()) ? (depth ? fStack[fStack.size() - depth - 1].get() : fStack.back().get()) : nullptr;
246 }
247
248 void WorkWithClass(TStreamerInfo *info, const TClass *cl = nullptr);
249 void WorkWithElement(TStreamerElement *elem, Int_t comp_type);
250 Bool_t VerifyNode(XMLNodePointer_t node, const char *name, const char *errinfo = nullptr);
251 Bool_t VerifyStackNode(const char *name, const char *errinfo = nullptr);
252
253 Bool_t VerifyAttr(XMLNodePointer_t node, const char *name, const char *value, const char *errinfo = nullptr);
254 Bool_t VerifyStackAttr(const char *name, const char *value, const char *errinfo = nullptr);
255
256 Bool_t ProcessPointer(const void *ptr, XMLNodePointer_t node);
257 Bool_t ExtractPointer(XMLNodePointer_t node, void *&ptr, TClass *&cl);
258 void ExtractReference(XMLNodePointer_t node, const void *ptr, const TClass *cl);
259
261 Bool_t VerifyItemNode(const char *name, const char *errinfo = nullptr);
262
263 void CreateElemNode(const TStreamerElement *elem);
265
266 void PerformPreProcessing(const TStreamerElement *elem, XMLNodePointer_t elemnode);
268
282 XMLNodePointer_t XmlWriteValue(const char *value, const char *name);
283
284 void XmlReadBasic(Char_t &value);
285 void XmlReadBasic(Short_t &value);
286 void XmlReadBasic(Int_t &value);
287 void XmlReadBasic(Long_t &value);
288 void XmlReadBasic(Long64_t &value);
289 void XmlReadBasic(Float_t &value);
290 void XmlReadBasic(Double_t &value);
291 void XmlReadBasic(Bool_t &value);
292 void XmlReadBasic(UChar_t &value);
293 void XmlReadBasic(UShort_t &value);
294 void XmlReadBasic(UInt_t &value);
295 void XmlReadBasic(ULong_t &value);
296 void XmlReadBasic(ULong64_t &value);
297 const char *XmlReadValue(const char *name);
298
299 template <typename T>
300 R__ALWAYS_INLINE void XmlReadArrayContent(T *arr, Int_t arrsize);
301
302 template <typename T>
303 R__ALWAYS_INLINE Int_t XmlReadArray(T *&arr, bool is_static = false);
304
305 template <typename T>
307
308 template <typename T>
309 R__ALWAYS_INLINE void XmlWriteArrayContent(const T *arr, Int_t arrsize);
310
311 template <typename T>
312 R__ALWAYS_INLINE void XmlWriteArray(const T *arr, Int_t arrsize);
313
314 template <typename T>
315 R__ALWAYS_INLINE void XmlWriteFastArray(const T *arr, Int_t n);
316
317 XMLNodePointer_t XmlWriteObject(const void *obj, const TClass *objClass, Bool_t cacheReuse);
318 void *XmlReadObject(void *obj, TClass **cl = nullptr);
319
320 void BeforeIOoperation();
321 void CheckVersionBuf();
322
323 TXMLEngine *fXML{nullptr}; ///<! instance of TXMLEngine for working with XML structures
324 std::deque<std::unique_ptr<TXMLStackObj>> fStack; ///<! Stack of processed objects
325 Version_t fVersionBuf{-111}; ///<! Current version buffer
326 TString fValueBuf; ///<! Current value buffer
327 Int_t fErrorFlag{0}; ///<! Error flag
328 Bool_t fCanUseCompact{kFALSE}; ///<! Flag indicate that basic type (like Int_t) can be placed in the same tag
329 TClass *fExpectedBaseClass{nullptr}; ///<! Pointer to class, which should be stored as parent of current
330 Int_t fCompressLevel{0}; ///<! Compression level and algorithm
331 Int_t fIOVersion{3}; ///<! Indicates format of ROOT xml file
332
333 ClassDefOverride(TBufferXML, 0); // a specialized TBuffer to read/write to XML files
334};
335
336//______________________________________________________________________________
338{
339 return (fCompressLevel < 0) ? -1 : fCompressLevel / 100;
340}
341
342//______________________________________________________________________________
344{
345 return (fCompressLevel < 0) ? -1 : fCompressLevel % 100;
346}
347
348//______________________________________________________________________________
350{
351 return (fCompressLevel < 0) ? -1 : fCompressLevel;
352}
353
354#endif
#define R__ALWAYS_INLINE
Definition: RConfig.hxx:577
#define d(i)
Definition: RSha256.hxx:102
#define b(i)
Definition: RSha256.hxx:100
#define f(i)
Definition: RSha256.hxx:104
#define c(i)
Definition: RSha256.hxx:101
#define h(i)
Definition: RSha256.hxx:106
unsigned short UShort_t
Definition: RtypesCore.h:36
int Int_t
Definition: RtypesCore.h:41
short Version_t
Definition: RtypesCore.h:61
unsigned char UChar_t
Definition: RtypesCore.h:34
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
short Short_t
Definition: RtypesCore.h:35
double Double_t
Definition: RtypesCore.h:55
long long Long64_t
Definition: RtypesCore.h:69
unsigned long long ULong64_t
Definition: RtypesCore.h:70
float Float_t
Definition: RtypesCore.h:53
char name[80]
Definition: TGX11.cxx:109
void * XMLNodePointer_t
Definition: TXMLEngine.h:17
Base class for text-based streamers like TBufferJSON or TBufferXML Special actions list will use meth...
Definition: TBufferText.h:21
Class for serializing/deserializing object to/from xml.
Definition: TBufferXML.h:34
Bool_t ProcessPointer(const void *ptr, XMLNodePointer_t node)
Add "ptr" attribute to node, if ptr is null or if ptr is pointer on object, which is already saved in...
Definition: TBufferXML.cxx:521
void WriteLong(Long_t l) final
Writes Long_t value to buffer.
void WriteFastArray(const Bool_t *b, Int_t n) final
Write array of Bool_t to buffer.
void SetXML(TXMLEngine *xml)
Definition: TBufferXML.h:230
Int_t GetCompressionSettings() const
Definition: TBufferXML.h:349
TXMLStackObj * PushStack(XMLNodePointer_t current, Bool_t simple=kFALSE)
Add new level to xml stack.
Definition: TBufferXML.cxx:297
Bool_t VerifyAttr(XMLNodePointer_t node, const char *name, const char *value, const char *errinfo=nullptr)
Checks, that attribute of specified name exists and has specified value.
Definition: TBufferXML.cxx:646
void WorkWithClass(TStreamerInfo *info, const TClass *cl=nullptr)
Prepares buffer to stream data of specified class.
Definition: TBufferXML.cxx:861
Bool_t VerifyStackNode(const char *name, const char *errinfo=nullptr)
Check, if stack node has specified name.
Definition: TBufferXML.cxx:638
Int_t GetCompressionAlgorithm() const
Definition: TBufferXML.h:337
void ReadUShort(UShort_t &s) final
Reads UShort_t value from buffer.
void ReadUInt(UInt_t &i) final
Reads UInt_t value from buffer.
Int_t fCompressLevel
! Compression level and algorithm
Definition: TBufferXML.h:330
void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Used to specify the compression level and algorithm.
Definition: TBufferXML.cxx:380
TString fValueBuf
! Current value buffer
Definition: TBufferXML.h:326
void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass=nullptr) final
Stream object to/from buffer.
Int_t GetCompressionLevel() const
Definition: TBufferXML.h:343
void WriteStdString(const std::string *s) final
Writes a std::string.
void ReadDouble(Double_t &d) final
Reads Double_t value from buffer.
TBufferXML(TBuffer::EMode mode)
Creates buffer object to serialize/deserialize data to/from xml.
Definition: TBufferXML.cxx:58
Bool_t VerifyNode(XMLNodePointer_t node, const char *name, const char *errinfo=nullptr)
Check if node has specified name.
Definition: TBufferXML.cxx:620
void ReadFastArrayString(Char_t *c, Int_t n) final
Read array of n characters from the I/O buffer.
void WriteLong64(Long64_t l) final
Writes Long64_t value to buffer.
void WriteChar(Char_t c) final
Writes Char_t value to buffer.
TXMLEngine * fXML
! instance of TXMLEngine for working with XML structures
Definition: TBufferXML.h:323
std::deque< std::unique_ptr< TXMLStackObj > > fStack
! Stack of processed objects
Definition: TBufferXML.h:324
static TString ConvertToXML(const TObject *obj, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Converts object, inherited from TObject class, to XML string GenericLayout defines layout choice for ...
Definition: TBufferXML.cxx:104
void WriteFloat(Float_t f) final
Writes Float_t value to buffer.
void ReadTString(TString &s) final
Reads a TString.
void WriteTString(const TString &s) final
Writes a TString.
void IncrementLevel(TVirtualStreamerInfo *) final
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and indent new level in xm...
Definition: TBufferXML.cxx:853
void SetIOVersion(Int_t v)
Definition: TBufferXML.h:67
void WriteArray(const Bool_t *b, Int_t n) final
Write array of Bool_t to buffer.
XMLNodePointer_t XmlWriteAny(const void *obj, const TClass *cl)
Convert object of any class to xml structures Return pointer on top xml element.
Definition: TBufferXML.cxx:227
void XmlReadBasic(Char_t &value)
Reads string from current xml node and convert it to Char_t value.
void ReadULong(ULong_t &l) final
Reads ULong_t value from buffer.
Int_t GetIOVersion() const
Definition: TBufferXML.h:66
R__ALWAYS_INLINE void XmlWriteArrayContent(const T *arr, Int_t arrsize)
XMLNodePointer_t XmlWriteValue(const char *value, const char *name)
Create xml node with specified name and adds it to stack node.
void SkipObjectAny() final
Skip any kind of object from buffer Actually skip only one node on current level of xml structure.
Bool_t VerifyStackAttr(const char *name, const char *value, const char *errinfo=nullptr)
Checks stack attribute.
Definition: TBufferXML.cxx:665
void ReadFloat(Float_t &f) final
Reads Float_t value from buffer.
void ReadULong64(ULong64_t &l) final
Reads ULong64_t value from buffer.
XMLNodePointer_t XmlWriteBasic(Char_t value)
Converts Char_t to string and add xml node to buffer.
void ShiftStack(const char *info=nullptr)
Shift stack node to next.
Definition: TBufferXML.cxx:330
void PerformPreProcessing(const TStreamerElement *elem, XMLNodePointer_t elemnode)
Function is unpack TObject and TString structures to be able read them from custom streamers of this ...
void WriteFastArrayString(const Char_t *c, Int_t n) final
Write array of n characters into the I/O buffer.
void ReadShort(Short_t &s) final
Reads Short_t value from buffer.
void BeforeIOoperation()
Function is called before any IO operation of TBuffer Now is used to store version value if no proper...
TClass * ReadClass(const TClass *cl=nullptr, UInt_t *objTag=nullptr) final
Function to read class from buffer, used in old-style streamers.
Int_t fErrorFlag
! Error flag
Definition: TBufferXML.h:327
void ReadChar(Char_t &c) final
Reads Char_t value from buffer.
R__ALWAYS_INLINE void XmlReadArrayContent(T *arr, Int_t arrsize)
Template method to read array content.
void ClassEnd(const TClass *) final
Should be called at the end of custom streamer See TBufferXML::ClassBegin for more details.
void ReadLong64(Long64_t &l) final
Reads Long64_t value from buffer.
Version_t fVersionBuf
! Current version buffer
Definition: TBufferXML.h:325
void ClassBegin(const TClass *, Version_t=-1) final
Should be called at the beginning of custom class streamer.
void XmlReadBlock(XMLNodePointer_t node)
Read binary block of data from xml.
Definition: TBufferXML.cxx:450
void * XmlReadObject(void *obj, TClass **cl=nullptr)
Read object from the buffer.
Definition: TBufferXML.cxx:786
void ReadCharP(Char_t *c) final
Reads array of characters from buffer.
Bool_t fCanUseCompact
! Flag indicate that basic type (like Int_t) can be placed in the same tag
Definition: TBufferXML.h:328
R__ALWAYS_INLINE void XmlWriteArray(const T *arr, Int_t arrsize)
Write array, including it size Content may be compressed.
void ReadStdString(std::string *s) final
Reads a std::string.
void ReadBool(Bool_t &b) final
Reads Bool_t value from buffer.
void WriteUShort(UShort_t s) final
Writes UShort_t value to buffer.
void WriteClass(const TClass *cl) final
Function to write class into buffer, used in old-style streamers.
void WriteCharStar(char *s) final
Write a char* string.
const char * XmlReadValue(const char *name)
read string value from current stack node
Bool_t ExtractPointer(XMLNodePointer_t node, void *&ptr, TClass *&cl)
Searches for "ptr" attribute and returns pointer to object and class, if "ptr" attribute reference to...
Definition: TBufferXML.cxx:558
void ReadFastArray(Bool_t *b, Int_t n) final
Read array of Bool_t from buffer.
void DecrementLevel(TVirtualStreamerInfo *) final
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and decrease level in xml ...
Definition: TBufferXML.cxx:927
R__ALWAYS_INLINE void XmlWriteFastArray(const T *arr, Int_t n)
Write array without size attribute Also treat situation, when instead of one single array chain of se...
void PerformPostProcessing()
Function is converts TObject and TString structures to more compact representation.
void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type) final
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and add/verify next elemen...
Definition: TBufferXML.cxx:959
void WriteCharP(const Char_t *c) final
Writes array of characters to buffer.
static TObject * ConvertFromXML(const char *str, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Read object from XML, produced by ConvertToXML() method.
Definition: TBufferXML.cxx:153
void ClassMember(const char *name, const char *typeName=nullptr, Int_t arrsize1=-1, Int_t arrsize2=-1) final
Method indicates name and typename of class member, which should be now streamed in custom streamer.
Int_t ReadStaticArray(Bool_t *b) final
Read array of Bool_t from buffer.
void * XmlReadAny(XMLNodePointer_t node, void *obj, TClass **cl)
Recreate object from xml structure.
Definition: TBufferXML.cxx:244
XMLNodePointer_t StackNode()
Return pointer on current xml node.
Definition: TBufferXML.cxx:321
void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse) final
Write object to buffer. Only used from TBuffer.
Int_t fIOVersion
! Indicates format of ROOT xml file
Definition: TBufferXML.h:331
R__ALWAYS_INLINE void XmlReadFastArray(T *arr, Int_t n)
Template method to read content of array, which not include size of array Also treated situation,...
Bool_t VerifyItemNode(const char *name, const char *errinfo=nullptr)
Checks, if stack node is item and has specified name.
Definition: TBufferXML.cxx:687
static void * ConvertFromXMLChecked(const char *xml, const TClass *expectedClass, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Convert from XML and check if object derived from specified class When possible, cast to given class.
Definition: TBufferXML.cxx:200
void * ReadObjectAny(const TClass *clCast) final
Read object from buffer. Only used from TBuffer.
void ReadLong(Long_t &l) final
Reads Long_t value from buffer.
void ExtractReference(XMLNodePointer_t node, const void *ptr, const TClass *cl)
Analyze if node has "ref" attribute and register it to object map.
Definition: TBufferXML.cxx:594
void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
See comments for function SetCompressionSettings.
Definition: TBufferXML.cxx:358
Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr) final
Read version value from buffer.
void ReadInt(Int_t &i) final
Reads Int_t value from buffer.
ClassDefOverride(TBufferXML, 0)
Int_t ReadArray(Bool_t *&b) final
Read array of Bool_t from buffer.
void SetCompressionAlgorithm(Int_t algorithm=ROOT::RCompressionSetting::EAlgorithm::kUseGlobal)
See comments for function SetCompressionSettings.
Definition: TBufferXML.cxx:343
void WriteDouble(Double_t d) final
Writes Double_t value to buffer.
void CheckVersionBuf()
Checks buffer, filled by WriteVersion if next data is arriving, version should be stored in buffer.
XMLNodePointer_t XmlWriteObject(const void *obj, const TClass *objClass, Bool_t cacheReuse)
Write object to buffer If object was written before, only pointer will be stored Return pointer to to...
Definition: TBufferXML.cxx:754
TXMLFile * XmlFile()
Returns pointer to TXMLFile object.
Definition: TBufferXML.cxx:93
TVirtualStreamerInfo * GetInfo() final
Return current streamer info element.
void WriteUInt(UInt_t i) final
Writes UInt_t value to buffer.
void WorkWithElement(TStreamerElement *elem, Int_t comp_type)
This function is a part of SetStreamerElementNumber method.
Definition: TBufferXML.cxx:970
virtual ~TBufferXML()
Destroy xml buffer.
Definition: TBufferXML.cxx:85
void WriteBool(Bool_t b) final
Writes Bool_t value to buffer.
void XmlWriteBlock(XMLNodePointer_t node)
Write binary data block from buffer to xml.
Definition: TBufferXML.cxx:389
TClass * fExpectedBaseClass
! Pointer to class, which should be stored as parent of current
Definition: TBufferXML.h:329
static TString ToXML(const T *obj, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Definition: TBufferXML.h:48
void WriteShort(Short_t s) final
Writes Short_t value to buffer.
void WriteULong64(ULong64_t l) final
Writes ULong64_t value to buffer.
TXMLStackObj * Stack(UInt_t depth=0)
Definition: TBufferXML.h:243
XMLNodePointer_t CreateItemNode(const char *name)
Create item node of specified name.
Definition: TBufferXML.cxx:673
void WriteULong(ULong_t l) final
Writes ULong_t value to buffer.
TXMLStackObj * PopStack()
Remove one level from xml stack.
Definition: TBufferXML.cxx:311
void CreateElemNode(const TStreamerElement *elem)
Create xml node correspondent to TStreamerElement object.
Definition: TBufferXML.cxx:700
static void * ConvertFromXMLAny(const char *str, TClass **cl=nullptr, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Read object of any class from XML, produced by ConvertToXML() method.
Definition: TBufferXML.cxx:176
Bool_t VerifyElemNode(const TStreamerElement *elem)
Checks if stack node correspond to TStreamerElement object.
Definition: TBufferXML.cxx:728
R__ALWAYS_INLINE Int_t XmlReadArray(T *&arr, bool is_static=false)
Template method to read array with size attribute If necessary, array is created.
void ReadCharStar(char *&s) final
Read a char* string.
void ReadUChar(UChar_t &c) final
Reads UChar_t value from buffer.
UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE) final
Copies class version to buffer, but not writes it to xml Version will be written with next I/O operat...
void WriteUChar(UChar_t c) final
Writes UChar_t value to buffer.
static Bool_t FromXML(T *&obj, const char *xml, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Definition: TBufferXML.h:58
void WriteInt(Int_t i) final
Writes Int_t value to buffer.
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
An array of TObjects.
Definition: TObjArray.h:37
Mother of all ROOT objects.
Definition: TObject.h:37
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:43
Basic string class.
Definition: TString.h:131
Abstract Interface class describing Streamer information for one class.
const Int_t n
Definition: legend1.C:16
double T(double x)
Definition: ChebyshevPol.h:34
VSD Structures.
Definition: StringConv.hxx:21
static constexpr double s
Definition: file.py:1
auto * l
Definition: textangle.C:4