ROOT  6.06/09
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 #ifndef ROOT_TBufferFile
16 #include "TBufferFile.h"
17 #endif
18 #ifndef ROOT_TXMLSetup
19 #include "TXMLSetup.h"
20 #endif
21 #ifndef ROOT_TXMLEngine
22 #include "TXMLEngine.h"
23 #endif
24 #ifndef ROOT_TString
25 #include "TString.h"
26 #endif
27 #ifndef ROOT_TObjArray
28 #include "TObjArray.h"
29 #endif
30 
31 #include <string>
32 
33 
34 class TExMap;
36 class TStreamerInfo;
37 class TStreamerElement;
38 class TObjArray;
39 class TMemberStreamer;
40 class TXMLFile;
41 class TXMLStackObj;
42 
43 
44 class TBufferXML : public TBufferFile, public TXMLSetup {
45 
46 friend class TKeyXML;
47 
48 public:
49 
51  TBufferXML(TBuffer::EMode mode, TXMLFile* file);
52  virtual ~TBufferXML();
53 
54  static TString ConvertToXML(const TObject* obj, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
55  static TString ConvertToXML(const void* obj, const TClass* cl, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
56 
57  static TObject* ConvertFromXML(const char* str, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
58  static void* ConvertFromXMLAny(const char* str, TClass** cl = 0, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
59 
60  Int_t GetIOVersion() const { return fIOVersion; }
62 
63  // suppress class writing/reading
64 
65  virtual TClass* ReadClass(const TClass* cl = 0, UInt_t* objTag = 0);
66  virtual void WriteClass(const TClass* cl);
67 
68  // redefined virtual functions of TBuffer
69 
70  virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss); // SL
71  virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const char *classname); // SL
72  virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion = kFALSE); // SL
73 
74  virtual void SkipVersion(const TClass *cl = 0);
75  virtual Version_t ReadVersion(UInt_t *start = 0, UInt_t *bcnt = 0, const TClass *cl = 0); // SL
76  virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE); // SL
77 
78  virtual void* ReadObjectAny(const TClass* clCast);
79  virtual void SkipObjectAny();
80 
81  virtual void IncrementLevel(TVirtualStreamerInfo*);
82  virtual void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type);
83  virtual void DecrementLevel(TVirtualStreamerInfo*);
84 
85  virtual void ClassBegin(const TClass*, Version_t = -1);
86  virtual void ClassEnd(const TClass*);
87  virtual void ClassMember(const char* name, const char* typeName = 0, Int_t arrsize1 = -1, Int_t arrsize2 = -1);
88 
89  virtual void WriteObject(const TObject *obj);
90 
91  virtual void ReadFloat16 (Float_t *f, TStreamerElement *ele=0);
92  virtual void WriteFloat16(Float_t *f, TStreamerElement *ele=0);
93  virtual void ReadDouble32 (Double_t *d, TStreamerElement *ele=0);
94  virtual void WriteDouble32(Double_t *d, TStreamerElement *ele=0);
95  virtual void ReadWithFactor(Float_t *ptr, Double_t factor, Double_t minvalue);
96  virtual void ReadWithNbits(Float_t *ptr, Int_t nbits);
97  virtual void ReadWithFactor(Double_t *ptr, Double_t factor, Double_t minvalue);
98  virtual void ReadWithNbits(Double_t *ptr, Int_t nbits);
99 
100  virtual Int_t ReadArray(Bool_t *&b);
101  virtual Int_t ReadArray(Char_t *&c);
102  virtual Int_t ReadArray(UChar_t *&c);
103  virtual Int_t ReadArray(Short_t *&h);
104  virtual Int_t ReadArray(UShort_t *&h);
105  virtual Int_t ReadArray(Int_t *&i);
106  virtual Int_t ReadArray(UInt_t *&i);
107  virtual Int_t ReadArray(Long_t *&l);
108  virtual Int_t ReadArray(ULong_t *&l);
109  virtual Int_t ReadArray(Long64_t *&l);
110  virtual Int_t ReadArray(ULong64_t *&l);
111  virtual Int_t ReadArray(Float_t *&f);
112  virtual Int_t ReadArray(Double_t *&d);
113  virtual Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele=0);
114  virtual Int_t ReadArrayDouble32(Double_t *&d, TStreamerElement *ele=0);
115 
116  virtual Int_t ReadStaticArray(Bool_t *b);
117  virtual Int_t ReadStaticArray(Char_t *c);
118  virtual Int_t ReadStaticArray(UChar_t *c);
119  virtual Int_t ReadStaticArray(Short_t *h);
120  virtual Int_t ReadStaticArray(UShort_t *h);
121  virtual Int_t ReadStaticArray(Int_t *i);
122  virtual Int_t ReadStaticArray(UInt_t *i);
123  virtual Int_t ReadStaticArray(Long_t *l);
124  virtual Int_t ReadStaticArray(ULong_t *l);
125  virtual Int_t ReadStaticArray(Long64_t *l);
126  virtual Int_t ReadStaticArray(ULong64_t *l);
127  virtual Int_t ReadStaticArray(Float_t *f);
128  virtual Int_t ReadStaticArray(Double_t *d);
131 
132  virtual void ReadFastArray(Bool_t *b, Int_t n);
133  virtual void ReadFastArray(Char_t *c, Int_t n);
134  virtual void ReadFastArray(UChar_t *c, Int_t n);
135  virtual void ReadFastArray(Short_t *h, Int_t n);
136  virtual void ReadFastArray(UShort_t *h, Int_t n);
137  virtual void ReadFastArray(Int_t *i, Int_t n);
138  virtual void ReadFastArray(UInt_t *i, Int_t n);
139  virtual void ReadFastArray(Long_t *l, Int_t n);
140  virtual void ReadFastArray(ULong_t *l, Int_t n);
141  virtual void ReadFastArray(Long64_t *l, Int_t n);
142  virtual void ReadFastArray(ULong64_t *l, Int_t n);
143  virtual void ReadFastArray(Float_t *f, Int_t n);
144  virtual void ReadFastArray(Double_t *d, Int_t n);
145  virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0);
146  virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0);
147  virtual void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) ;
148  virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits);
149  virtual void ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue);
150  virtual void ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits) ;
151 
152  virtual void WriteArray(const Bool_t *b, Int_t n);
153  virtual void WriteArray(const Char_t *c, Int_t n);
154  virtual void WriteArray(const UChar_t *c, Int_t n);
155  virtual void WriteArray(const Short_t *h, Int_t n);
156  virtual void WriteArray(const UShort_t *h, Int_t n);
157  virtual void WriteArray(const Int_t *i, Int_t n);
158  virtual void WriteArray(const UInt_t *i, Int_t n);
159  virtual void WriteArray(const Long_t *l, Int_t n);
160  virtual void WriteArray(const ULong_t *l, Int_t n);
161  virtual void WriteArray(const Long64_t *l, Int_t n);
162  virtual void WriteArray(const ULong64_t *l, Int_t n);
163  virtual void WriteArray(const Float_t *f, Int_t n);
164  virtual void WriteArray(const Double_t *d, Int_t n);
165  virtual void WriteArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0);
166  virtual void WriteArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0);
167  virtual void ReadFastArray(void *start , const TClass *cl, Int_t n=1, TMemberStreamer *s=0, const TClass* onFileClass = 0);
168  virtual void ReadFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0, const TClass* onFileClass = 0);
169 
170  virtual void WriteFastArray(const Bool_t *b, Int_t n);
171  virtual void WriteFastArray(const Char_t *c, Int_t n);
172  virtual void WriteFastArray(const UChar_t *c, Int_t n);
173  virtual void WriteFastArray(const Short_t *h, Int_t n);
174  virtual void WriteFastArray(const UShort_t *h, Int_t n);
175  virtual void WriteFastArray(const Int_t *i, Int_t n);
176  virtual void WriteFastArray(const UInt_t *i, Int_t n);
177  virtual void WriteFastArray(const Long_t *l, Int_t n);
178  virtual void WriteFastArray(const ULong_t *l, Int_t n);
179  virtual void WriteFastArray(const Long64_t *l, Int_t n);
180  virtual void WriteFastArray(const ULong64_t *l, Int_t n);
181  virtual void WriteFastArray(const Float_t *f, Int_t n);
182  virtual void WriteFastArray(const Double_t *d, Int_t n);
183  virtual void WriteFastArrayFloat16(const Float_t *d, Int_t n, TStreamerElement *ele=0);
184  virtual void WriteFastArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0);
185  virtual void WriteFastArray(void *start, const TClass *cl, Int_t n=1, TMemberStreamer *s=0);
186  virtual Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0);
187 
188  virtual void StreamObject(void *obj, const type_info &typeinfo, const TClass* onFileClass = 0);
189  virtual void StreamObject(void *obj, const char *className, const TClass* onFileClass = 0 );
190  virtual void StreamObject(void *obj, const TClass *cl, const TClass* onFileClass = 0 );
191  virtual void StreamObject(TObject *obj);
192 
193  virtual void ReadBool(Bool_t &b);
194  virtual void ReadChar(Char_t &c);
195  virtual void ReadUChar(UChar_t &c);
196  virtual void ReadShort(Short_t &s);
197  virtual void ReadUShort(UShort_t &s);
198  virtual void ReadInt(Int_t &i);
199  virtual void ReadUInt(UInt_t &i);
200  virtual void ReadLong(Long_t &l);
201  virtual void ReadULong(ULong_t &l);
202  virtual void ReadLong64(Long64_t &l);
203  virtual void ReadULong64(ULong64_t &l);
204  virtual void ReadFloat(Float_t &f);
205  virtual void ReadDouble(Double_t &d);
206  virtual void ReadCharP(Char_t *c);
207  virtual void ReadTString(TString &s);
208  virtual void ReadStdString(std::string &s);
209 
210  virtual void WriteBool(Bool_t b);
211  virtual void WriteChar(Char_t c);
212  virtual void WriteUChar(UChar_t c);
213  virtual void WriteShort(Short_t s);
214  virtual void WriteUShort(UShort_t s);
215  virtual void WriteInt(Int_t i);
216  virtual void WriteUInt(UInt_t i);
217  virtual void WriteLong(Long_t l);
218  virtual void WriteULong(ULong_t l);
219  virtual void WriteLong64(Long64_t l);
220  virtual void WriteULong64(ULong64_t l);
221  virtual void WriteFloat(Float_t f);
222  virtual void WriteDouble(Double_t d);
223  virtual void WriteCharP(const Char_t *c);
224  virtual void WriteTString(const TString &s);
225  virtual void WriteStdString(const std::string &s);
226 
227  virtual Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object);
228  virtual Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
229  virtual Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
230 
231  // end of redefined virtual functions
232 
233  static void SetFloatFormat(const char* fmt = "%e");
234  static const char* GetFloatFormat();
235 
236 
237 protected:
238  TBufferXML();
239 
240  // redefined protected virtual functions
241 
242  virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass);
243 
244  // end redefined protected virtual functions
245 
246  TXMLFile* XmlFile();
247 
249  Int_t GetCompressionLevel() const;
251  void SetCompressionAlgorithm(Int_t algorithm=0);
252  void SetCompressionLevel(Int_t level=1);
253  void SetCompressionSettings(Int_t settings=1);
254  void SetXML(TXMLEngine* xml) { fXML = xml; }
255 
256  void XmlWriteBlock(XMLNodePointer_t node);
257  XMLNodePointer_t XmlWriteAny(const void* obj, const TClass* cl);
258 
259  void XmlReadBlock(XMLNodePointer_t node);
260  void* XmlReadAny(XMLNodePointer_t node, void* obj, TClass** cl);
261 
262  TXMLStackObj* PushStack(XMLNodePointer_t current, Bool_t simple = kFALSE);
263  TXMLStackObj* PopStack();
264  void ShiftStack(const char* info = 0);
265 
267  TXMLStackObj* Stack(Int_t depth = 0);
268 
269  void WorkWithClass(TStreamerInfo* info, const TClass* cl = 0);
270  void WorkWithElement(TStreamerElement* elem, Int_t comp_type);
271  Bool_t VerifyNode(XMLNodePointer_t node, const char* name, const char* errinfo = 0);
272  Bool_t VerifyStackNode(const char* name, const char* errinfo = 0);
273 
274  Bool_t VerifyAttr(XMLNodePointer_t node, const char* name, const char* value, const char* errinfo = 0);
275  Bool_t VerifyStackAttr(const char* name, const char* value, const char* errinfo = 0);
276 
277  Bool_t ProcessPointer(const void* ptr, XMLNodePointer_t node);
278  void RegisterPointer(const void* ptr, XMLNodePointer_t node);
279  Bool_t ExtractPointer(XMLNodePointer_t node, void* &ptr, TClass* &cl);
280  void ExtractReference(XMLNodePointer_t node, const void* ptr, const TClass* cl);
281 
282  XMLNodePointer_t CreateItemNode(const char* name);
283  Bool_t VerifyItemNode(const char* name, const char* errinfo = 0);
284 
285  void CreateElemNode(const TStreamerElement* elem);
287 
288  void PerformPreProcessing(const TStreamerElement* elem, XMLNodePointer_t elemnode);
289  void PerformPostProcessing();
290 
304  XMLNodePointer_t XmlWriteValue(const char* value, const char* name);
305 
306  void XmlReadBasic(Char_t& value);
307  void XmlReadBasic(Short_t& value);
308  void XmlReadBasic(Int_t& value);
309  void XmlReadBasic(Long_t& value);
310  void XmlReadBasic(Long64_t& value);
311  void XmlReadBasic(Float_t& value);
312  void XmlReadBasic(Double_t& value);
313  void XmlReadBasic(Bool_t& value);
314  void XmlReadBasic(UChar_t& value);
315  void XmlReadBasic(UShort_t& value);
316  void XmlReadBasic(UInt_t& value);
317  void XmlReadBasic(ULong_t& value);
319  const char* XmlReadValue(const char* name);
320 
321  XMLNodePointer_t XmlWriteObject(const void* obj, const TClass* objClass);
322  void* XmlReadObject(void* obj, TClass** cl = 0);
323 
324  void BeforeIOoperation();
325  void CheckVersionBuf();
326 
328 
330 
332 
335 
337 
339 
340  Bool_t fCanUseCompact; ///<! Flag indicate that basic type (like Int_t) can be placed in the same tag
341  Bool_t fExpectedChain; ///<! Flag to resolve situation when several elements of same basic type stored as FastArray
342  TClass* fExpectedBaseClass; ///<! Pointer to class, which should be stored as parent of current
343  Int_t fCompressLevel; ///<! Compression level and algorithm
344  Int_t fIOVersion; ///<! Indicates format of ROOT xml file
345 
346  static std::string fgFloatFmt; ///<! Printf argument for floats and doubles, either "%f" or "%e" or "%10f" and so on
347 
348 ClassDef(TBufferXML,2) //a specialized TBuffer to read/write to XML files
349 };
350 
351 //______________________________________________________________________________
353 {
354  return (fCompressLevel < 0) ? -1 : fCompressLevel / 100;
355 }
356 
357 //______________________________________________________________________________
359 {
360  return (fCompressLevel < 0) ? -1 : fCompressLevel % 100;
361 }
362 
363 //______________________________________________________________________________
365 {
366  return (fCompressLevel < 0) ? -1 : fCompressLevel;
367 }
368 
369 #endif
370 
371 
Int_t fCompressLevel
! Compression level and algorithm
Definition: TBufferXML.h:343
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:47
XMLNodePointer_t CreateItemNode(const char *name)
Create item node of specified name.
Definition: TBufferXML.cxx:724
virtual Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection)
Read one collection of objects from the buffer using the StreamerInfoLoopAction.
virtual ~TBufferXML()
Destroy xml buffer.
Definition: TBufferXML.cxx:146
void XmlReadBlock(XMLNodePointer_t node)
Read binary block of data from xml.
Definition: TBufferXML.cxx:491
TXMLStackObj * PushStack(XMLNodePointer_t current, Bool_t simple=kFALSE)
Add new level to xml stack.
Definition: TBufferXML.cxx:329
virtual Int_t ReadStaticArray(Bool_t *b)
Read array of Bool_t from buffer.
virtual void WriteObject(const TObject *obj)
Convert object into xml structures.
Definition: TBufferXML.cxx:286
virtual Int_t ReadStaticArrayFloat16(Float_t *f, TStreamerElement *ele=0)
Read array of Float16_t from buffer.
An array of TObjects.
Definition: TObjArray.h:39
virtual void ReadFloat16(Float_t *f, TStreamerElement *ele=0)
Read a Float16_t from the buffer.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
Definition: TBufferFile.h:51
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:390
virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0)
Read array of Double32_t from buffer.
long long Long64_t
Definition: RtypesCore.h:69
void WorkWithElement(TStreamerElement *elem, Int_t comp_type)
This function is a part of SetStreamerElementNumber method.
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:561
void XmlWriteBlock(XMLNodePointer_t node)
Write binary data block from buffer to xml.
Definition: TBufferXML.cxx:433
virtual void ReadWithFactor(Float_t *ptr, Double_t factor, Double_t minvalue)
Read a Double32_t from the buffer when the factor and minimun value have been specified see comments ...
virtual void ReadLong(Long_t &l)
Reads Long_t value from buffer.
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
Definition: TBufferXML.h:336
static void * ConvertFromXMLAny(const char *str, TClass **cl=0, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Read object of any class from XML, produced by ConvertToXML() method.
Definition: TBufferXML.cxx:223
float Float_t
Definition: RtypesCore.h:53
virtual void WriteLong(Long_t l)
Writes Long_t value to buffer.
void SetCompressionSettings(Int_t settings=1)
Used to specify the compression level and algorithm.
Definition: TBufferXML.cxx:424
void SetCompressionLevel(Int_t level=1)
See comments for function SetCompressionSettings.
Definition: TBufferXML.cxx:405
unsigned short UShort_t
Definition: RtypesCore.h:36
virtual void ClassMember(const char *name, const char *typeName=0, Int_t arrsize1=-1, Int_t arrsize2=-1)
Method indicates name and typename of class member, which should be now streamed in custom streamer...
TH1 * h
Definition: legend2.C:5
XMLNodePointer_t XmlWriteObject(const void *obj, const TClass *objClass)
Write object to buffer If object was written before, only pointer will be stored Return pointer to to...
Definition: TBufferXML.cxx:803
virtual void WriteULong64(ULong64_t l)
Writes ULong64_t value to buffer.
virtual void ReadStdString(std::string &s)
Reads a std::string.
virtual void ReadFastArray(Bool_t *b, Int_t n)
Read array of Bool_t from buffer.
virtual void SkipVersion(const TClass *cl=0)
Skip class version from I/O buffer.
Version_t fVersionBuf
Definition: TBufferXML.h:331
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)
Suppressed function of TBuffer.
void RegisterPointer(const void *ptr, XMLNodePointer_t node)
Register pair of object pointer and node, where this object is saved, in object map.
Definition: TBufferXML.cxx:600
Basic string class.
Definition: TString.h:137
virtual Int_t ReadStaticArrayDouble32(Double_t *d, TStreamerElement *ele=0)
Read array of Double32_t from buffer.
virtual void WriteChar(Char_t c)
Writes Char_t value to buffer.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual TClass * ReadClass(const TClass *cl=0, UInt_t *objTag=0)
Function to read class from buffer, used in old-style streamers.
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:246
virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits)
Read array of Float16_t from buffer.
void CreateElemNode(const TStreamerElement *elem)
Create xml node correspondent to TStreamerElement object.
Definition: TBufferXML.cxx:752
virtual void WriteTString(const TString &s)
Writes a TString.
Int_t GetCompressionSettings() const
Definition: TBufferXML.h:364
virtual void WriteDouble32(Double_t *d, TStreamerElement *ele=0)
Write a Double32_t to the buffer.
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.
TXMLEngine * fXML
Definition: TBufferXML.h:327
Int_t GetIOVersion() const
Definition: TBufferXML.h:60
virtual void ReadCharP(Char_t *c)
Reads array of characters from buffer.
TXMLFile * XmlFile()
Returns pointer to TXMLFile object.
Definition: TBufferXML.cxx:157
virtual void StreamObject(void *obj, const type_info &typeinfo, const TClass *onFileClass=0)
steram object to/from buffer
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=0)
Checks, that attribute of specified name exists and has specified value.
Definition: TBufferXML.cxx:699
virtual void WriteShort(Short_t s)
Writes Short_t value to buffer.
TExMap * fObjMap
Definition: TBufferXML.h:333
virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0)
Read array of Float16_t from buffer.
virtual void DecrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions and decrease level in xml ...
Definition: TBufferXML.cxx:959
Bool_t VerifyNode(XMLNodePointer_t node, const char *name, const char *errinfo=0)
Check, if node has specified name.
Definition: TBufferXML.cxx:672
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object)
Read one collection of objects from the buffer using the StreamerInfoLoopAction.
virtual void WriteUChar(UChar_t c)
Writes UChar_t value to buffer.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)
Read version value from buffer.
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.
Int_t GetCompressionAlgorithm() const
Definition: TBufferXML.h:352
virtual void WriteUInt(UInt_t i)
Writes UInt_t value to buffer.
void SetIOVersion(Int_t v)
Definition: TBufferXML.h:61
virtual void WriteFastArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0)
Write array of Double32_t to buffer.
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 void ReadBool(Bool_t &b)
Reads Bool_t value from buffer.
XMLNodePointer_t StackNode()
Return pointer on current xml node.
Definition: TBufferXML.cxx:369
virtual void ReadUChar(UChar_t &c)
Reads UChar_t value from buffer.
virtual void ReadDouble32(Double_t *d, TStreamerElement *ele=0)
Read a Double32_t from the buffer.
TObjArray fStack
Definition: TBufferXML.h:329
Int_t fIOVersion
! Indicates format of ROOT xml file
Definition: TBufferXML.h:344
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:342
void ShiftStack(const char *info=0)
Shift stack node to next.
Definition: TBufferXML.cxx:378
Bool_t VerifyStackAttr(const char *name, const char *value, const char *errinfo=0)
Checks stack attribute.
Definition: TBufferXML.cxx:716
virtual void * ReadObjectAny(const TClass *clCast)
Read object from buffer. Only used from TBuffer.
void SetXML(TXMLEngine *xml)
Definition: TBufferXML.h:254
virtual void IncrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions and indent new level in xm...
Definition: TBufferXML.cxx:890
SVector< double, 2 > v
Definition: Dict.h:5
virtual Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele=0)
Read array of Float16_t from buffer.
TBufferXML()
Default constructor.
Definition: TBufferXML.cxx:64
virtual void WriteFloat16(Float_t *f, TStreamerElement *ele=0)
Write a Float16_t to the buffer.
static std::string fgFloatFmt
! Printf argument for floats and doubles, either "%f" or "%e" or "%10f" and so on ...
Definition: TBufferXML.h:346
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
TLine * l
Definition: textangle.C:4
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
static TString ConvertToXML(const TObject *obj, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Converts object, inherited from TObject class, to XML string fmt contains configuration of XML layout...
Definition: TBufferXML.cxx:166
Bool_t fCanUseCompact
! Flag indicate that basic type (like Int_t) can be placed in the same tag
Definition: TBufferXML.h:340
virtual void WriteArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0)
Write array of Float16_t to buffer.
Bool_t VerifyStackNode(const char *name, const char *errinfo=0)
Check, if stack node has specified name.
Definition: TBufferXML.cxx:690
virtual void WriteStdString(const std::string &s)
Writes a TString.
void * XMLNodePointer_t
Definition: TXMLEngine.h:19
Bool_t VerifyElemNode(const TStreamerElement *elem)
Checks, if stack node correspond to TStreamerElement object.
Definition: TBufferXML.cxx:780
void ExtractReference(XMLNodePointer_t node, const void *ptr, const TClass *cl)
Analyse, if node has "ref" attribute and register it to object map.
Definition: TBufferXML.cxx:646
static void SetFloatFormat(const char *fmt="%e")
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 WriteObjectClass(const void *actualObjStart, const TClass *actualClass)
Write object to buffer. Only used from TBuffer.
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...
static const char * GetFloatFormat()
long Long_t
Definition: RtypesCore.h:50
virtual void WriteArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0)
Write array of Double32_t 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:201
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...
TObjArray * fIdArray
Definition: TBufferXML.h:334
virtual void ReadWithNbits(Float_t *ptr, Int_t nbits)
Read a Float16_t from the buffer when the number of bits is specified (explicitly or not) see comment...
virtual void ReadDouble(Double_t &d)
Reads Double_t value from buffer.
double f(double x)
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:616
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.
Bool_t fExpectedChain
! Flag to resolve situation when several elements of same basic type stored as FastArray ...
Definition: TBufferXML.h:341
void WorkWithClass(TStreamerInfo *info, const TClass *cl=0)
Prepares buffer to stream data of specified class.
Definition: TBufferXML.cxx:898
virtual void ReadTString(TString &s)
Reads a TString.
virtual void WriteDouble(Double_t d)
Writes Double_t value to buffer.
#define name(a, b)
Definition: linkTestLib0.cpp:5
Bool_t VerifyItemNode(const char *name, const char *errinfo=0)
Checks, if stack node is item and has specified name.
Definition: TBufferXML.cxx:738
TXMLStackObj * Stack(Int_t depth=0)
Return xml stack object of specified depth.
Definition: TBufferXML.cxx:358
virtual void WriteBool(Bool_t b)
Writes Bool_t value to buffer.
Mother of all ROOT objects.
Definition: TObject.h:58
XMLNodePointer_t XmlWriteBasic(Char_t value)
Converts Char_t to string and add xml node to buffer.
char Char_t
Definition: RtypesCore.h:29
Class for serializing/deserializing object to/from xml.
Definition: TBufferXML.h:44
virtual void ReadLong64(Long64_t &l)
Reads Long64_t value from buffer.
void * XmlReadObject(void *obj, TClass **cl=0)
Read object from the buffer.
Definition: TBufferXML.cxx:831
Int_t fErrorFlag
Definition: TBufferXML.h:338
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)
Suppressed function of TBuffer.
Int_t GetCompressionLevel() const
Definition: TBufferXML.h:358
virtual void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue)
Read array of Float16_t from buffer.
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.
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:991
unsigned char UChar_t
Definition: RtypesCore.h:34
void PerformPostProcessing()
Function is converts TObject and TString structures to more compact representation.
virtual void WriteFastArrayFloat16(const Float_t *d, Int_t n, TStreamerElement *ele=0)
Write array of Float16_t to buffer.
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.
TObject * obj
virtual Int_t ReadArrayDouble32(Double_t *&d, TStreamerElement *ele=0)
Read array of Double32_t from buffer.
float value
Definition: math.cpp:443
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:344
void XmlReadBasic(Char_t &value)
Reads string from current xml node and convert it to Char_t value.
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:35
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:262