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