Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TXMLFile.cxx
Go to the documentation of this file.
1// @(#)root/xml:$Id: c6d85738bc844c3af55b6d85902df8fc3a014be2 $
2// Author: Sergey Linev, Rene Brun 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//________________________________________________________________________
13//
14// The main motivation for the XML format is to facilitate the
15// communication with other non ROOT applications. Currently
16// writing and reading XML files is limited to ROOT applications.
17// It is our intention to develop a simple reader independent
18// of the ROOT libraries that could be used as an example for
19// real applications. One of possible approach with code generation
20// is implemented in TXMLPlayer class.
21//
22// The XML format should be used only for small data volumes,
23// typically histogram files, pictures, geometries, calibrations.
24// The XML file is built in memory before being dumped to disk.
25//
26// Like for normal ROOT files, XML files use the same I/O mechanism
27// exploiting the ROOT/CINT dictionary. Any class having a dictionary
28// can be saved in XML format.
29//
30// This first implementation does not support subdirectories
31// or Trees.
32//
33// The shared library libRXML.so may be loaded dynamically
34// via gSystem->Load("libRXML"). This library is automatically
35// loaded by the plugin manager as soon as a XML file is created
36// via, eg
37// TFile::Open("file.xml","recreate");
38// TFile::Open returns a TXMLFile object. When a XML file is open in write mode,
39// one can use the normal TObject::Write to write an object in the file.
40// Alternatively one can use the new functions TDirectoryFile::WriteObject and
41// TDirectoryFile::WriteObjectAny to write a TObject* or any class not deriving
42// from TObject.
43//
44// example of a session saving a histogram to a XML file
45// =====================================================
46// TFile *f = TFile::Open("Example.xml","recreate");
47// TH1F *h = new TH1F("h","test",1000,-2,2);
48// h->FillRandom("gaus");
49// h->Write();
50// delete f;
51//
52// example of a session reading the histogram from the file
53// ========================================================
54// TFile *f = TFile::Open("Example.xml");
55// TH1F *h = (TH1F*)f->Get("h");
56// h->Draw();
57//
58// A new option in the canvas "File" menu is available to save
59// a TCanvas as a XML file. One can also do
60// canvas->Print("Example.xml");
61//
62// Configuring ROOT with the option "xml"
63// ======================================
64// The XML package is enabled by default
65//
66// documentation
67// =============
68// See also classes TBufferXML, TKeyXML, TXMLEngine, TXMLSetup and TXMLPlayer.
69// An example of XML file corresponding to the small example below
70// can be found at http://root.cern/root/Example.xml
71//
72//______________________________________________________________________________
73
74#include "TXMLFile.h"
75
76#include "TROOT.h"
77#include "TSystem.h"
78#include "TList.h"
79#include "TKeyXML.h"
80#include "TObjArray.h"
81#include "TArrayC.h"
82#include "TStreamerInfo.h"
83#include "TStreamerElement.h"
84#include "TProcessID.h"
85#include "TError.h"
86#include "TClass.h"
87#include "TVirtualMutex.h"
88
89#include <memory>
90
91
92
93////////////////////////////////////////////////////////////////////////////////
94/// Open or creates local XML file with name filename.
95/// It is recommended to specify filename as "<file>.xml". The suffix ".xml"
96/// will be used by object browsers to automatically identify the file as
97/// a XML file. If the constructor fails in any way IsZombie() will
98/// return true. Use IsOpen() to check if the file is (still) open.
99///
100/// If option = NEW or CREATE create a new file and open it for writing,
101/// if the file already exists the file is
102/// not opened.
103/// = RECREATE create a new file, if the file already
104/// exists it will be overwritten.
105/// = 2xoo create a new file with specified xml settings
106/// for more details see TXMLSetup class
107/// = UPDATE open an existing file for writing.
108/// if no file exists, it is created.
109/// = READ open an existing file for reading.
110///
111/// For more details see comments for TFile::TFile() constructor
112///
113/// TXMLFile does not support TTree objects
114
115TXMLFile::TXMLFile(const char *filename, Option_t *option, const char *title, Int_t compression)
116{
117 if (!gROOT)
118 ::Fatal("TFile::TFile", "ROOT system not initialized");
119
120 fXML = std::make_unique<TXMLEngine>();
121
122 if (filename && !strncmp(filename, "xml:", 4))
123 filename += 4;
124
125 gDirectory = nullptr;
127 SetTitle(title);
128 TDirectoryFile::Build(this, nullptr);
129
130 fD = -1;
131 fFile = this;
132 fFree = nullptr;
133 fVersion = gROOT->GetVersionInt(); // ROOT version in integer format
134 fUnits = 4;
135 fOption = option;
137 fWritten = 0;
138 fSumBuffer = 0;
139 fSum2Buffer = 0;
140 fBytesRead = 0;
141 fBytesWrite = 0;
142 fClassIndex = nullptr;
143 fSeekInfo = 0;
144 fNbytesInfo = 0;
145 fProcessIDs = nullptr;
146 fNProcessIDs = 0;
149
150 fOption = option;
152
153 if (fOption == "NEW")
154 fOption = "CREATE";
155
156 Bool_t create = (fOption == "CREATE") ? kTRUE : kFALSE;
157 Bool_t recreate = (fOption == "RECREATE") ? kTRUE : kFALSE;
158 Bool_t update = (fOption == "UPDATE") ? kTRUE : kFALSE;
159 Bool_t read = (fOption == "READ") ? kTRUE : kFALSE;
161 if (xmlsetup)
162 recreate = kTRUE;
163
164 if (!create && !recreate && !update && !read) {
165 read = kTRUE;
166 fOption = "READ";
167 }
168
170 const char *fname = nullptr;
171
172 if (!filename || !filename[0]) {
173 Error("TXMLFile", "file name is not specified");
174 goto zombie;
175 }
176
177 // support dumping to /dev/null on UNIX
179 devnull = kTRUE;
180 create = kTRUE;
182 update = kFALSE;
183 read = kFALSE;
184 fOption = "CREATE";
186 }
187
188 gROOT->cd();
189
191 if (fname) {
192 SetName(fname);
193 delete[](char *) fname;
194 fname = GetName();
195 } else {
196 Error("TXMLFile", "error expanding path %s", filename);
197 goto zombie;
198 }
199
200 if (recreate) {
203 create = kTRUE;
204 fOption = "CREATE";
205 }
206
207 if (create && !devnull && !gSystem->AccessPathName(fname, kFileExists)) {
208 Error("TXMLFile", "file %s already exists", fname);
209 goto zombie;
210 }
211
212 if (update) {
214 update = kFALSE;
215 create = kTRUE;
216 }
218 Error("TXMLFile", "no write permission, could not open file %s", fname);
219 goto zombie;
220 }
221 }
222
223 if (read) {
225 Error("TXMLFile", "file %s does not exist", fname);
226 goto zombie;
227 }
229 Error("TXMLFile", "no read permission, could not open file %s", fname);
230 goto zombie;
231 }
232 }
233
235
236 if (create || update)
238 else
240
241 if (create) {
242 if (xmlsetup)
244 else
246 }
247
248 InitXmlFile(create);
249
250 return;
251
252zombie:
253 MakeZombie();
255}
256
257////////////////////////////////////////////////////////////////////////////////
258/// initialize xml file and correspondent structures
259/// identical to TFile::Init() function
260
262{
263 Int_t len = gROOT->GetListOfStreamerInfo()->GetSize() + 1;
264 if (len < 5000)
265 len = 5000;
266 fClassIndex = new TArrayC(len);
267 fClassIndex->Reset(0);
268
269 if (create) {
270 fDoc = fXML->NewDoc();
271 XMLNodePointer_t fRootNode = fXML->NewChild(nullptr, nullptr, xmlio::Root);
272 fXML->DocSetRootElement(fDoc, fRootNode);
273 } else {
274 ReadFromFile();
275 }
276
277 {
279 gROOT->GetListOfFiles()->Add(this);
280 }
281 cd();
282
283 fNProcessIDs = 0;
284 TKey *key = nullptr;
285 TIter iter(fKeys);
286 while ((key = (TKey *)iter()) != nullptr) {
287 if (!strcmp(key->GetClassName(), "TProcessID"))
288 fNProcessIDs++;
289 }
290
292}
293
294////////////////////////////////////////////////////////////////////////////////
295/// Close a XML file
296/// For more comments see TFile::Close() function
297
299{
300 if (!IsOpen())
301 return;
302
303 TString opt = option;
304 if (opt.Length() > 0)
305 opt.ToLower();
306
307 if (IsWritable())
308 SaveToFile();
309
311
312 if (fDoc) {
313 fXML->FreeDoc(fDoc);
314 fDoc = nullptr;
315 }
316
317 if (fClassIndex) {
318 delete fClassIndex;
319 fClassIndex = nullptr;
320 }
321
322 if (fStreamerInfoNode) {
323 fXML->FreeNode(fStreamerInfoNode);
324 fStreamerInfoNode = nullptr;
325 }
326
327 {
329 // Delete all supported directories structures from memory
331 }
332
333 // delete the TProcessIDs
335 TIter next(fProcessIDs);
336 TProcessID *pid;
337 while ((pid = (TProcessID *)next())) {
338 if (!pid->DecrementCount()) {
340 pidDeleted.Add(pid);
341 } else if (opt.Contains("r")) {
342 pid->Clear();
343 }
344 }
345 pidDeleted.Delete();
346
348 gROOT->GetListOfFiles()->Remove(this);
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// destructor of TXMLFile object
353
355{
356 Close();
357}
358
359////////////////////////////////////////////////////////////////////////////////
360/// return kTRUE if file is opened and can be accessed
361
363{
364 return fDoc != nullptr;
365}
366
367////////////////////////////////////////////////////////////////////////////////
368/// Reopen a file with a different access mode, like from READ to
369/// See TFile::Open() for details
370
372{
373 cd();
374
375 TString opt = mode;
376 opt.ToUpper();
377
378 if (opt != "READ" && opt != "UPDATE") {
379 Error("ReOpen", "mode must be either READ or UPDATE, not %s", opt.Data());
380 return 1;
381 }
382
383 if (opt == fOption || (opt == "UPDATE" && fOption == "CREATE"))
384 return 1;
385
386 if (opt == "READ") {
387 // switch to READ mode
388
389 if (IsOpen() && IsWritable())
390 SaveToFile();
391 fOption = opt;
392
394
395 } else {
396 fOption = opt;
397
399 }
400
401 return 0;
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// create XML key, which will store object in xml structures
406
408{
409 return new TKeyXML(mother, ++fKeyCounter, obj, name);
410}
411
412////////////////////////////////////////////////////////////////////////////////
413/// create XML key, which will store object in xml structures
414
415TKey *TXMLFile::CreateKey(TDirectory *mother, const void *obj, const TClass *cl, const char *name, Int_t)
416{
417 return new TKeyXML(mother, ++fKeyCounter, obj, cl, name);
418}
419
420////////////////////////////////////////////////////////////////////////////////
421/// function produces pair of xml and dtd file names
422
424{
425 fname = filename;
427
429
430 if (fname.Length() > 4) {
431 TString last = fname(fname.Length() - 4, 4);
432 last.ToLower();
433 hasxmlext = (last == ".xml");
434 }
435
436 if (hasxmlext) {
437 dtdname.Replace(dtdname.Length() - 4, 4, ".dtd");
438 } else {
439 fname += ".xml";
440 dtdname += ".dtd";
441 }
442}
443
444////////////////////////////////////////////////////////////////////////////////
445/// Saves xml structures to the file
446/// xml elements are kept in list of TKeyXML objects
447/// When saving, all this elements are linked to root xml node
448/// At the end StreamerInfo structures are added
449/// After xml document is saved, all nodes will be unlinked from root node
450/// and kept in memory.
451/// Only Close() or destructor release memory, used by xml structures
452
454{
455 if (!fDoc)
456 return;
457
458 if (gDebug > 1)
459 Info("SaveToFile", "File: %s", fRealName.Data());
460
461 XMLNodePointer_t fRootNode = fXML->DocGetRootElement(fDoc);
462
463 fXML->FreeAttr(fRootNode, xmlio::Setup);
464 fXML->NewAttr(fRootNode, nullptr, xmlio::Setup, GetSetupAsString());
465
466 fXML->FreeAttr(fRootNode, xmlio::Ref);
467 fXML->NewAttr(fRootNode, nullptr, xmlio::Ref, xmlio::Null);
468
469 if (GetIOVersion() > 1) {
470
471 fXML->FreeAttr(fRootNode, xmlio::CreateTm);
473 fXML->NewAttr(fRootNode, nullptr, xmlio::CreateTm, TDatime((UInt_t) 1).AsSQLString());
474 else
475 fXML->NewAttr(fRootNode, nullptr, xmlio::CreateTm, fDatimeC.AsSQLString());
476
477 fXML->FreeAttr(fRootNode, xmlio::ModifyTm);
479 fXML->NewAttr(fRootNode, nullptr, xmlio::ModifyTm, TDatime((UInt_t) 1).AsSQLString());
480 else
481 fXML->NewAttr(fRootNode, nullptr, xmlio::ModifyTm, fDatimeM.AsSQLString());
482
483 fXML->FreeAttr(fRootNode, xmlio::ObjectUUID);
485 fXML->NewAttr(fRootNode, nullptr, xmlio::ObjectUUID, TUUID("00000000-0000-0000-0000-000000000000").AsString());
486 else
487 fXML->NewAttr(fRootNode, nullptr, xmlio::ObjectUUID, fUUID.AsString());
488
489 fXML->FreeAttr(fRootNode, xmlio::Title);
490 if (strlen(GetTitle()) > 0)
491 fXML->NewAttr(fRootNode, nullptr, xmlio::Title, GetTitle());
492
493 fXML->FreeAttr(fRootNode, xmlio::IOVersion);
494 fXML->NewIntAttr(fRootNode, xmlio::IOVersion, GetIOVersion());
495
496 fXML->FreeAttr(fRootNode, "file_version");
497 fXML->NewIntAttr(fRootNode, "file_version", fVersion);
498 }
499
502
503 /*
504 TIter iter(GetListOfKeys());
505 TKeyXML* key = nullptr;
506 while ((key=(TKeyXML*)iter()) != nullptr)
507 fXML->AddChild(fRootNode, key->KeyNode());
508 */
509
510 CombineNodesTree(this, fRootNode, kTRUE);
511
513
515 fXML->AddChild(fRootNode, fStreamerInfoNode);
516
517 Int_t layout = GetCompressionLevel() > 5 ? 0 : 1;
518
519 fXML->SaveDoc(fDoc, fname, layout);
520
521 /* iter.Reset();
522 while ((key=(TKeyXML*)iter()) != nullptr)
523 fXML->UnlinkNode(key->KeyNode());
524 */
525 CombineNodesTree(this, fRootNode, kFALSE);
526
528 fXML->UnlinkNode(fStreamerInfoNode);
529}
530
531////////////////////////////////////////////////////////////////////////////////
532/// Connect/disconnect all file nodes to single tree before/after saving
533
535{
536 if (!dir)
537 return;
538
539 TIter iter(dir->GetListOfKeys());
540 TKeyXML *key = nullptr;
541
542 while ((key = (TKeyXML *)iter()) != nullptr) {
543 if (dolink)
544 fXML->AddChild(topnode, key->KeyNode());
545 else
546 fXML->UnlinkNode(key->KeyNode());
547 if (key->IsSubdir())
548 CombineNodesTree(FindKeyDir(dir, key->GetKeyId()), key->KeyNode(), dolink);
549 }
550}
551
552////////////////////////////////////////////////////////////////////////////////
553/// read document from file
554/// Now full content of document reads into the memory
555/// Then document decomposed to separate keys and streamer info structures
556/// All irrelevant data will be cleaned
557
559{
560 fDoc = fXML->ParseFile(fRealName);
561 if (!fDoc)
562 return kFALSE;
563
564 XMLNodePointer_t fRootNode = fXML->DocGetRootElement(fDoc);
565
566 if (!fRootNode || !fXML->ValidateVersion(fDoc)) {
567 fXML->FreeDoc(fDoc);
568 fDoc = nullptr;
569 return kFALSE;
570 }
571
572 ReadSetupFromStr(fXML->GetAttr(fRootNode, xmlio::Setup));
573
574 if (fXML->HasAttr(fRootNode, xmlio::CreateTm)) {
575 TDatime tm(fXML->GetAttr(fRootNode, xmlio::CreateTm));
576 fDatimeC = tm;
577 }
578
579 if (fXML->HasAttr(fRootNode, xmlio::ModifyTm)) {
580 TDatime tm(fXML->GetAttr(fRootNode, xmlio::ModifyTm));
581 fDatimeM = tm;
582 }
583
584 if (fXML->HasAttr(fRootNode, xmlio::ObjectUUID)) {
585 TUUID id(fXML->GetAttr(fRootNode, xmlio::ObjectUUID));
586 fUUID = id;
587 }
588
589 if (fXML->HasAttr(fRootNode, xmlio::Title))
590 SetTitle(fXML->GetAttr(fRootNode, xmlio::Title));
591
592 if (fXML->HasAttr(fRootNode, xmlio::IOVersion))
593 fIOVersion = fXML->GetIntAttr(fRootNode, xmlio::IOVersion);
594 else
595 fIOVersion = 1;
596
597 if (fXML->HasAttr(fRootNode, "file_version"))
598 fVersion = fXML->GetIntAttr(fRootNode, "file_version");
599
600 fStreamerInfoNode = fXML->GetChild(fRootNode);
601 fXML->SkipEmpty(fStreamerInfoNode);
602 while (fStreamerInfoNode) {
603 if (strcmp(xmlio::SInfos, fXML->GetNodeName(fStreamerInfoNode)) == 0)
604 break;
605 fXML->ShiftToNext(fStreamerInfoNode);
606 }
607 fXML->UnlinkNode(fStreamerInfoNode);
608
611
612 if (IsUseDtd())
613 if (!fXML->ValidateDocument(fDoc, gDebug > 0)) {
614 fXML->FreeDoc(fDoc);
615 fDoc = nullptr;
616 return kFALSE;
617 }
618
619 ReadKeysList(this, fRootNode);
620
621 fXML->CleanNode(fRootNode);
622
623 return kTRUE;
624}
625
626////////////////////////////////////////////////////////////////////////////////
627/// Read list of keys for directory
628
630{
631 if (!dir || !topnode)
632 return 0;
633
634 Int_t nkeys = 0;
635
637 fXML->SkipEmpty(keynode);
638 while (keynode) {
639 XMLNodePointer_t next = fXML->GetNext(keynode);
640
641 if (strcmp(xmlio::Xmlkey, fXML->GetNodeName(keynode)) == 0) {
642 fXML->UnlinkNode(keynode);
643
644 TKeyXML *key = new TKeyXML(dir, ++fKeyCounter, keynode);
645 dir->AppendKey(key);
646
647 if (gDebug > 2)
648 Info("ReadKeysList", "Add key %s from node %s", key->GetName(), fXML->GetNodeName(keynode));
649
650 nkeys++;
651 }
652
653 keynode = next;
654 fXML->SkipEmpty(keynode);
655 }
656
657 return nkeys;
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// convert all TStreamerInfo, used in file, to xml format
662
664{
665 if (fStreamerInfoNode) {
666 fXML->FreeNode(fStreamerInfoNode);
667 fStreamerInfoNode = nullptr;
668 }
669
671 return;
672
673 TObjArray list;
674
675 TIter iter(gROOT->GetListOfStreamerInfo());
676
677 TStreamerInfo *info = nullptr;
678
679 while ((info = (TStreamerInfo *)iter()) != nullptr) {
680 Int_t uid = info->GetNumber();
681 if (fClassIndex->fArray[uid])
682 list.Add(info);
683 }
684
685 if (list.GetSize() == 0)
686 return;
687
688 fStreamerInfoNode = fXML->NewChild(nullptr, nullptr, xmlio::SInfos);
689 for (int n = 0; n <= list.GetLast(); n++) {
690 info = (TStreamerInfo *)list.At(n);
691
692 XMLNodePointer_t infonode = fXML->NewChild(fStreamerInfoNode, nullptr, "TStreamerInfo");
693
694 fXML->NewAttr(infonode, nullptr, "name", info->GetName());
695 fXML->NewAttr(infonode, nullptr, "title", info->GetTitle());
696
697 fXML->NewIntAttr(infonode, "v", info->IsA()->GetClassVersion());
698 fXML->NewIntAttr(infonode, "classversion", info->GetClassVersion());
699 fXML->NewAttr(infonode, nullptr, "canoptimize",
701 fXML->NewIntAttr(infonode, "checksum", info->GetCheckSum());
702
703 TIter iter2(info->GetElements());
704 TStreamerElement *elem = nullptr;
705 while ((elem = (TStreamerElement *)iter2()) != nullptr)
707 }
708}
709
710////////////////////////////////////////////////////////////////////////////////
711/// Read streamerinfo structures from xml format and provide them in the list
712/// It is user responsibility to destroy this list
713
715{
717
719 return {nullptr, 1, hash};
720
721 TList *list = new TList();
722
724 fXML->SkipEmpty(sinfonode);
725
726 while (sinfonode) {
727 if (strcmp("TStreamerInfo", fXML->GetNodeName(sinfonode)) == 0) {
728 TString fname = fXML->GetAttr(sinfonode, "name");
729 TString ftitle = fXML->GetAttr(sinfonode, "title");
730
732 info->SetTitle(ftitle);
733
734 list->Add(info);
735
736 Int_t clversion = AtoI(fXML->GetAttr(sinfonode, "classversion"));
737 info->SetClassVersion(clversion);
738 info->SetOnFileClassVersion(clversion);
739 Int_t checksum = AtoI(fXML->GetAttr(sinfonode, "checksum"));
740 info->SetCheckSum(checksum);
741
742 const char *canoptimize = fXML->GetAttr(sinfonode, "canoptimize");
745 else
747
748 XMLNodePointer_t node = fXML->GetChild(sinfonode);
749 fXML->SkipEmpty(node);
750 while (node) {
752 fXML->ShiftToNext(node);
753 }
754 }
755 fXML->ShiftToNext(sinfonode);
756 }
757
758 list->SetOwner();
759
760 return {list, 0, hash};
761}
762
763////////////////////////////////////////////////////////////////////////////////
764/// store data of single TStreamerElement in streamer node
765
767{
768 TClass *cl = elem->IsA();
769
770 XMLNodePointer_t node = fXML->NewChild(infonode, nullptr, cl->GetName());
771
772 constexpr std::size_t bufferSize = 100;
773 char sbuf[bufferSize];
774 char namebuf[bufferSize];
775
776 fXML->NewAttr(node, nullptr, "name", elem->GetName());
777 if (strlen(elem->GetTitle()) > 0)
778 fXML->NewAttr(node, nullptr, "title", elem->GetTitle());
779
780 fXML->NewIntAttr(node, "v", cl->GetClassVersion());
781
782 fXML->NewIntAttr(node, "type", elem->GetType());
783
784 if (strlen(elem->GetTypeName()) > 0)
785 fXML->NewAttr(node, nullptr, "typename", elem->GetTypeName());
786
787 fXML->NewIntAttr(node, "size", elem->GetSize());
788
789 if (elem->GetArrayDim() > 0) {
790 fXML->NewIntAttr(node, "numdim", elem->GetArrayDim());
791
792 for (int ndim = 0; ndim < elem->GetArrayDim(); ndim++) {
793 snprintf(namebuf, bufferSize, "dim%d", ndim);
794 fXML->NewIntAttr(node, namebuf, elem->GetMaxIndex(ndim));
795 }
796 }
797
798 if (cl == TStreamerBase::Class()) {
800 snprintf(sbuf, bufferSize, "%d", base->GetBaseVersion());
801 fXML->NewAttr(node, nullptr, "baseversion", sbuf);
802 snprintf(sbuf, bufferSize, "%d", base->GetBaseCheckSum());
803 fXML->NewAttr(node, nullptr, "basechecksum", sbuf);
804 } else if (cl == TStreamerBasicPointer::Class()) {
806 fXML->NewIntAttr(node, "countversion", bptr->GetCountVersion());
807 fXML->NewAttr(node, nullptr, "countname", bptr->GetCountName());
808 fXML->NewAttr(node, nullptr, "countclass", bptr->GetCountClass());
809 } else if (cl == TStreamerLoop::Class()) {
811 fXML->NewIntAttr(node, "countversion", loop->GetCountVersion());
812 fXML->NewAttr(node, nullptr, "countname", loop->GetCountName());
813 fXML->NewAttr(node, nullptr, "countclass", loop->GetCountClass());
814 } else if ((cl == TStreamerSTL::Class()) || (cl == TStreamerSTLstring::Class())) {
816 fXML->NewIntAttr(node, "STLtype", stl->GetSTLtype());
817 fXML->NewIntAttr(node, "Ctype", stl->GetCtype());
818 }
819}
820
821////////////////////////////////////////////////////////////////////////////////
822/// read and reconstruct single TStreamerElement from xml node
823
825{
826 TClass *cl = TClass::GetClass(fXML->GetNodeName(node));
827 if (!cl || !cl->InheritsFrom(TStreamerElement::Class()))
828 return;
829
831
832 int elem_type = fXML->GetIntAttr(node, "type");
833
834 elem->SetName(fXML->GetAttr(node, "name"));
835 elem->SetTitle(fXML->GetAttr(node, "title"));
836 elem->SetType(elem_type);
837 elem->SetTypeName(fXML->GetAttr(node, "typename"));
838 elem->SetSize(fXML->GetIntAttr(node, "size"));
839
840 if (cl == TStreamerBase::Class()) {
841 int basever = fXML->GetIntAttr(node, "baseversion");
842 ((TStreamerBase *)elem)->SetBaseVersion(basever);
843 Int_t baseCheckSum = fXML->GetIntAttr(node, "basechecksum");
844 ((TStreamerBase *)elem)->SetBaseCheckSum(baseCheckSum);
845 } else if (cl == TStreamerBasicPointer::Class()) {
846 TString countname = fXML->GetAttr(node, "countname");
847 TString countclass = fXML->GetAttr(node, "countclass");
848 Int_t countversion = fXML->GetIntAttr(node, "countversion");
849
850 ((TStreamerBasicPointer *)elem)->SetCountVersion(countversion);
851 ((TStreamerBasicPointer *)elem)->SetCountName(countname);
852 ((TStreamerBasicPointer *)elem)->SetCountClass(countclass);
853 } else if (cl == TStreamerLoop::Class()) {
854 TString countname = fXML->GetAttr(node, "countname");
855 TString countclass = fXML->GetAttr(node, "countclass");
856 Int_t countversion = fXML->GetIntAttr(node, "countversion");
857 ((TStreamerLoop *)elem)->SetCountVersion(countversion);
858 ((TStreamerLoop *)elem)->SetCountName(countname);
859 ((TStreamerLoop *)elem)->SetCountClass(countclass);
860 } else if ((cl == TStreamerSTL::Class()) || (cl == TStreamerSTLstring::Class())) {
861 int fSTLtype = fXML->GetIntAttr(node, "STLtype");
862 int fCtype = fXML->GetIntAttr(node, "Ctype");
863 ((TStreamerSTL *)elem)->SetSTLtype(fSTLtype);
864 ((TStreamerSTL *)elem)->SetCtype(fCtype);
865 }
866
867 char namebuf[100];
868
869 if (fXML->HasAttr(node, "numdim")) {
870 int numdim = fXML->GetIntAttr(node, "numdim");
871 elem->SetArrayDim(numdim);
872 for (int ndim = 0; ndim < numdim; ndim++) {
873 snprintf(namebuf, 100, "dim%d", ndim);
874 int maxi = fXML->GetIntAttr(node, namebuf);
875 elem->SetMaxIndex(ndim, maxi);
876 }
877 }
878
879 elem->SetType(elem_type);
880 elem->SetNewType(elem_type);
881
882 info->GetElements()->Add(elem);
883}
884
885////////////////////////////////////////////////////////////////////////////////
886/// Change layout of objects in xml file
887/// Can be changed only for newly created file.
888///
889/// Currently there are two supported layouts:
890///
891/// TXMLSetup::kSpecialized = 2
892/// This is default layout of the file, when xml nodes names class names and data member
893/// names are used. For instance:
894/// `<TAttLine version="1">`
895/// `<fLineColor v="1"/>`
896/// `<fLineStyle v="1"/>`
897/// `<fLineWidth v="1"/>`
898/// `</TAttLine>`
899///
900/// TXMLSetup::kGeneralized = 3
901/// For this layout all nodes name does not depend from class definitions.
902/// The same class looks like
903/// `<Class name="TAttLine" version="1">`
904/// `<Member name="fLineColor" v="1"/>`
905/// `<Member name="fLineStyle" v="1"/>`
906/// `<Member name="fLineWidth" v="1"/>`
907/// `</Member>`
908///
909
915
916////////////////////////////////////////////////////////////////////////////////
917/// If true, all correspondent to file TStreamerInfo objects will be stored in file
918/// this allows to apply schema evolution later for this file
919/// may be useful, when file used outside ROOT and TStreamerInfo objects does not required
920/// Can be changed only for newly created file.
921
927
928////////////////////////////////////////////////////////////////////////////////
929/// Specify usage of DTD for this file.
930/// Currently this option not available (always false).
931/// Can be changed only for newly created file.
932
938
939////////////////////////////////////////////////////////////////////////////////
940/// Specify usage of namespaces in xml file
941/// In current implementation every instrumented class in file gets its unique namespace,
942/// which is equal to name of class and refer to root documentation page.
943/// And xml node for class member gets its name as combination of class name and member name
944/// `<TAttPad:fLeftMargin v="0.100000"/>`
945/// `<TAttPad:fRightMargin v="0.100000"/>`
946/// `<TAttPad:fBottomMargin v="0.100000"/>`
947/// and so on
948/// Usage of namespace increase size of xml file, but makes file more readable
949/// and allows to produce DTD in the case, when in several classes data member has same name
950/// Can be changed only for newly created file.
951
957
958////////////////////////////////////////////////////////////////////////////////
959/// Add comment line on the top of the xml document
960/// This line can only be seen in xml editor and cannot be accessed later
961/// with TXMLFile methods
962
963Bool_t TXMLFile::AddXmlComment(const char *comment)
964{
965 if (!IsWritable())
966 return kFALSE;
967
968 return fXML->AddDocComment(fDoc, comment);
969}
970
971////////////////////////////////////////////////////////////////////////////////
972/// Adds style sheet definition on the top of xml document
973/// Creates <?xml-stylesheet alternate="yes" title="compact" href="small-base.css" type="text/css"?>
974/// Attributes href and type must be supplied,
975/// other attributes: title, alternate, media, charset are optional
976/// if alternate==0, attribute alternate="no" will be created,
977/// if alternate>0, attribute alternate="yes"
978/// if alternate<0, attribute will not be created
979/// This style sheet definition cannot be later access with TXMLFile methods.
980
981Bool_t TXMLFile::AddXmlStyleSheet(const char *href, const char *type, const char *title, int alternate,
982 const char *media, const char *charset)
983{
984 if (!IsWritable())
985 return kFALSE;
986
987 return fXML->AddDocStyleSheet(fDoc, href, type, title, alternate, media, charset);
988}
989
990////////////////////////////////////////////////////////////////////////////////
991/// Add just one line on the top of xml document
992/// For instance, line can contain special xml processing instructions
993/// Line should has correct xml syntax that later it can be decoded by xml parser
994/// To be parsed later by TXMLFile again, this line should contain either
995/// xml comments or xml processing instruction
996
998{
999 if (!IsWritable())
1000 return kFALSE;
1001
1002 return fXML->AddDocRawLine(fDoc, line);
1003}
1004
1005////////////////////////////////////////////////////////////////////////////////
1006/// Create key for directory entry in the key
1007
1009{
1010 TDirectory *mother = dir->GetMotherDir();
1011 if (!mother)
1012 mother = this;
1013
1014 TKeyXML *key = new TKeyXML(mother, ++fKeyCounter, dir, dir->GetName(), dir->GetTitle());
1015
1016 key->SetSubir();
1017
1018 return key->GetKeyId();
1019}
1020
1021////////////////////////////////////////////////////////////////////////////////
1022/// Search for key which correspond to directory dir
1023
1025{
1027 if (!motherdir)
1028 motherdir = this;
1029
1030 TIter next(motherdir->GetListOfKeys());
1031 TObject *obj = nullptr;
1032
1033 while ((obj = next()) != nullptr) {
1034 TKeyXML *key = dynamic_cast<TKeyXML *>(obj);
1035
1036 if (key)
1037 if (key->GetKeyId() == dir->GetSeekDir())
1038 return key;
1039 }
1040
1041 return nullptr;
1042}
1043
1044////////////////////////////////////////////////////////////////////////////////
1045/// Find a directory in motherdir with a seek equal to keyid
1046
1048{
1049 if (!motherdir)
1050 motherdir = this;
1051
1052 TIter next(motherdir->GetList());
1053 TObject *obj = nullptr;
1054
1055 while ((obj = next()) != nullptr) {
1056 TDirectory *dir = dynamic_cast<TDirectory *>(obj);
1057 if (dir)
1058 if (dir->GetSeekDir() == keyid)
1059 return dir;
1060 }
1061
1062 return nullptr;
1063}
1064
1065////////////////////////////////////////////////////////////////////////////////
1066/// Read keys for directory
1067/// Make sense only once, while next time no new subnodes will be created
1068
1070{
1071 TKeyXML *key = FindDirKey(dir);
1072 if (!key)
1073 return 0;
1074
1075 return ReadKeysList(dir, key->KeyNode());
1076}
1077
1078////////////////////////////////////////////////////////////////////////////////
1079/// Update key attributes
1080
1082{
1083 TIter next(GetListOfKeys());
1084 TObject *obj = nullptr;
1085
1086 while ((obj = next()) != nullptr) {
1087 TKeyXML *key = dynamic_cast<TKeyXML *>(obj);
1088 if (key)
1089 key->UpdateAttributes();
1090 }
1091}
1092
1093////////////////////////////////////////////////////////////////////////////////
1094/// Write the directory header
1095
1097{
1098 TKeyXML *key = FindDirKey(dir);
1099 if (key)
1100 key->UpdateObject(dir);
1101}
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gDirectory
Definition TDirectory.h:385
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:241
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
Definition TError.cxx:267
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
Definition TROOT.cxx:627
R__EXTERN TVirtualMutex * gROOTMutex
Definition TROOT.h:63
#define gROOT
Definition TROOT.h:411
@ kFileExists
Definition TSystem.h:52
@ kReadPermission
Definition TSystem.h:55
@ kWritePermission
Definition TSystem.h:54
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
#define R__LOCKGUARD(mutex)
void * XMLNodePointer_t
Definition TXMLEngine.h:17
#define snprintf
Definition civetweb.c:1579
Array of chars or bytes (8 bits per element).
Definition TArrayC.h:27
Char_t * fArray
Definition TArrayC.h:30
void Reset(Char_t val=0)
Definition TArrayC.h:47
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition TClass.cxx:5017
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4901
Version_t GetClassVersion() const
Definition TClass.h:432
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.
Definition TClass.cxx:2973
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
const char * AsSQLString() const
Return the date & time in SQL compatible string format, like: 1997-01-15 20:16:28.
Definition TDatime.cxx:151
void Close(Option_t *option="") override
Delete all objects from memory and directory structure itself.
Bool_t cd() override
Change current directory to "this" directory.
TFile * fFile
Pointer to current file in memory.
Bool_t IsWritable() const override
TDatime fDatimeM
Date and time of last modification.
TList * GetListOfKeys() const override
TDatime fDatimeC
Date and time when directory is created.
Bool_t fWritable
True if directory is writable.
void SetWritable(Bool_t writable=kTRUE) override
Set the new value of fWritable recursively.
void Build(TFile *motherFile=nullptr, TDirectory *motherDir=nullptr) override
TList * fKeys
Pointer to keys list in memory.
TDirectory::TContext keeps track and restore the current directory.
Definition TDirectory.h:89
Describe directory structure in memory.
Definition TDirectory.h:45
virtual Long64_t GetSeekDir() const
Definition TDirectory.h:229
virtual Int_t AppendKey(TKey *)
Definition TDirectory.h:185
void SetName(const char *newname) override
Set the name for directory If the directory name is changed after the directory was written once,...
virtual TList * GetListOfKeys() const
Definition TDirectory.h:224
TUUID fUUID
Definition TDirectory.h:143
TDirectory * GetMotherDir() const
Definition TDirectory.h:226
Long64_t fBytesRead
Number of bytes read from this file.
Definition TFile.h:155
Double_t fSum2Buffer
Sum of squares of buffer sizes of objects written so far.
Definition TFile.h:153
virtual void ReadStreamerInfo()
Read the list of StreamerInfo from this file.
Definition TFile.cxx:3280
TArrayC * fClassIndex
!Index of TStreamerInfo classes written to this file
Definition TFile.h:173
Long64_t fSeekInfo
Location on disk of StreamerInfo record.
Definition TFile.h:160
Int_t fVersion
File format version.
Definition TFile.h:162
Int_t fNbytesInfo
Number of bytes for StreamerInfo record.
Definition TFile.h:165
virtual void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Used to specify the compression level and algorithm.
Definition TFile.cxx:2368
Int_t GetCompressionLevel() const
Definition TFile.h:474
TString fOption
File options.
Definition TFile.h:170
Int_t fD
File descriptor.
Definition TFile.h:161
Char_t fUnits
Number of bytes for file pointers.
Definition TFile.h:171
TObjArray * fProcessIDs
!Array of pointers to TProcessIDs
Definition TFile.h:174
Long64_t fBytesWrite
Number of bytes written to this file.
Definition TFile.h:154
TList * fFree
Free segments linked list table.
Definition TFile.h:172
TString fRealName
Effective real file name (not original url)
Definition TFile.h:169
Double_t fSumBuffer
Sum of buffer sizes of objects written so far.
Definition TFile.h:152
@ kReproducible
Definition TFile.h:272
@ kDevNull
Definition TFile.h:268
@ kBinaryFile
Definition TFile.h:270
Int_t fNProcessIDs
Number of TProcessID written to this file.
Definition TFile.h:167
Int_t fWritten
Number of objects written so far.
Definition TFile.h:166
void UpdateObject(TObject *obj)
updates object, stored in the node Used for TDirectory data update
Definition TKeyXML.cxx:217
Long64_t GetKeyId() const
Definition TKeyXML.h:62
XMLNodePointer_t KeyNode() const
Definition TKeyXML.h:61
Bool_t IsSubdir() const
Definition TKeyXML.h:63
void UpdateAttributes()
update key attributes in key node
Definition TKeyXML.cxx:202
void SetSubir()
Definition TKeyXML.h:64
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
virtual const char * GetClassName() const
Definition TKey.h:75
A doubly linked list.
Definition TList.h:38
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:202
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:864
void MakeZombie()
Definition TObject.h:53
A TProcessID identifies a ROOT job in a unique way in time and space.
Definition TProcessID.h:74
void Clear(Option_t *option="") override
delete the TObjArray pointing to referenced objects this function is called by TFile::Close("R")
static TProcessID * GetSessionProcessID()
static function returning the pointer to the session TProcessID
Int_t DecrementCount()
The reference fCount is used to delete the TProcessID in the TFile destructor when fCount = 0.
UInt_t GetBaseCheckSum()
static TClass * Class()
static TClass * Class()
Describe one element (data member) to be Streamed.
static TClass * Class()
Describes a persistent version of a class.
const char * GetCountName() const
Int_t GetCountVersion() const
const char * GetCountClass() const
static TClass * Class()
static TClass * Class()
static TClass * Class()
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:425
void ToLower()
Change string to lower-case.
Definition TString.cxx:1189
const char * Data() const
Definition TString.h:384
void ToUpper()
Change string to upper case.
Definition TString.cxx:1202
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:640
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition TSystem.cxx:1285
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1307
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1392
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
Definition TUUID.h:42
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
Definition TUUID.cxx:570
~TXMLFile() override
destructor of TXMLFile object
Definition TXMLFile.cxx:354
Bool_t IsOpen() const final
return kTRUE if file is opened and can be accessed
Definition TXMLFile.cxx:362
Int_t fIOVersion
object for interface with xml library
Definition TXMLFile.h:136
TXMLFile()
Definition TXMLFile.h:51
TDirectory * FindKeyDir(TDirectory *mother, Long64_t keyid)
Find a directory in motherdir with a seek equal to keyid.
TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize) final
create XML key, which will store object in xml structures
Definition TXMLFile.cxx:407
void InitXmlFile(Bool_t create)
initialize xml file and correspondent structures identical to TFile::Init() function
Definition TXMLFile.cxx:261
Bool_t AddXmlStyleSheet(const char *href, const char *type="text/css", const char *title=nullptr, int alternate=-1, const char *media=nullptr, const char *charset=nullptr)
Adds style sheet definition on the top of xml document Creates <?xml-stylesheet alternate="yes" title...
Definition TXMLFile.cxx:981
InfoListRet GetStreamerInfoListImpl(bool lookupSICache) final
Read streamerinfo structures from xml format and provide them in the list It is user responsibility t...
Definition TXMLFile.cxx:714
void SaveToFile()
Saves xml structures to the file xml elements are kept in list of TKeyXML objects When saving,...
Definition TXMLFile.cxx:453
XMLNodePointer_t fStreamerInfoNode
Definition TXMLFile.h:132
Long64_t fKeyCounter
indicates format of ROOT xml file
Definition TXMLFile.h:138
void CombineNodesTree(TDirectory *dir, XMLNodePointer_t topnode, Bool_t dolink)
Connect/disconnect all file nodes to single tree before/after saving.
Definition TXMLFile.cxx:534
void DirWriteHeader(TDirectory *) final
Write the directory header.
Int_t DirReadKeys(TDirectory *) final
Read keys for directory Make sense only once, while next time no new subnodes will be created.
Bool_t AddXmlLine(const char *line)
Add just one line on the top of xml document For instance, line can contain special xml processing in...
Definition TXMLFile.cxx:997
Long64_t GetSize() const final
Returns the current file size.
Definition TXMLFile.h:71
void DirWriteKeys(TDirectory *) final
Update key attributes.
void WriteStreamerInfo() final
convert all TStreamerInfo, used in file, to xml format
Definition TXMLFile.cxx:663
Int_t ReadKeysList(TDirectory *dir, XMLNodePointer_t topnode)
Read list of keys for directory.
Definition TXMLFile.cxx:629
void SetXmlLayout(EXMLLayout layout) final
Change layout of objects in xml file Can be changed only for newly created file.
Definition TXMLFile.cxx:910
void SetStoreStreamerInfos(Bool_t iConvert=kTRUE) final
If true, all correspondent to file TStreamerInfo objects will be stored in file this allows to apply ...
Definition TXMLFile.cxx:922
void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE) final
Specify usage of namespaces in xml file In current implementation every instrumented class in file ge...
Definition TXMLFile.cxx:952
Int_t GetIOVersion() const
Definition TXMLFile.h:73
static constexpr Version_t Class_Version()
counter of created keys, used for keys id
Definition TXMLFile.h:140
void SetUsedDtd(Bool_t use=kTRUE) final
Specify usage of DTD for this file.
Definition TXMLFile.cxx:933
XMLDocPointer_t fDoc
Definition TXMLFile.h:130
void StoreStreamerElement(XMLNodePointer_t node, TStreamerElement *elem)
store data of single TStreamerElement in streamer node
Definition TXMLFile.cxx:766
void ReadStreamerElement(XMLNodePointer_t node, TStreamerInfo *info)
read and reconstruct single TStreamerElement from xml node
Definition TXMLFile.cxx:824
Int_t ReOpen(Option_t *mode) final
Reopen a file with a different access mode, like from READ to See TFile::Open() for details.
Definition TXMLFile.cxx:371
std::unique_ptr< TXMLEngine > fXML
pointer of node with streamer info data
Definition TXMLFile.h:134
void Close(Option_t *option="") final
Close a XML file For more comments see TFile::Close() function.
Definition TXMLFile.cxx:298
Bool_t ReadFromFile()
read document from file Now full content of document reads into the memory Then document decomposed t...
Definition TXMLFile.cxx:558
Bool_t AddXmlComment(const char *comment)
Add comment line on the top of the xml document This line can only be seen in xml editor and cannot b...
Definition TXMLFile.cxx:963
Long64_t DirCreateEntry(TDirectory *) final
Create key for directory entry in the key.
TKeyXML * FindDirKey(TDirectory *dir)
Search for key which correspond to directory dir.
static void ProduceFileNames(const char *filename, TString &fname, TString &dtdname)
function produces pair of xml and dtd file names
Definition TXMLFile.cxx:423
virtual void SetUsedDtd(Bool_t use=kTRUE)
Definition TXMLSetup.h:104
virtual void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE)
Definition TXMLSetup.h:105
TString GetSetupAsString()
return setup values as string
Bool_t IsValidXmlSetup(const char *setupstr)
checks if string is valid setup
Bool_t ReadSetupFromStr(const char *setupstr)
get values from string
Int_t AtoI(const char *sbuf, Int_t def=0, const char *errinfo=nullptr)
converts string to integer.
Bool_t IsStoreStreamerInfos() const
Definition TXMLSetup.h:98
static TString DefaultXmlSetup()
return default value for XML setup
Bool_t IsUseDtd() const
Definition TXMLSetup.h:99
virtual void SetStoreStreamerInfos(Bool_t iConvert=kTRUE)
Definition TXMLSetup.h:103
virtual void SetXmlLayout(EXMLLayout layout)
Definition TXMLSetup.h:102
TLine * line
const Int_t n
Definition legend1.C:16
const char * Root
Definition TXMLSetup.cxx:46
const char * SInfos
Definition TXMLSetup.cxx:77
const char * IOVersion
Definition TXMLSetup.cxx:49
const char * ModifyTm
Definition TXMLSetup.cxx:69
const char * False
Definition TXMLSetup.cxx:76
const char * True
Definition TXMLSetup.cxx:75
const char * Title
Definition TXMLSetup.cxx:67
const char * Ref
Definition TXMLSetup.cxx:52
const char * Null
Definition TXMLSetup.cxx:53
const char * CreateTm
Definition TXMLSetup.cxx:68
const char * Setup
Definition TXMLSetup.cxx:47
const char * ObjectUUID
Definition TXMLSetup.cxx:70
const char * Xmlkey
Definition TXMLSetup.cxx:57
Simple struct of the return value of GetStreamerInfoListImpl.
Definition TFile.h:224