library: libXMLIO #include "TBufferXML.h" |
TBufferXML
class description - header file - source file - inheritance tree (.pdf)
protected:
TBufferXML()
void BeforeIOoperation()
void CheckVersionBuf()
void CreateElemNode(const TStreamerElement* elem)
XMLNodePointer_t CreateItemNode(const char* name)
Bool_t ExtractPointer(XMLNodePointer_t node, void*& ptr, TClass*& cl)
void ExtractReference(XMLNodePointer_t node, const void* ptr, const TClass* cl)
void PerformPostProcessing()
void PerformPreProcessing(const TStreamerElement* elem, XMLNodePointer_t elemnode)
TXMLStackObj* PopStack()
Bool_t ProcessPointer(const void* ptr, XMLNodePointer_t node)
TXMLStackObj* PushStack(XMLNodePointer_t current, Bool_t simple = kFALSE)
void RegisterPointer(const void* ptr, XMLNodePointer_t node)
void SetCompressionLevel(int level)
void SetXML(TXMLEngine* xml)
void ShiftStack(const char* info = "0")
TXMLStackObj* Stack(Int_t depth = 0)
XMLNodePointer_t StackNode()
Bool_t VerifyAttr(XMLNodePointer_t node, const char* name, const char* value, const char* errinfo = "0")
Bool_t VerifyElemNode(const TStreamerElement* elem)
Bool_t VerifyItemNode(const char* name, const char* errinfo = "0")
Bool_t VerifyNode(XMLNodePointer_t node, const char* name, const char* errinfo = "0")
Bool_t VerifyStackAttr(const char* name, const char* value, const char* errinfo = "0")
Bool_t VerifyStackNode(const char* name, const char* errinfo = "0")
void WorkWithClass(TStreamerInfo* info, const TClass* cl = 0)
void WorkWithElement(TStreamerElement* elem, Int_t number)
virtual void WriteObject(const void* actualObjStart, const TClass* actualClass)
TXMLFile* XmlFile()
void* XmlReadAny(XMLNodePointer_t node, void* obj, TClass** cl)
void XmlReadBasic(Char_t& value)
void XmlReadBasic(Short_t& value)
void XmlReadBasic(Int_t& value)
void XmlReadBasic(Long_t& value)
void XmlReadBasic(Long64_t& value)
void XmlReadBasic(Float_t& value)
void XmlReadBasic(Double_t& value)
void XmlReadBasic(Bool_t& value)
void XmlReadBasic(UChar_t& value)
void XmlReadBasic(UShort_t& value)
void XmlReadBasic(UInt_t& value)
void XmlReadBasic(ULong_t& value)
void XmlReadBasic(ULong64_t& value)
void XmlReadBlock(XMLNodePointer_t node)
void* XmlReadObject(void* obj, TClass** cl = 0)
const char* XmlReadValue(const char* name)
XMLNodePointer_t XmlWriteAny(const void* obj, const TClass* cl)
XMLNodePointer_t XmlWriteBasic(Char_t value)
XMLNodePointer_t XmlWriteBasic(Short_t value)
XMLNodePointer_t XmlWriteBasic(Int_t value)
XMLNodePointer_t XmlWriteBasic(Long_t value)
XMLNodePointer_t XmlWriteBasic(Long64_t value)
XMLNodePointer_t XmlWriteBasic(Float_t value)
XMLNodePointer_t XmlWriteBasic(Double_t value)
XMLNodePointer_t XmlWriteBasic(Bool_t value)
XMLNodePointer_t XmlWriteBasic(UChar_t value)
XMLNodePointer_t XmlWriteBasic(UShort_t value)
XMLNodePointer_t XmlWriteBasic(UInt_t value)
XMLNodePointer_t XmlWriteBasic(ULong_t value)
XMLNodePointer_t XmlWriteBasic(ULong64_t value)
void XmlWriteBlock(XMLNodePointer_t node)
XMLNodePointer_t XmlWriteObject(const void* obj, const TClass* objClass)
XMLNodePointer_t XmlWriteValue(const char* value, const char* name)
public:
TBufferXML(TBuffer::EMode mode)
TBufferXML(TBuffer::EMode mode, TXMLFile* file)
TBufferXML(const TBufferXML&)
virtual ~TBufferXML()
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass* clss)
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const char* classname)
static TClass* Class()
virtual void ClassBegin(const TClass*, Version_t = -1)
virtual void ClassEnd(const TClass*)
virtual void ClassMember(const char* name, const char* typeName = "0", Int_t arrsize1 = -1, Int_t arrsize2 = -1)
static TObject* ConvertFromXML(const char* str, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE)
static void* ConvertFromXMLAny(const char* str, TClass** cl = 0, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE)
static TString ConvertToXML(TObject* obj, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE)
static TString ConvertToXML(void* obj, TClass* cl, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE)
virtual void DecrementLevel(TStreamerInfo*)
virtual void IncrementLevel(TStreamerInfo*)
virtual TClass* IsA() const
virtual TBuffer& operator<<(Bool_t b)
virtual TBuffer& operator<<(Char_t c)
virtual TBuffer& operator<<(UChar_t c)
virtual TBuffer& operator<<(Short_t h)
virtual TBuffer& operator<<(UShort_t h)
virtual TBuffer& operator<<(Int_t i)
virtual TBuffer& operator<<(UInt_t i)
virtual TBuffer& operator<<(Long_t l)
virtual TBuffer& operator<<(ULong_t l)
virtual TBuffer& operator<<(Long64_t l)
virtual TBuffer& operator<<(ULong64_t l)
virtual TBuffer& operator<<(Float_t f)
virtual TBuffer& operator<<(Double_t d)
virtual TBuffer& operator<<(const Char_t* c)
virtual TBuffer& operator>>(Bool_t& b)
virtual TBuffer& operator>>(Char_t& c)
virtual TBuffer& operator>>(UChar_t& c)
virtual TBuffer& operator>>(Short_t& h)
virtual TBuffer& operator>>(UShort_t& h)
virtual TBuffer& operator>>(Int_t& i)
virtual TBuffer& operator>>(UInt_t& i)
virtual TBuffer& operator>>(Long_t& l)
virtual TBuffer& operator>>(ULong_t& l)
virtual TBuffer& operator>>(Long64_t& l)
virtual TBuffer& operator>>(ULong64_t& l)
virtual TBuffer& operator>>(Float_t& f)
virtual TBuffer& operator>>(Double_t& d)
virtual TBuffer& operator>>(Char_t* c)
virtual Int_t ReadArray(Bool_t*& b)
virtual Int_t ReadArray(Char_t*& c)
virtual Int_t ReadArray(UChar_t*& c)
virtual Int_t ReadArray(Short_t*& h)
virtual Int_t ReadArray(UShort_t*& h)
virtual Int_t ReadArray(Int_t*& i)
virtual Int_t ReadArray(UInt_t*& i)
virtual Int_t ReadArray(Long_t*& l)
virtual Int_t ReadArray(ULong_t*& l)
virtual Int_t ReadArray(Long64_t*& l)
virtual Int_t ReadArray(ULong64_t*& l)
virtual Int_t ReadArray(Float_t*& f)
virtual Int_t ReadArray(Double_t*& d)
virtual Int_t ReadArrayDouble32(Double_t*& d, TStreamerElement* ele = 0)
virtual TClass* ReadClass(const TClass* cl = 0, UInt_t* objTag = 0)
virtual void ReadDouble32(Double_t* d, TStreamerElement* ele = 0)
virtual void ReadFastArray(Bool_t* b, Int_t n)
virtual void ReadFastArray(Char_t* c, Int_t n)
virtual void ReadFastArray(UChar_t* c, Int_t n)
virtual void ReadFastArray(Short_t* h, Int_t n)
virtual void ReadFastArray(UShort_t* h, Int_t n)
virtual void ReadFastArray(Int_t* i, Int_t n)
virtual void ReadFastArray(UInt_t* i, Int_t n)
virtual void ReadFastArray(Long_t* l, Int_t n)
virtual void ReadFastArray(ULong_t* l, Int_t n)
virtual void ReadFastArray(Long64_t* l, Int_t n)
virtual void ReadFastArray(ULong64_t* l, Int_t n)
virtual void ReadFastArray(Float_t* f, Int_t n)
virtual void ReadFastArray(Double_t* d, Int_t n)
virtual void ReadFastArray(void* start, const TClass* cl, Int_t n = 1, TMemberStreamer* s = 0)
virtual void ReadFastArray(void** startp, const TClass* cl, Int_t n = 1, Bool_t isPreAlloc = kFALSE, TMemberStreamer* s = 0)
virtual void ReadFastArrayDouble32(Double_t* d, Int_t n, TStreamerElement* ele = 0)
virtual void* ReadObjectAny(const TClass* clCast)
virtual Int_t ReadStaticArray(Bool_t* b)
virtual Int_t ReadStaticArray(Char_t* c)
virtual Int_t ReadStaticArray(UChar_t* c)
virtual Int_t ReadStaticArray(Short_t* h)
virtual Int_t ReadStaticArray(UShort_t* h)
virtual Int_t ReadStaticArray(Int_t* i)
virtual Int_t ReadStaticArray(UInt_t* i)
virtual Int_t ReadStaticArray(Long_t* l)
virtual Int_t ReadStaticArray(ULong_t* l)
virtual Int_t ReadStaticArray(Long64_t* l)
virtual Int_t ReadStaticArray(ULong64_t* l)
virtual Int_t ReadStaticArray(Float_t* f)
virtual Int_t ReadStaticArray(Double_t* d)
virtual Int_t ReadStaticArrayDouble32(Double_t* d, TStreamerElement* ele = 0)
virtual Version_t ReadVersion(UInt_t* start = 0, UInt_t* bcnt = 0, const TClass* cl = 0)
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion = kFALSE)
virtual void SetStreamerElementNumber(Int_t)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void SkipObjectAny()
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
virtual void StreamObject(void* obj, const type_info& typeinfo)
virtual void StreamObject(void* obj, const char* className)
virtual void StreamObject(void* obj, const TClass* cl)
virtual void StreamObject(TObject* obj)
virtual void WriteArray(const Bool_t* b, Int_t n)
virtual void WriteArray(const Char_t* c, Int_t n)
virtual void WriteArray(const UChar_t* c, Int_t n)
virtual void WriteArray(const Short_t* h, Int_t n)
virtual void WriteArray(const UShort_t* h, Int_t n)
virtual void WriteArray(const Int_t* i, Int_t n)
virtual void WriteArray(const UInt_t* i, Int_t n)
virtual void WriteArray(const Long_t* l, Int_t n)
virtual void WriteArray(const ULong_t* l, Int_t n)
virtual void WriteArray(const Long64_t* l, Int_t n)
virtual void WriteArray(const ULong64_t* l, Int_t n)
virtual void WriteArray(const Float_t* f, Int_t n)
virtual void WriteArray(const Double_t* d, Int_t n)
virtual void WriteArrayDouble32(const Double_t* d, Int_t n, TStreamerElement* ele = 0)
virtual void WriteClass(const TClass* cl)
virtual void WriteDouble32(Double_t* d, TStreamerElement* ele = 0)
virtual void WriteFastArray(const Bool_t* b, Int_t n)
virtual void WriteFastArray(const Char_t* c, Int_t n)
virtual void WriteFastArray(const UChar_t* c, Int_t n)
virtual void WriteFastArray(const Short_t* h, Int_t n)
virtual void WriteFastArray(const UShort_t* h, Int_t n)
virtual void WriteFastArray(const Int_t* i, Int_t n)
virtual void WriteFastArray(const UInt_t* i, Int_t n)
virtual void WriteFastArray(const Long_t* l, Int_t n)
virtual void WriteFastArray(const ULong_t* l, Int_t n)
virtual void WriteFastArray(const Long64_t* l, Int_t n)
virtual void WriteFastArray(const ULong64_t* l, Int_t n)
virtual void WriteFastArray(const Float_t* f, Int_t n)
virtual void WriteFastArray(const Double_t* d, Int_t n)
virtual void WriteFastArray(void* start, const TClass* cl, Int_t n = 1, TMemberStreamer* s = 0)
virtual Int_t WriteFastArray(void** startp, const TClass* cl, Int_t n = 1, Bool_t isPreAlloc = kFALSE, TMemberStreamer* s = 0)
virtual void WriteFastArrayDouble32(const Double_t* d, Int_t n, TStreamerElement* ele = 0)
virtual void WriteObject(const TObject* obj)
virtual UInt_t WriteVersion(const TClass* cl, Bool_t useBcnt = kFALSE)
protected:
TXMLEngine* fXML !
TObjArray fStack !
Version_t fVersionBuf !
TExMap* fObjMap !
TObjArray* fIdArray !
TString fValueBuf !
Int_t fErrorFlag !
Bool_t fCanUseCompact ! flag indicate that basic type (like Int_t) can be placed in the same tag
Bool_t fExpectedChain ! flag to resolve situation when several elements of same basic type stored as FastArray
TClass* fExpectedBaseClass ! pointer to class, which should be stored as parent of current
Int_t fCompressLevel ! compress level used to minimize size of file
________________________________________________________________________
Class for serializing/deserializing object to/from xml.
It redefines most of TBuffer class function to convert simple types,
array of simple types and objects to/from xml.
Instead of writing a binary data it creates a set of xml structures as
nodes and attributes
TBufferXML class uses streaming mechanism, provided by ROOT system,
therefore most of ROOT and user classes can be stored to xml. There are
limitations for complex objects like TTree, which can not be yet converted to xml.
________________________________________________________________________
TBufferXML(TBuffer::EMode mode, TXMLFile* file)
Creates buffer object to serailize/deserialize data to/from xml.
This constructor should be used, if data from buffer supposed to be stored in file.
Mode should be either TBuffer::kRead or TBuffer::kWrite.
TXMLFile* XmlFile()
returns pointer to TXMLFile object
access to file is necessary to produce unique identifier for object references
void* XmlReadAny(XMLNodePointer_t node, void* obj, TClass** cl)
Recreate object from xml structure.
Return pointer to read object.
if (cl!=0) returns pointer to class of object
void WriteObject(const TObject *obj)
Convert object into xml structures.
!!! Should be used only by TBufferXML itself.
Use ConvertToXML() methods to convert your object to xml
Redefined here to avoid gcc 3.x warning
TXMLStackObj* PopStack()
remove one level from xml stack
TXMLStackObj* Stack(Int_t depth)
return xml stack object of specified depth
void ShiftStack(const char* errinfo)
shift stack node to next
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 buffer
Automatically add "ref" attribute to node, where referenced object is stored
Bool_t VerifyAttr(XMLNodePointer_t node, const char* name, const char* value, const char* errinfo)
checks, that attribute of specified name exists and has specified value
Bool_t VerifyItemNode(const char* name, const char* errinfo)
checks, if stack node is item and has specified name
void SetStreamerElementNumber(Int_t number)
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions
and add/verify next element of xml structure
This calls allows separate data, correspondent to one class member, from another
void ClassMember(const char* name, const char* typeName, Int_t arrsize1, Int_t arrsize2)
to be documented by Sergey
void BeforeIOoperation()
Function is called before any IO operation of TBuffer
Now is used to store version value if no proper calls are discovered
void SkipObjectAny()
Skip any kind of object from buffer
Actually skip only one node on current level of xml structure
void WriteFastArray(const Char_t *c, Int_t n)
Write array of Char_t to buffer
If array does not include any special characters,
it will be reproduced as CharStar node with string as attribute
void StreamObject(void *obj, const type_info &typeinfo)
steram object to/from buffer
void StreamObject(void *obj, const char *className)
steram object to/from buffer
const char* XmlReadValue(const char* name)
read string value from current stack node
Author: Sergey Linev, Rene Brun 10.05.2004
Last update: root/:$Name: $:$Id: TBufferXML.cxx,v 1.13 2006/05/12 08:10:33 brun Exp $
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.