29 #include "Compression.h" 48 #ifdef R__VISUAL_CPLUSPLUS 49 #define FLong64 "%I64d" 50 #define FULong64 "%I64u" 52 #define FLong64 "%lld" 53 #define FULong64 "%llu" 75 fExpectedBaseClass(0),
171 void *ptr = (
void *) obj;
180 return ConvertToXML(ptr, clActual, GenericLayout, UseNamespaces);
220 if ((cl==0) || (obj==0))
return 0;
264 if (
fXML==0)
return 0;
278 if (node==0)
return 0;
283 if (
fXML==0)
return 0;
309 class TXMLStackObj :
public TObject {
317 fCompressedClassNode(
kFALSE),
323 virtual ~TXMLStackObj()
325 if (fIsElemOwner)
delete fElem;
328 Bool_t IsStreamerInfo()
const {
return fIsStreamerInfo; }
334 Bool_t fCompressedClassNode;
350 TXMLStackObj* stack =
new TXMLStackObj(current);
366 return dynamic_cast<TXMLStackObj*
> (
fStack.
Last());
374 TXMLStackObj* stack = 0;
385 TXMLStackObj* stack =
dynamic_cast<TXMLStackObj*
> (
fStack.
Last());
386 return (stack==0) ? 0 : stack->fNode;
394 TXMLStackObj* stack =
dynamic_cast<TXMLStackObj*
> (
fStack.
Last());
406 if (algorithm < 0 || algorithm >= ROOT::kUndefinedCompressionAlgorithm) algorithm = 0;
421 if (level < 0) level = 0;
422 if (level > 99) level = 99;
428 if (algorithm >= ROOT::kUndefinedCompressionAlgorithm) algorithm = 0;
449 if ((node==0) || (
Length()==0))
return;
451 const char* src =
Buffer();
454 char* fZipBuffer = 0;
459 if ((
Length() > 512) && (compressionLevel > 0)) {
460 int zipBufferSize =
Length();
461 fZipBuffer =
new char[zipBufferSize + 9];
463 int compressedSize = 0;
464 R__zipMultipleAlgorithm(compressionLevel, &dataSize,
Buffer(), &zipBufferSize,
465 fZipBuffer, &compressedSize, compressionAlgorithm);
466 if (compressedSize > 0) {
468 srcSize = compressedSize;
481 while (srcCnt++<srcSize) {
482 tgt+=sprintf(tgt,
" %02x", (
unsigned char) *src);
491 if (block>0) res += sbuf;
507 if (blocknode==0)
return;
511 char* fUnzipBuffer = 0;
514 Info(
"XmlReadBlock",
"Block size = %d, Length = %d, Compressed = %d",
515 blockSize,
Length(), blockCompressed);
520 Int_t readSize = blockSize;
524 if (blockCompressed) {
526 fUnzipBuffer =
new char[zipSize];
532 char* ptr = (
char*) content.
Data();
535 Info(
"XmlReadBlock",
"Content %s", ptr);
537 for (
int i=0;i<readSize;i++) {
538 while ((*ptr<48) || ((*ptr>57) && (*ptr<97)) || (*ptr>102)) ptr++;
540 int b_hi = (*ptr>57) ? *ptr-87 : *ptr-48;
542 int b_lo = (*ptr>57) ? *ptr-87 : *ptr-48;
548 if (
gDebug>4)
Info(
"XmlReadBlock",
" Buf[%d] = %d", i, b_hi*16+b_lo);
559 R__unzip(&readSize, (
unsigned char*) fUnzipBuffer, &blockSize,
560 (
unsigned char*)
Buffer(), &unzipRes);
562 if (status != 0 || unzipRes!=blockSize)
563 Error(
"XmlReadBlock",
"Decompression error %d", unzipRes);
565 if (
gDebug>2)
Info(
"XmlReadBlock",
"Unzip ok");
566 delete[] fUnzipBuffer;
577 if (node==0)
return kFALSE;
589 if (refnode==0)
return kFALSE;
602 if (refvalue.
Length()>0) {
616 if ((node==0) || (ptr==0))
return;
638 if (ptrid==0)
return kFALSE;
662 if ((node==0) || (ptr==0))
return;
666 if (refid==0)
return;
680 Info(
"ExtractReference",
"Find reference %s for object %p", refid, ptr);
688 if ((name==0) || (node==0))
return kFALSE;
692 Error(
"VerifyNode",
"Reading XML file (%s). Get: %s, expects: %s",
715 if ((node==0) || (name==0) || (value==0))
return kFALSE;
717 if (((cont==0) || (strcmp(cont, value)!=0))) {
719 Error(
"VerifyAttr",
"%s : attr %s = %s, expected: %s", errinfo, name, cont, value);
787 TXMLStackObj* curr =
PushStack(elemnode);
832 ((
TClass*)cl)->Streamer((
void*)obj, *
this);
837 Info(
"XmlWriteObject",
"Done write for class: %s", cl ? cl->
GetName() :
"null");
853 if (objnode==0)
return obj;
861 if (cl) *cl = objClass;
870 Error(
"XmlReadObject",
"Cannot find class %s", clname.
Data());
876 Info(
"XmlReadObject",
"Reading object of class %s", clname.
Data());
878 if (obj==0) obj = objClass->
New();
884 objClass->
Streamer((
void*)obj, *
this);
891 Info(
"XmlReadObject",
"Reading object of class %s done", clname.
Data());
893 if (cl) *cl = objClass;
917 if (sinfo!=0) cl = sinfo->
GetClass();
928 TXMLStackObj* stack =
Stack();
933 if (compressClassNode) {
954 if (!compressClassNode) {
964 stack->fCompressedClassNode = compressClassNode;
965 stack->fInfo = sinfo;
966 stack->fIsStreamerInfo =
kTRUE;
983 TXMLStackObj* stack =
Stack();
985 if (!stack->IsStreamerInfo()) {
990 if (stack->fCompressedClassNode) {
992 stack->fIsStreamerInfo =
kFALSE;
993 stack->fCompressedClassNode =
kFALSE;
1024 TXMLStackObj* stack =
Stack();
1026 Error(
"SetStreamerElementNumber",
"stack is empty");
1030 if (!stack->IsStreamerInfo()) {
1034 stack =
dynamic_cast<TXMLStackObj*
> (
fStack.
Last());
1038 Error(
"SetStreamerElementNumber",
"Lost of stack");
1043 Error(
"SetStreamerElementNumber",
"Problem in Inc/Dec level");
1049 if (!stack->IsStreamerInfo()) {
1050 Error(
"SetStreamerElementNumber",
"Problem in Inc/Dec level");
1055 if (
gDebug>4)
Info(
"SetStreamerElementNumber",
" Next element %s", elem->
GetName());
1062 Info(
"SetStreamerElementNumber",
1063 " Expects chain for elem %s number %d",
1076 Info(
"SetStreamerElementNumber",
1077 " Expects base class %s with standard streamer",
1087 stack->fElemNumber = number;
1088 stack->fIsElemOwner = (number<0);
1155 if (typeName==0) typeName =
name;
1157 if ((name==0) || (strlen(name)==0)) {
1158 Error(
"ClassMember",
"Invalid member name");
1165 Int_t typ_id(-1), comp_type(-1);
1167 if (strcmp(typeName,
"raw:data")==0)
1178 if (strcmp(name, typeName)==0) {
1185 if (tname[tname.
Length()-1]==
'*') {
1191 Error(
"ClassMember",
"Invalid class specifier %s", typeName);
1220 if ((typ_id>0) && (typ_id<20)) {
1248 Error(
"ClassMember",
"Invalid combination name = %s type = %s", name, typeName);
1274 if ((elem==0) || (elemnode==0))
return;
1286 if (nodestring)
return;
1290 if (nodeuchar)
return;
1294 if (nodeint)
return;
1298 if (nodecharstar!=0)
return;
1299 nodecharstar = node;
1307 if (nodeuchar==0)
return;
1308 if (nodecharstar!=0)
1337 if (idnode==0) idnode = node;
else 1338 if (bitsnode==0) bitsnode = node;
else return;
1347 if ((vnode==0) || (idnode==0) || (bitsnode==0))
return;
1354 sscanf(str.
Data(),
"%u", &bits);
1357 snprintf(sbuf,
sizeof(sbuf),
"%x",bits);
1379 if ((elem==0) || (elemnode==0))
return;
1391 snprintf(sbuf,
sizeof(sbuf),
"%d", len);
1409 if (!
fXML->
HasAttr(elemnode,
"fUniqueID"))
return;
1427 sscanf(bitsstr.
Data(),
"%x", &bits);
1429 snprintf(sbuf,
sizeof(sbuf),
"%u", bits);
1455 const char* clname = 0;
1461 if (
gDebug>2)
Info(
"ReadClass",
"Try to read class %s", clname ? clname :
"---");
1463 return clname ?
gROOT->GetClass(clname) : 0;
1516 if (start) *start = 0;
1517 if (bcnt) *bcnt = 0;
1528 Error(
"ReadVersion",
"No correspondent tags to read version");;
1532 if (
gDebug>2)
Info(
"ReadVersion",
"Version = %d", res);
1566 Info(
"WriteVersion",
"Class: %s, version = %d",
1600 Info(
"WriteObject",
"Class %s", (actualClass ? actualClass->
GetName() :
" null"));
1605 #define TXMLReadArrayNoncompress(vname) \ 1607 for(Int_t indx=0;indx<n;indx++) \ 1608 XmlReadBasic(vname[indx]); \ 1612 #define TXMLReadArrayContent(vname, arrsize) \ 1615 while(indx<arrsize) { \ 1617 if (fXML->HasAttr(StackNode(), xmlio::cnt)) \ 1618 cnt = fXML->GetIntAttr(StackNode(), xmlio::cnt); \ 1619 XmlReadBasic(vname[indx]); \ 1620 Int_t curr = indx; indx++; \ 1622 vname[indx] = vname[curr]; \ 1629 #define TBufferXML_ReadArray(tname, vname) \ 1631 BeforeIOoperation(); \ 1632 if (!VerifyItemNode(xmlio::Array,"ReadArray")) return 0; \ 1633 Int_t n = fXML->GetIntAttr(StackNode(), xmlio::Size); \ 1634 if (n<=0) return 0; \ 1635 if (!vname) vname = new tname[n]; \ 1636 PushStack(StackNode()); \ 1637 TXMLReadArrayContent(vname, n); \ 1639 ShiftStack("readarr"); \ 1844 #define TBufferXML_ReadStaticArray(vname) \ 1846 BeforeIOoperation(); \ 1847 if (!VerifyItemNode(xmlio::Array,"ReadStaticArray")) return 0; \ 1848 Int_t n = fXML->GetIntAttr(StackNode(), xmlio::Size); \ 1849 if (n<=0) return 0; \ 1850 if (!vname) return 0; \ 1851 PushStack(StackNode()); \ 1852 TXMLReadArrayContent(vname, n); \ 1854 ShiftStack("readstatarr"); \ 1981 #define TBufferXML_ReadFastArray(vname) \ 1983 BeforeIOoperation(); \ 1985 TStreamerElement* elem = Stack(0)->fElem; \ 1986 if ((elem!=0) && (elem->GetType()>TStreamerInfo::kOffsetL) && \ 1987 (elem->GetType()<TStreamerInfo::kOffsetP) && \ 1988 (elem->GetArrayLength()!=n)) fExpectedChain = kTRUE; \ 1989 if (fExpectedChain) { \ 1990 fExpectedChain = kFALSE; \ 1991 Int_t startnumber = Stack(0)->fElemNumber; \ 1992 TStreamerInfo* info = Stack(1)->fInfo; \ 1995 elem = (TStreamerElement*)info->GetElements()->At(startnumber++); \ 1996 if (elem->GetType()<TStreamerInfo::kOffsetL) { \ 1997 if (index>0) { PopStack(); ShiftStack("chainreader"); VerifyElemNode(elem); } \ 1998 fCanUseCompact = kTRUE; \ 1999 XmlReadBasic(vname[index]); \ 2002 if (!VerifyItemNode(xmlio::Array,"ReadFastArray")) return; \ 2003 PushStack(StackNode()); \ 2004 Int_t elemlen = elem->GetArrayLength(); \ 2005 TXMLReadArrayContent((vname+index), elemlen); \ 2007 ShiftStack("readfastarr"); \ 2012 if (!VerifyItemNode(xmlio::Array,"ReadFastArray")) return; \ 2013 PushStack(StackNode()); \ 2014 TXMLReadArrayContent(vname, n); \ 2016 ShiftStack("readfastarr"); \ 2037 Int_t size = strlen(buf);
2038 if (size<n) size =
n;
2039 memcpy(c, buf, size);
2198 #define TXMLWriteArrayNoncompress(vname, arrsize) \ 2200 for(Int_t indx=0;indx<arrsize;indx++) \ 2201 XmlWriteBasic(vname[indx]); \ 2205 #define TXMLWriteArrayCompress(vname, arrsize) \ 2208 while(indx<arrsize) { \ 2209 XMLNodePointer_t elemnode = XmlWriteBasic(vname[indx]); \ 2210 Int_t curr = indx; indx++; \ 2211 while ((indx<arrsize) && (vname[indx]==vname[curr])) indx++; \ 2212 if (indx-curr > 1) \ 2213 fXML->NewIntAttr(elemnode, xmlio::cnt, indx-curr); \ 2217 #define TXMLWriteArrayContent(vname, arrsize) \ 2219 if (fCompressLevel>0) { \ 2220 TXMLWriteArrayCompress(vname, arrsize) \ 2222 TXMLWriteArrayNoncompress(vname, arrsize) \ 2227 #define TBufferXML_WriteArray(vname) \ 2229 BeforeIOoperation(); \ 2230 XMLNodePointer_t arrnode = CreateItemNode(xmlio::Array); \ 2231 fXML->NewIntAttr(arrnode, xmlio::Size, n); \ 2232 PushStack(arrnode); \ 2233 TXMLWriteArrayContent(vname, n); \ 2360 #define TBufferXML_WriteFastArray(vname) \ 2362 BeforeIOoperation(); \ 2364 TStreamerElement* elem = Stack(0)->fElem; \ 2365 if ((elem!=0) && (elem->GetType()>TStreamerInfo::kOffsetL) && \ 2366 (elem->GetType()<TStreamerInfo::kOffsetP) && \ 2367 (elem->GetArrayLength()!=n)) fExpectedChain = kTRUE; \ 2368 if (fExpectedChain) { \ 2369 TStreamerInfo* info = Stack(1)->fInfo; \ 2370 Int_t startnumber = Stack(0)->fElemNumber; \ 2371 fExpectedChain = kFALSE; \ 2374 elem =(TStreamerElement*)info->GetElements()->At(startnumber++); \ 2375 if (elem->GetType()<TStreamerInfo::kOffsetL) { \ 2376 if(index>0) { PopStack(); CreateElemNode(elem); } \ 2377 fCanUseCompact = kTRUE; \ 2378 XmlWriteBasic(vname[index]); \ 2381 XMLNodePointer_t arrnode = CreateItemNode(xmlio::Array); \ 2382 Int_t elemlen = elem->GetArrayLength(); \ 2383 PushStack(arrnode); \ 2384 TXMLWriteArrayContent((vname+index), elemlen); \ 2390 XMLNodePointer_t arrnode = CreateItemNode(xmlio::Array); \ 2391 PushStack(arrnode); \ 2392 TXMLWriteArrayContent(vname, n); \ 2415 for (
int i=0;i<
n;i++) {
2416 if (*buf < 27) { usedefault =
kTRUE;
break; }
2580 Info(
"StreamObject",
"Class: %s", (cl ? cl->
GetName() :
"none"));
2588 #define TBufferXML_operatorin(vname) \ 2590 BeforeIOoperation(); \ 2591 XmlReadBasic(vname); \ 2749 #define TBufferXML_operatorout(vname) \ 2751 BeforeIOoperation(); \ 2752 XmlWriteBasic(vname); \ 2910 snprintf(buf,
sizeof(buf),
"%d",value);
2920 snprintf(buf,
sizeof(buf),
"%hd", value);
2930 snprintf(buf,
sizeof(buf),
"%d", value);
2940 snprintf(buf,
sizeof(buf),
"%ld", value);
2988 snprintf(buf,
sizeof(buf),
"%u", value);
2998 snprintf(buf,
sizeof(buf),
"%hu", value);
3008 snprintf(buf,
sizeof(buf),
"%u", value);
3018 snprintf(buf,
sizeof(buf),
"%lu", value);
3059 sscanf(res,
"%d", &n);
3072 sscanf(res,
"%hd", &value);
3084 sscanf(res,
"%d", &value);
3096 sscanf(res,
"%ld", &value);
3120 sscanf(res,
"%f", &value);
3132 sscanf(res,
"%lf", &value);
3157 sscanf(res,
"%ud", &n);
3170 sscanf(res,
"%hud", &value);
3182 sscanf(res,
"%u", &value);
3194 sscanf(res,
"%lu", &value);
3269 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3270 for(TStreamerInfoActions::ActionContainer_t::const_iterator iter = sequence.
fActions.begin();
3275 (*iter).PrintDebug(*
this,obj);
3281 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3282 for(TStreamerInfoActions::ActionContainer_t::const_iterator iter = sequence.
fActions.begin();
3306 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3307 for(TStreamerInfoActions::ActionContainer_t::const_iterator iter = sequence.
fActions.begin();
3312 (*iter).PrintDebug(*
this,*(
char**)start_collection);
3313 (*iter)(*
this,start_collection,end_collection);
3318 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3319 for(TStreamerInfoActions::ActionContainer_t::const_iterator iter = sequence.
fActions.begin();
3324 (*iter)(*
this,start_collection,end_collection);
3346 void *arr0 = loopconfig->
GetFirstAddress(start_collection,end_collection);
3348 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3349 for(TStreamerInfoActions::ActionContainer_t::const_iterator iter = sequence.
fActions.begin();
3354 (*iter).PrintDebug(*
this,arr0);
3355 (*iter)(*
this,start_collection,end_collection,loopconfig);
3360 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3361 for(TStreamerInfoActions::ActionContainer_t::const_iterator iter = sequence.
fActions.begin();
3366 (*iter)(*
this,start_collection,end_collection,loopconfig);
Int_t fCompressLevel
! Compression level and algorithm
Describe Streamer information for one class version.
XMLNodePointer_t CreateItemNode(const char *name)
Create item node of specified name.
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 const char * GetName() const
Returns name of object.
#define TBufferXML_operatorin(vname)
virtual ~TBufferXML()
Destroy xml buffer.
#define TBufferXML_operatorout(vname)
void XmlReadBlock(XMLNodePointer_t node)
Read binary block of data from xml.
TXMLStackObj * PushStack(XMLNodePointer_t current, Bool_t simple=kFALSE)
Add new level to xml stack.
virtual Int_t ReadStaticArray(Bool_t *b)
Read array of Bool_t from buffer.
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
virtual void WriteObject(const TObject *obj)
Convert object into xml structures.
virtual Int_t ReadStaticArrayFloat16(Float_t *f, TStreamerElement *ele=0)
Read array of Float16_t from buffer.
Int_t GetCompressionSettings() const
virtual void ReadFloat16(Float_t *f, TStreamerElement *ele=0)
Read a Float16_t from the buffer.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
virtual void WriteLong64(Long64_t l)
Writes Long64_t value to buffer.
ActionContainer_t fActions
void SetCompressionAlgorithm(Int_t algorithm=0)
See comments for function SetCompressionSettings.
virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0)
Read array of Double32_t from buffer.
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...
void XmlWriteBlock(XMLNodePointer_t node)
Write binary data block from buffer to xml.
void FreeAttr(XMLNodePointer_t xmlnode, const char *name)
remove attribute from xmlnode
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.
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.
virtual TClass * GetClass() const =0
TLoopConfiguration * fLoopConfig
If this is a bundle of memberwise streaming action, this configures the looping.
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.
virtual void WriteLong(Long_t l)
Writes Long_t value to buffer.
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
void SetCompressionSettings(Int_t settings=1)
Used to specify the compression level and algorithm.
void SetCompressionLevel(Int_t level=1)
See comments for function SetCompressionSettings.
TObject * GetParent() const
Return pointer to parent of this buffer.
EXMLLayout GetXmlLayout() const
#define TBufferXML_WriteArray(vname)
virtual void ReadTString(TString &s)
Read TString from TBuffer.
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...
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
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...
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.
virtual void SkipVersion(const TClass *cl=0)
Skip class version from I/O buffer.
virtual TObject * Remove(TObject *obj)
Remove object from array.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)
Suppressed function of TBuffer.
virtual void WriteCharStar(char *s)
Write a char* string.
void RegisterPointer(const void *ptr, XMLNodePointer_t node)
Register pair of object pointer and node, where this object is saved, in object map.
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.
virtual void WriteCharStar(char *s)
Write char* into TBuffer.
virtual TClass * ReadClass(const TClass *cl=0, UInt_t *objTag=0)
Function to read class from buffer, used in old-style streamers.
void SetParent(TObject *parent)
Set parent owning this buffer.
XMLNodePointer_t XmlWriteAny(const void *obj, const TClass *cl)
Convert object of any class to xml structures Return pointer on top xml element.
virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits)
Read array of Float16_t from buffer.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
void CreateElemNode(const TStreamerElement *elem)
Create xml node correspondent to TStreamerElement object.
TObject * At(Int_t idx) const
virtual void WriteTString(const TString &s)
Writes a TString.
virtual void WriteDouble32(Double_t *d, TStreamerElement *ele=0)
Write a Double32_t to the buffer.
virtual void SetMaxIndex(Int_t dim, Int_t max)
set maximum index for array with dimension dim
void UnlinkFreeNode(XMLNodePointer_t xmlnode)
combined operation. Unlink node and free used memory
XMLNodePointer_t XmlWriteValue(const char *value, const char *name)
Create xml node with specified name and adds it to stack node.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
XMLAttrPointer_t NewIntAttr(XMLNodePointer_t xmlnode, const char *name, Int_t value)
create node attribute with integer value
#define TBufferXML_WriteFastArray(vname)
virtual void WriteULong(ULong_t l)
Writes ULong_t value to buffer.
const char * GetNodeContent(XMLNodePointer_t xmlnode)
get contents (if any) of xml node
virtual void WriteStdString(const std::string *s)
Writes a TString.
virtual void ReadCharP(Char_t *c)
Reads array of characters from buffer.
TXMLFile * XmlFile()
Returns pointer to TXMLFile object.
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
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.
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
virtual void WriteShort(Short_t s)
Writes Short_t value to buffer.
virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0)
Read array of Float16_t from buffer.
virtual void * GetFirstAddress(void *start, const void *end) const =0
virtual void DecrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions and decrease level in xml ...
Bool_t VerifyNode(XMLNodePointer_t node, const char *name, const char *errinfo=0)
Check, if node has specified name.
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.
virtual void ReadCharStar(char *&s)
Read char* from TBuffer.
virtual void ReadCharStar(char *&s)
Read a char* string.
The TNamed class is the base class for all named ROOT classes.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
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 WriteStdString(const std::string *s)
Write std::string to TBuffer.
virtual void StreamObject(void *obj, const std::type_info &typeinfo, const TClass *onFileClass=0)
steram object to/from buffer
Int_t AtoI(const char *sbuf, Int_t def=0, const char *errinfo=0)
converts string to integer.
virtual void WriteUShort(UShort_t s)
Writes UShort_t value to buffer.
virtual void WriteUInt(UInt_t i)
Writes UInt_t value to buffer.
XMLNsPointer_t NewNS(XMLNodePointer_t xmlnode, const char *reference, const char *name=0)
create namespace attribute for xmlnode.
int R__unzip_header(Int_t *nin, UChar_t *bufin, Int_t *lout)
void SetIOVersion(Int_t v)
virtual void ReadStdString(std::string *s)
Reads a std::string.
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 ReadStdString(std::string *s)
Read std::string from TBuffer.
Base class of the Configurations for the member wise looping routines.
TObject()
TObject constructor.
virtual void ReadULong64(ULong64_t &l)
Reads ULong64_t value from buffer.
virtual void ReadBool(Bool_t &b)
Reads Bool_t value from buffer.
const char * GetNodeName(XMLNodePointer_t xmlnode)
returns name of xmlnode
XMLNodePointer_t StackNode()
Return pointer on current xml node.
void Expand(Int_t newsize, Bool_t copy=kTRUE)
Expand (or shrink) the I/O buffer to newsize bytes.
virtual void ReadUChar(UChar_t &c)
Reads UChar_t value from buffer.
virtual void WriteTString(const TString &s)
Write TString to TBuffer.
virtual void ReadDouble32(Double_t *d, TStreamerElement *ele=0)
Read a Double32_t from the buffer.
TStreamerInfo * fInfo
Pointer to TStreamerInfo object writing/reading the buffer.
Int_t GetLast() const
Return index of last object in array.
Int_t fIOVersion
! Indicates format of ROOT xml file
virtual void ReadUInt(UInt_t &i)
Reads UInt_t value from buffer.
const char * XmlGetElementName(const TStreamerElement *el)
return converted name for TStreamerElement
TClass * fExpectedBaseClass
! Pointer to class, which should be stored as parent of current
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
void ShiftStack(const char *info=0)
Shift stack node to next.
Bool_t VerifyStackAttr(const char *name, const char *value, const char *errinfo=0)
Checks stack attribute.
virtual void * ReadObjectAny(const TClass *clCast)
Read object from buffer. Only used from TBuffer.
void ShiftToNext(XMLNodePointer_t &xmlnode, Bool_t realnode=kTRUE)
shifts specified node to next if realnode==kTRUE, any special nodes in between will be skipped ...
TClass * GetClass() const
void SetXML(TXMLEngine *xml)
#define TBufferXML_ReadArray(tname, vname)
virtual void IncrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions and indent new level in xm...
Basic data type descriptor (datatype information is obtained from CINT).
virtual Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele=0)
Read array of Float16_t from buffer.
TBufferXML()
Default constructor.
virtual void WriteFloat16(Float_t *f, TStreamerElement *ele=0)
Write a Float16_t to the buffer.
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
static std::string fgFloatFmt
! Printf argument for floats and doubles, either "%f" or "%e" or "%10f" and so on ...
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
#define TBufferXML_ReadStaticArray(vname)
virtual void ClassEnd(const TClass *)
Should be called at the end of custom streamer See TBufferXML::ClassBegin for more details...
The ROOT global object gROOT contains a list of all defined classes.
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 ...
Int_t GetNextRefCounter()
Bool_t fCanUseCompact
! Flag indicate that basic type (like Int_t) can be placed in the same tag
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.
Bool_t VerifyElemNode(const TStreamerElement *elem)
Checks, if stack node correspond to TStreamerElement object.
void ExtractReference(XMLNodePointer_t node, const void *ptr, const TClass *cl)
Analyse, if node has "ref" attribute and register it to object map.
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 ...
void Streamer(void *obj, TBuffer &b, const TClass *onfile_class=0) const
virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass)
Write object to buffer. Only used from TBuffer.
Bool_t IsUseNamespaces() const
void SkipEmpty(XMLNodePointer_t &xmlnode)
Skip all current empty nodes and locate on first "true" node.
const char * XmlConvertClassName(const char *name)
convert class name to exclude any special symbols like ':', '<' '>' ',' and spaces ...
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...
Bool_t HasAttr(XMLNodePointer_t xmlnode, const char *name)
checks if node has attribute of specified name
static const char * GetFloatFormat()
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.
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...
Version_t GetClassVersion() const
XMLAttrPointer_t NewAttr(XMLNodePointer_t xmlnode, XMLNsPointer_t, const char *name, const char *value)
creates new attribute for xmlnode, namespaces are not supported for attributes
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.
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...
const char * GetAttr(XMLNodePointer_t xmlnode, const char *name)
returns value of attribute for xmlnode
void SaveSingleNode(XMLNodePointer_t xmlnode, TString *res, Int_t layout=1)
convert single xml node (and its child node) to string if layout<=0, no any spaces or newlines will b...
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
Int_t IndexOf(const TObject *obj) const
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 ...
void WorkWithClass(TStreamerInfo *info, const TClass *cl=0)
Prepares buffer to stream data of specified class.
Int_t GetCompressionLevel() const
const char * XmlClassNameSpaceRef(const TClass *cl)
produce string which used as reference in class namespace definition
virtual void ReadTString(TString &s)
Reads a TString.
virtual void WriteObject(const TObject *obj)
Write object to I/O buffer.
virtual void WriteDouble(Double_t d)
Writes Double_t value to buffer.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
void FreeNode(XMLNodePointer_t xmlnode)
release all memory, allocated fro this node and destroyes node itself
void R__unzip(Int_t *nin, UChar_t *bufin, Int_t *lout, char *bufout, Int_t *nout)
Bool_t VerifyItemNode(const char *name, const char *errinfo=0)
Checks, if stack node is item and has specified name.
TXMLStackObj * Stack(Int_t depth=0)
Return xml stack object of specified depth.
virtual void WriteBool(Bool_t b)
Writes Bool_t value to buffer.
Mother of all ROOT objects.
TObjArray * GetElements() const
XMLNodePointer_t XmlWriteBasic(Char_t value)
Converts Char_t to string and add xml node to buffer.
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Class for serializing/deserializing object to/from xml.
virtual void ReadLong64(Long64_t &l)
Reads Long64_t value from buffer.
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xml node
void * XmlReadObject(void *obj, TClass **cl=0)
Read object from the buffer.
virtual void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE)
Int_t GetIOVersion() const
Int_t GetCompressionAlgorithm() const
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)
Suppressed function of TBuffer.
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns, const char *name, const char *content=0)
create new child element for parent node
virtual void WriteFastArray(const Bool_t *b, Int_t n)
Write array of n bools into the I/O buffer.
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
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...
Int_t GetIntAttr(XMLNodePointer_t node, const char *name)
returns value of attribute as integer
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...
void SetBaseVersion(Int_t v)
TClass * XmlDefineClass(const char *xmlClassName)
define class for the converted class name, where special symbols were replaced by '_' ...
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.
XMLNodePointer_t ReadSingleNode(const char *src)
read single xml node from provided string
#define TBufferXML_ReadFastArray(vname)
virtual void Compress()
Remove empty slots from array.
Abstract Interface class describing Streamer information for one class.
const char * ClassVersion
virtual Int_t ReadArrayDouble32(Double_t *&d, TStreamerElement *ele=0)
Read array of Double32_t from buffer.
virtual void SetXmlLayout(EXMLLayout layout)
virtual void ReadFloat(Float_t &f)
Reads Float_t value from buffer.
TXMLStackObj * PopStack()
Remove one level from xml stack.
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.
virtual void ReadFastArray(Bool_t *b, Int_t n)
Read array of n bools from the I/O buffer.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
virtual const char * GetTitle() const
Returns title of object.
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.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
const char * Data() const
TVirtualStreamerInfo * fStreamerInfo
StreamerInfo used to derive these actions.