12#ifndef ROOT_TBufferXML
13#define ROOT_TBufferXML
52 return ConvertToXML(obj, TClass::GetClass<T>(), GenericLayout, UseNamespaces);
65 return obj !=
nullptr;
135 const TClass *onFileClass =
nullptr);
303 template <
typename T>
306 template <
typename T>
309 template <
typename T>
312 template <
typename T>
315 template <
typename T>
318 template <
typename T>
unsigned long long ULong64_t
#define ClassDef(name, id)
Base class for text-based streamers like TBufferJSON or TBufferXML Special actions list will use meth...
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.
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...
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)
virtual void WriteDouble(Double_t d)
Writes Double_t value to buffer.
Int_t GetCompressionSettings() const
TXMLStackObj * PushStack(XMLNodePointer_t current, Bool_t simple=kFALSE)
Add new level to xml stack.
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.
void WorkWithClass(TStreamerInfo *info, const TClass *cl=nullptr)
Prepares buffer to stream data of specified class.
Bool_t VerifyStackNode(const char *name, const char *errinfo=nullptr)
Check, if stack node has specified name.
Int_t GetCompressionAlgorithm() const
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
virtual void ReadCharStar(char *&s)
Read a char* string.
TString fValueBuf
! Current value buffer
Int_t GetCompressionLevel() const
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.
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...
TXMLEngine * fXML
! instance of TXMLEngine for working with XML structures
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 ...
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)
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.
void XmlReadBasic(Char_t &value)
Reads string from current xml node and convert it to Char_t value.
Int_t GetIOVersion() const
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
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.
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.
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
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
virtual void ReadTString(TString &s)
Reads a TString.
void XmlReadBlock(XMLNodePointer_t node)
Read binary block of data from xml.
void * XmlReadObject(void *obj, TClass **cl=nullptr)
Read object from the buffer.
Bool_t fCanUseCompact
! Flag indicate that basic type (like Int_t) can be placed in the same tag
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...
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.
virtual void DecrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and decrease level in xml ...
void * XmlReadAny(XMLNodePointer_t node, void *obj, TClass **cl)
Recreate object from xml structure.
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.
Int_t fIOVersion
! Indicates format of ROOT xml file
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.
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.
TBufferXML()
Default constructor.
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.
void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose)
Used to specify the compression level and algorithm.
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.
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.
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...
TXMLFile * XmlFile()
Returns pointer to TXMLFile object.
void WorkWithElement(TStreamerElement *elem, Int_t comp_type)
This function is a part of SetStreamerElementNumber method.
virtual void IncrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and indent new level in xm...
virtual ~TBufferXML()
Destroy xml buffer.
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.
TClass * fExpectedBaseClass
! Pointer to class, which should be stored as parent of current
static TString ToXML(const T *obj, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
TXMLStackObj * Stack(UInt_t depth=0)
virtual void WriteUInt(UInt_t i)
Writes UInt_t value to buffer.
XMLNodePointer_t CreateItemNode(const char *name)
Create item node of specified name.
virtual void ReadFloat(Float_t &f)
Reads Float_t value from buffer.
TXMLStackObj * PopStack()
Remove one level from xml stack.
void CreateElemNode(const TStreamerElement *elem)
Create xml node correspondent to TStreamerElement object.
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.
Bool_t VerifyElemNode(const TStreamerElement *elem)
Checks if stack node correspond to TStreamerElement object.
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)
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.
This class stores a (key,value) pair using an external hash.
Mother of all ROOT objects.
Describe Streamer information for one class version.
Abstract Interface class describing Streamer information for one class.
static constexpr double s
@ kUseGlobal
Use the global compression algorithm.
@ kUseGeneralPurpose
Use the recommended general-purpose setting; moderate read / write speed and compression ratio.