Logo ROOT   6.18/05
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 "TXMLEngine.h"
19#include "TString.h"
20#include "TObjArray.h"
21#include "TArrayC.h"
22#include "TClonesArray.h"
23
24#include <string>
25#include <deque>
26
27class TExMap;
29class TStreamerInfo;
31class TObjArray;
32class TMemberStreamer;
33class TXMLFile;
34class TXMLStackObj;
35
36class TBufferXML : public TBufferText, public TXMLSetup {
37
38 friend class TKeyXML;
39
40public:
43 virtual ~TBufferXML();
44
45 static TString ConvertToXML(const TObject *obj, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
46 static TString
47 ConvertToXML(const void *obj, const TClass *cl, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
48
49 template <class T>
50 static TString ToXML(const T *obj, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE)
51 {
52 return ConvertToXML(obj, TClass::GetClass<T>(), GenericLayout, UseNamespaces);
53 }
54
55 static TObject *ConvertFromXML(const char *str, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
56 static void *ConvertFromXMLAny(const char *str, TClass **cl = nullptr, Bool_t GenericLayout = kFALSE,
57 Bool_t UseNamespaces = kFALSE);
58
59 template <class T>
60 static Bool_t FromXML(T *&obj, const char *xml, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE)
61 {
62 if (obj)
63 return kFALSE;
64 obj = (T *)ConvertFromXMLChecked(xml, TClass::GetClass<T>(), GenericLayout, UseNamespaces);
65 return obj != nullptr;
66 }
67
68 Int_t GetIOVersion() const { return fIOVersion; }
70
71 // suppress class writing/reading
72
73 virtual TClass *ReadClass(const TClass *cl = nullptr, UInt_t *objTag = nullptr);
74 virtual void WriteClass(const TClass *cl);
75
76 // redefined virtual functions of TBuffer
77
78 virtual Version_t ReadVersion(UInt_t *start = nullptr, UInt_t *bcnt = nullptr, const TClass *cl = nullptr);
79 virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE);
80
81 virtual void *ReadObjectAny(const TClass *clCast);
82 virtual void SkipObjectAny();
83
85 virtual void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type);
87
88 virtual void ClassBegin(const TClass *, Version_t = -1);
89 virtual void ClassEnd(const TClass *);
90 virtual void ClassMember(const char *name, const char *typeName = nullptr, Int_t arrsize1 = -1, Int_t arrsize2 = -1);
91
92 virtual Int_t ReadArray(Bool_t *&b);
93 virtual Int_t ReadArray(Char_t *&c);
94 virtual Int_t ReadArray(UChar_t *&c);
95 virtual Int_t ReadArray(Short_t *&h);
96 virtual Int_t ReadArray(UShort_t *&h);
97 virtual Int_t ReadArray(Int_t *&i);
98 virtual Int_t ReadArray(UInt_t *&i);
99 virtual Int_t ReadArray(Long_t *&l);
100 virtual Int_t ReadArray(ULong_t *&l);
101 virtual Int_t ReadArray(Long64_t *&l);
102 virtual Int_t ReadArray(ULong64_t *&l);
103 virtual Int_t ReadArray(Float_t *&f);
104 virtual Int_t ReadArray(Double_t *&d);
105
106 virtual Int_t ReadStaticArray(Bool_t *b);
107 virtual Int_t ReadStaticArray(Char_t *c);
108 virtual Int_t ReadStaticArray(UChar_t *c);
109 virtual Int_t ReadStaticArray(Short_t *h);
111 virtual Int_t ReadStaticArray(Int_t *i);
112 virtual Int_t ReadStaticArray(UInt_t *i);
113 virtual Int_t ReadStaticArray(Long_t *l);
114 virtual Int_t ReadStaticArray(ULong_t *l);
117 virtual Int_t ReadStaticArray(Float_t *f);
119
120 virtual void ReadFastArray(Bool_t *b, Int_t n);
121 virtual void ReadFastArray(Char_t *c, Int_t n);
122 virtual void ReadFastArray(UChar_t *c, Int_t n);
123 virtual void ReadFastArray(Short_t *h, Int_t n);
124 virtual void ReadFastArray(UShort_t *h, Int_t n);
125 virtual void ReadFastArray(Int_t *i, Int_t n);
126 virtual void ReadFastArray(UInt_t *i, Int_t n);
127 virtual void ReadFastArray(Long_t *l, Int_t n);
128 virtual void ReadFastArray(ULong_t *l, Int_t n);
129 virtual void ReadFastArray(Long64_t *l, Int_t n);
130 virtual void ReadFastArray(ULong64_t *l, Int_t n);
131 virtual void ReadFastArray(Float_t *f, Int_t n);
132 virtual void ReadFastArray(Double_t *d, Int_t n);
133 virtual void ReadFastArrayString(Char_t *c, Int_t n);
134 virtual void ReadFastArray(void *start, const TClass *cl, Int_t n = 1, TMemberStreamer *s = nullptr,
135 const TClass *onFileClass = nullptr);
136 virtual void ReadFastArray(void **startp, const TClass *cl, Int_t n = 1, Bool_t isPreAlloc = kFALSE,
137 TMemberStreamer *s = nullptr, const TClass *onFileClass = nullptr);
138
139 virtual void WriteArray(const Bool_t *b, Int_t n);
140 virtual void WriteArray(const Char_t *c, Int_t n);
141 virtual void WriteArray(const UChar_t *c, Int_t n);
142 virtual void WriteArray(const Short_t *h, Int_t n);
143 virtual void WriteArray(const UShort_t *h, Int_t n);
144 virtual void WriteArray(const Int_t *i, Int_t n);
145 virtual void WriteArray(const UInt_t *i, Int_t n);
146 virtual void WriteArray(const Long_t *l, Int_t n);
147 virtual void WriteArray(const ULong_t *l, Int_t n);
148 virtual void WriteArray(const Long64_t *l, Int_t n);
149 virtual void WriteArray(const ULong64_t *l, Int_t n);
150 virtual void WriteArray(const Float_t *f, Int_t n);
151 virtual void WriteArray(const Double_t *d, Int_t n);
152
153 virtual void WriteFastArray(const Bool_t *b, Int_t n);
154 virtual void WriteFastArray(const Char_t *c, Int_t n);
155 virtual void WriteFastArray(const UChar_t *c, Int_t n);
156 virtual void WriteFastArray(const Short_t *h, Int_t n);
157 virtual void WriteFastArray(const UShort_t *h, Int_t n);
158 virtual void WriteFastArray(const Int_t *i, Int_t n);
159 virtual void WriteFastArray(const UInt_t *i, Int_t n);
160 virtual void WriteFastArray(const Long_t *l, Int_t n);
161 virtual void WriteFastArray(const ULong_t *l, Int_t n);
162 virtual void WriteFastArray(const Long64_t *l, Int_t n);
163 virtual void WriteFastArray(const ULong64_t *l, Int_t n);
164 virtual void WriteFastArray(const Float_t *f, Int_t n);
165 virtual void WriteFastArray(const Double_t *d, Int_t n);
166 virtual void WriteFastArrayString(const Char_t *c, Int_t n);
167 virtual void WriteFastArray(void *start, const TClass *cl, Int_t n = 1, TMemberStreamer *s = nullptr);
168 virtual Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n = 1, Bool_t isPreAlloc = kFALSE,
169 TMemberStreamer *s = nullptr);
170
171 virtual void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass = nullptr);
173
174 virtual void ReadBool(Bool_t &b);
175 virtual void ReadChar(Char_t &c);
176 virtual void ReadUChar(UChar_t &c);
177 virtual void ReadShort(Short_t &s);
178 virtual void ReadUShort(UShort_t &s);
179 virtual void ReadInt(Int_t &i);
180 virtual void ReadUInt(UInt_t &i);
181 virtual void ReadLong(Long_t &l);
182 virtual void ReadULong(ULong_t &l);
183 virtual void ReadLong64(Long64_t &l);
184 virtual void ReadULong64(ULong64_t &l);
185 virtual void ReadFloat(Float_t &f);
186 virtual void ReadDouble(Double_t &d);
187 virtual void ReadCharP(Char_t *c);
188 virtual void ReadTString(TString &s);
189 virtual void ReadStdString(std::string *s);
191 virtual void ReadCharStar(char *&s);
192
193 virtual void WriteBool(Bool_t b);
194 virtual void WriteChar(Char_t c);
195 virtual void WriteUChar(UChar_t c);
196 virtual void WriteShort(Short_t s);
197 virtual void WriteUShort(UShort_t s);
198 virtual void WriteInt(Int_t i);
199 virtual void WriteUInt(UInt_t i);
200 virtual void WriteLong(Long_t l);
201 virtual void WriteULong(ULong_t l);
202 virtual void WriteLong64(Long64_t l);
203 virtual void WriteULong64(ULong64_t l);
204 virtual void WriteFloat(Float_t f);
205 virtual void WriteDouble(Double_t d);
206 virtual void WriteCharP(const Char_t *c);
207 virtual void WriteTString(const TString &s);
208 virtual void WriteStdString(const std::string *s);
210 virtual void WriteCharStar(char *s);
211
212 virtual TVirtualStreamerInfo *GetInfo();
213
214protected:
215 TBufferXML();
216
217 // redefined protected virtual functions
218
219 virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse);
220
221 // end redefined protected virtual functions
222
223 static void *ConvertFromXMLChecked(const char *xml, const TClass *expectedClass, Bool_t GenericLayout = kFALSE,
224 Bool_t UseNamespaces = kFALSE);
225
226 TXMLFile *XmlFile();
227
234 void SetXML(TXMLEngine *xml) { fXML = xml; }
235
237 XMLNodePointer_t XmlWriteAny(const void *obj, const TClass *cl);
238
240 void *XmlReadAny(XMLNodePointer_t node, void *obj, TClass **cl);
241
242 TXMLStackObj *PushStack(XMLNodePointer_t current, Bool_t simple = kFALSE);
243 TXMLStackObj *PopStack();
244 void ShiftStack(const char *info = nullptr);
245
247 TXMLStackObj *Stack(UInt_t depth = 0)
248 {
249 return (depth < fStack.size()) ? (depth ? fStack[fStack.size() - depth - 1] : fStack.back()) : nullptr;
250 }
251
252 void WorkWithClass(TStreamerInfo *info, const TClass *cl = nullptr);
253 void WorkWithElement(TStreamerElement *elem, Int_t comp_type);
254 Bool_t VerifyNode(XMLNodePointer_t node, const char *name, const char *errinfo = nullptr);
255 Bool_t VerifyStackNode(const char *name, const char *errinfo = nullptr);
256
257 Bool_t VerifyAttr(XMLNodePointer_t node, const char *name, const char *value, const char *errinfo = nullptr);
258 Bool_t VerifyStackAttr(const char *name, const char *value, const char *errinfo = nullptr);
259
260 Bool_t ProcessPointer(const void *ptr, XMLNodePointer_t node);
261 Bool_t ExtractPointer(XMLNodePointer_t node, void *&ptr, TClass *&cl);
262 void ExtractReference(XMLNodePointer_t node, const void *ptr, const TClass *cl);
263
265 Bool_t VerifyItemNode(const char *name, const char *errinfo = nullptr);
266
267 void CreateElemNode(const TStreamerElement *elem);
269
270 void PerformPreProcessing(const TStreamerElement *elem, XMLNodePointer_t elemnode);
272
286 XMLNodePointer_t XmlWriteValue(const char *value, const char *name);
287
288 void XmlReadBasic(Char_t &value);
289 void XmlReadBasic(Short_t &value);
290 void XmlReadBasic(Int_t &value);
291 void XmlReadBasic(Long_t &value);
292 void XmlReadBasic(Long64_t &value);
293 void XmlReadBasic(Float_t &value);
294 void XmlReadBasic(Double_t &value);
295 void XmlReadBasic(Bool_t &value);
296 void XmlReadBasic(UChar_t &value);
297 void XmlReadBasic(UShort_t &value);
298 void XmlReadBasic(UInt_t &value);
299 void XmlReadBasic(ULong_t &value);
300 void XmlReadBasic(ULong64_t &value);
301 const char *XmlReadValue(const char *name);
302
303 template <typename T>
304 R__ALWAYS_INLINE void XmlReadArrayContent(T *arr, Int_t arrsize);
305
306 template <typename T>
307 R__ALWAYS_INLINE Int_t XmlReadArray(T *&arr, bool is_static = false);
308
309 template <typename T>
311
312 template <typename T>
313 R__ALWAYS_INLINE void XmlWriteArrayContent(const T *arr, Int_t arrsize);
314
315 template <typename T>
316 R__ALWAYS_INLINE void XmlWriteArray(const T *arr, Int_t arrsize);
317
318 template <typename T>
319 R__ALWAYS_INLINE void XmlWriteFastArray(const T *arr, Int_t n);
320
321 XMLNodePointer_t XmlWriteObject(const void *obj, const TClass *objClass, Bool_t cacheReuse);
322 void *XmlReadObject(void *obj, TClass **cl = nullptr);
323
324 void BeforeIOoperation();
325 void CheckVersionBuf();
326
327 TXMLEngine *fXML; ///<! instance of TXMLEngine for working with XML structures
328 std::deque<TXMLStackObj *> fStack; ///<! Stack of processed objects
329 Version_t fVersionBuf; ///<! Current version buffer
330 TString fValueBuf; ///<! Current value buffer
331 Int_t fErrorFlag; ///<! Error flag
332 Bool_t fCanUseCompact; ///<! Flag indicate that basic type (like Int_t) can be placed in the same tag
333 TClass *fExpectedBaseClass; ///<! Pointer to class, which should be stored as parent of current
334 Int_t fCompressLevel; ///<! Compression level and algorithm
335 Int_t fIOVersion; ///<! Indicates format of ROOT xml file
336
337 ClassDef(TBufferXML, 0); // a specialized TBuffer to read/write to XML files
338};
339
340//______________________________________________________________________________
342{
343 return (fCompressLevel < 0) ? -1 : fCompressLevel / 100;
344}
345
346//______________________________________________________________________________
348{
349 return (fCompressLevel < 0) ? -1 : fCompressLevel % 100;
350}
351
352//______________________________________________________________________________
354{
355 return (fCompressLevel < 0) ? -1 : fCompressLevel;
356}
357
358#endif
SVector< double, 2 > v
Definition: Dict.h:5
#define R__ALWAYS_INLINE
Definition: RConfig.hxx:570
#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
#define ClassDef(name, id)
Definition: Rtypes.h:326
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
virtual void StreamObject(void *obj, const std::type_info &typeinfo, const TClass *onFileClass=nullptr)
stream object to/from buffer
Class for serializing/deserializing object to/from xml.
Definition: TBufferXML.h:36
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:541
virtual void ReadDouble(Double_t &d)
Reads Double_t value from buffer.
virtual void ReadUChar(UChar_t &c)
Reads UChar_t value from buffer.
virtual Int_t ReadStaticArray(Bool_t *b)
Read array of Bool_t from buffer.
void SetXML(TXMLEngine *xml)
Definition: TBufferXML.h:234
virtual void WriteDouble(Double_t d)
Writes Double_t value to buffer.
Int_t GetCompressionSettings() const
Definition: TBufferXML.h:353
TXMLStackObj * PushStack(XMLNodePointer_t current, Bool_t simple=kFALSE)
Add new level to xml stack.
Definition: TBufferXML.cxx:314
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:666
void WorkWithClass(TStreamerInfo *info, const TClass *cl=nullptr)
Prepares buffer to stream data of specified class.
Definition: TBufferXML.cxx:881
Bool_t VerifyStackNode(const char *name, const char *errinfo=nullptr)
Check, if stack node has specified name.
Definition: TBufferXML.cxx:658
Int_t GetCompressionAlgorithm() const
Definition: TBufferXML.h:341
virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse)
Write object to buffer. Only used from TBuffer.
Int_t fCompressLevel
! Compression level and algorithm
Definition: TBufferXML.h:334
virtual void ReadCharStar(char *&s)
Read a char* string.
TString fValueBuf
! Current value buffer
Definition: TBufferXML.h:330
Int_t GetCompressionLevel() const
Definition: TBufferXML.h:347
virtual void WriteULong64(ULong64_t l)
Writes ULong64_t value to buffer.
Bool_t VerifyNode(XMLNodePointer_t node, const char *name, const char *errinfo=nullptr)
Check if node has specified name.
Definition: TBufferXML.cxx:640
virtual void ReadChar(Char_t &c)
Reads Char_t value from buffer.
virtual void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and add/verify next elemen...
Definition: TBufferXML.cxx:979
TXMLEngine * fXML
! instance of TXMLEngine for working with XML structures
Definition: TBufferXML.h:327
virtual void ReadFastArray(Bool_t *b, Int_t n)
Read array of Bool_t from buffer.
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:119
virtual void ClassEnd(const TClass *)
Should be called at the end of custom streamer See TBufferXML::ClassBegin for more details.
virtual Int_t ReadArray(Bool_t *&b)
Read array of Bool_t from buffer.
void SetIOVersion(Int_t v)
Definition: TBufferXML.h:69
virtual void WriteShort(Short_t s)
Writes Short_t value 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:242
void XmlReadBasic(Char_t &value)
Reads string from current xml node and convert it to Char_t value.
Int_t GetIOVersion() const
Definition: TBufferXML.h:68
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.
virtual void ReadFastArrayString(Char_t *c, Int_t n)
Read array of n characters from the I/O buffer.
std::deque< TXMLStackObj * > fStack
! Stack of processed objects
Definition: TBufferXML.h:328
virtual void ReadULong64(ULong64_t &l)
Reads ULong64_t value from buffer.
virtual void WriteLong(Long_t l)
Writes Long_t value to buffer.
Bool_t VerifyStackAttr(const char *name, const char *value, const char *errinfo=nullptr)
Checks stack attribute.
Definition: TBufferXML.cxx:685
virtual void WriteLong64(Long64_t l)
Writes Long64_t value to buffer.
virtual void WriteChar(Char_t c)
Writes Char_t value to buffer.
virtual void ReadShort(Short_t &s)
Reads Short_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:350
virtual void ReadCharP(Char_t *c)
Reads array of characters from buffer.
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 ...
virtual void SkipObjectAny()
Skip any kind of object from buffer Actually skip only one node on current level of xml structure.
void BeforeIOoperation()
Function is called before any IO operation of TBuffer Now is used to store version value if no proper...
Int_t fErrorFlag
! Error flag
Definition: TBufferXML.h:331
virtual void ReadInt(Int_t &i)
Reads Int_t value from buffer.
R__ALWAYS_INLINE void XmlReadArrayContent(T *arr, Int_t arrsize)
Template method to read array content.
virtual void * ReadObjectAny(const TClass *clCast)
Read object from buffer. Only used from TBuffer.
virtual void ReadLong64(Long64_t &l)
Reads Long64_t value from buffer.
virtual void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass=nullptr)
Stream object to/from buffer.
virtual void ReadLong(Long_t &l)
Reads Long_t value from buffer.
virtual void WriteULong(ULong_t l)
Writes ULong_t value to buffer.
Version_t fVersionBuf
! Current version buffer
Definition: TBufferXML.h:329
virtual void ReadTString(TString &s)
Reads a TString.
void XmlReadBlock(XMLNodePointer_t node)
Read binary block of data from xml.
Definition: TBufferXML.cxx:470
void * XmlReadObject(void *obj, TClass **cl=nullptr)
Read object from the buffer.
Definition: TBufferXML.cxx:806
Bool_t fCanUseCompact
! Flag indicate that basic type (like Int_t) can be placed in the same tag
Definition: TBufferXML.h:332
R__ALWAYS_INLINE void XmlWriteArray(const T *arr, Int_t arrsize)
Write array, including it size Content may be compressed.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)
Copies class version to buffer, but not writes it to xml Version will be written with next I/O operat...
virtual void WriteBool(Bool_t b)
Writes Bool_t value to buffer.
virtual TClass * ReadClass(const TClass *cl=nullptr, UInt_t *objTag=nullptr)
Function to read class from buffer, used in old-style streamers.
virtual void WriteCharStar(char *s)
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:578
virtual void WriteStdString(const std::string *s)
Writes a std::string.
virtual void ReadUShort(UShort_t &s)
Reads UShort_t value from buffer.
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...
virtual void ReadUInt(UInt_t &i)
Reads UInt_t value from buffer.
virtual void WriteFastArray(const Bool_t *b, Int_t n)
Write array of Bool_t to buffer.
void PerformPostProcessing()
Function is converts TObject and TString structures to more compact representation.
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:168
virtual void DecrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and decrease level in xml ...
Definition: TBufferXML.cxx:947
void * XmlReadAny(XMLNodePointer_t node, void *obj, TClass **cl)
Recreate object from xml structure.
Definition: TBufferXML.cxx:259
virtual void ClassMember(const char *name, const char *typeName=nullptr, Int_t arrsize1=-1, Int_t arrsize2=-1)
Method indicates name and typename of class member, which should be now streamed in custom streamer.
XMLNodePointer_t StackNode()
Return pointer on current xml node.
Definition: TBufferXML.cxx:341
Int_t fIOVersion
! Indicates format of ROOT xml file
Definition: TBufferXML.h:335
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:707
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:215
TBufferXML()
Default constructor.
Definition: TBufferXML.cxx:58
virtual void WriteCharP(const Char_t *c)
Writes array of characters to buffer.
virtual void ReadULong(ULong_t &l)
Reads ULong_t value from buffer.
virtual void ClassBegin(const TClass *, Version_t=-1)
Should be called at the beginning of custom class streamer.
virtual void WriteTString(const TString &s)
Writes a TString.
virtual void ReadBool(Bool_t &b)
Reads Bool_t value from buffer.
virtual void WriteInt(Int_t i)
Writes Int_t value to buffer.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)
Read version 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:614
void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose)
Used to specify the compression level and algorithm.
Definition: TBufferXML.cxx:400
virtual void WriteFloat(Float_t f)
Writes Float_t value to buffer.
void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
See comments for function SetCompressionSettings.
Definition: TBufferXML.cxx:378
virtual void WriteArray(const Bool_t *b, Int_t n)
Write array of Bool_t to buffer.
void SetCompressionAlgorithm(Int_t algorithm=ROOT::RCompressionSetting::EAlgorithm::kUseGlobal)
See comments for function SetCompressionSettings.
Definition: TBufferXML.cxx:363
virtual void WriteFastArrayString(const Char_t *c, Int_t n)
Write array of n characters into the I/O buffer.
virtual void WriteUChar(UChar_t c)
Writes UChar_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:774
TXMLFile * XmlFile()
Returns pointer to TXMLFile object.
Definition: TBufferXML.cxx:108
void WorkWithElement(TStreamerElement *elem, Int_t comp_type)
This function is a part of SetStreamerElementNumber method.
Definition: TBufferXML.cxx:990
virtual void IncrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and indent new level in xm...
Definition: TBufferXML.cxx:873
virtual ~TBufferXML()
Destroy xml buffer.
Definition: TBufferXML.cxx:98
virtual void WriteUShort(UShort_t s)
Writes UShort_t value to buffer.
virtual TVirtualStreamerInfo * GetInfo()
Return current streamer info element.
void XmlWriteBlock(XMLNodePointer_t node)
Write binary data block from buffer to xml.
Definition: TBufferXML.cxx:409
TClass * fExpectedBaseClass
! Pointer to class, which should be stored as parent of current
Definition: TBufferXML.h:333
static TString ToXML(const T *obj, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Definition: TBufferXML.h:50
TXMLStackObj * Stack(UInt_t depth=0)
Definition: TBufferXML.h:247
virtual void WriteUInt(UInt_t i)
Writes UInt_t value to buffer.
XMLNodePointer_t CreateItemNode(const char *name)
Create item node of specified name.
Definition: TBufferXML.cxx:693
virtual void ReadFloat(Float_t &f)
Reads Float_t value from buffer.
TXMLStackObj * PopStack()
Remove one level from xml stack.
Definition: TBufferXML.cxx:329
void CreateElemNode(const TStreamerElement *elem)
Create xml node correspondent to TStreamerElement object.
Definition: TBufferXML.cxx:720
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:191
Bool_t VerifyElemNode(const TStreamerElement *elem)
Checks if stack node correspond to TStreamerElement object.
Definition: TBufferXML.cxx:748
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.
virtual void ReadStdString(std::string *s)
Reads a std::string.
virtual void WriteClass(const TClass *cl)
Function to write class into buffer, used in old-style streamers.
static Bool_t FromXML(T *&obj, const char *xml, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Definition: TBufferXML.h:60
virtual void WriteStdString(const std::string *s)=0
virtual void ReadStdString(std::string *s)=0
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
static constexpr double s
Definition: file.py:1
@ kUseGlobal
Use the global compression algorithm.
Definition: Compression.h:81
@ kUseGeneralPurpose
Use the recommended general-purpose setting; moderate read / write speed and compression ratio.
Definition: Compression.h:53
auto * l
Definition: textangle.C:4