119 ::Fatal(
"TFile::TFile",
"ROOT system not initialized");
121 fXML = std::make_unique<TXMLEngine>();
171 const char *fname =
nullptr;
174 Error(
"TXMLFile",
"file name is not specified");
194 delete[](
char *) fname;
209 Error(
"TXMLFile",
"file %s already exists", fname);
219 Error(
"TXMLFile",
"no write permission, could not open file %s", fname);
226 Error(
"TXMLFile",
"file %s does not exist", fname);
230 Error(
"TXMLFile",
"no read permission, could not open file %s", fname);
273 fXML->DocSetRootElement(
fDoc, fRootNode);
280 gROOT->GetListOfFiles()->Add(
this);
287 while ((key = (
TKey *)iter()) !=
nullptr) {
349 gROOT->GetListOfFiles()->Remove(
this);
365 return fDoc !=
nullptr;
379 if (opt !=
"READ" && opt !=
"UPDATE") {
380 Error(
"ReOpen",
"mode must be either READ or UPDATE, not %s", opt.
Data());
434 hasxmlext = (last ==
".xml");
497 fXML->FreeAttr(fRootNode,
"file_version");
543 while ((key = (
TKeyXML *)iter()) !=
nullptr) {
567 if (!fRootNode || !
fXML->ValidateVersion(
fDoc)) {
598 if (
fXML->HasAttr(fRootNode,
"file_version"))
622 fXML->CleanNode(fRootNode);
632 if (!dir || !topnode)
638 fXML->SkipEmpty(keynode);
643 fXML->UnlinkNode(keynode);
649 Info(
"ReadKeysList",
"Add key %s from node %s", key->
GetName(),
fXML->GetNodeName(keynode));
655 fXML->SkipEmpty(keynode);
695 fXML->NewAttr(infonode,
nullptr,
"name", info->
GetName());
696 fXML->NewAttr(infonode,
nullptr,
"title", info->
GetTitle());
700 fXML->NewAttr(infonode,
nullptr,
"canoptimize",
720 return {
nullptr, 1, hash};
725 fXML->SkipEmpty(sinfonode);
728 if (strcmp(
"TStreamerInfo",
fXML->GetNodeName(sinfonode)) == 0) {
730 TString ftitle =
fXML->GetAttr(sinfonode,
"title");
737 Int_t clversion =
AtoI(
fXML->GetAttr(sinfonode,
"classversion"));
743 const char *canoptimize =
fXML->GetAttr(sinfonode,
"canoptimize");
744 if (!canoptimize || (strcmp(canoptimize,
xmlio::False) == 0))
750 fXML->SkipEmpty(node);
753 fXML->ShiftToNext(node);
756 fXML->ShiftToNext(sinfonode);
761 return {list, 0, hash};
773 constexpr std::size_t bufferSize = 100;
774 char sbuf[bufferSize];
775 char namebuf[bufferSize];
777 fXML->NewAttr(node,
nullptr,
"name", elem->
GetName());
779 fXML->NewAttr(node,
nullptr,
"title", elem->
GetTitle());
793 for (
int ndim = 0; ndim < elem->
GetArrayDim(); ndim++) {
794 snprintf(namebuf, bufferSize,
"dim%d", ndim);
802 fXML->NewAttr(node,
nullptr,
"baseversion", sbuf);
804 fXML->NewAttr(node,
nullptr,
"basechecksum", sbuf);
833 int elem_type =
fXML->GetIntAttr(node,
"type");
842 int basever =
fXML->GetIntAttr(node,
"baseversion");
844 Int_t baseCheckSum =
fXML->GetIntAttr(node,
"basechecksum");
847 TString countname =
fXML->GetAttr(node,
"countname");
848 TString countclass =
fXML->GetAttr(node,
"countclass");
849 Int_t countversion =
fXML->GetIntAttr(node,
"countversion");
855 TString countname =
fXML->GetAttr(node,
"countname");
856 TString countclass =
fXML->GetAttr(node,
"countclass");
857 Int_t countversion =
fXML->GetIntAttr(node,
"countversion");
862 int fSTLtype =
fXML->GetIntAttr(node,
"STLtype");
863 int fCtype =
fXML->GetIntAttr(node,
"Ctype");
870 if (
fXML->HasAttr(node,
"numdim")) {
871 int numdim =
fXML->GetIntAttr(node,
"numdim");
873 for (
int ndim = 0; ndim < numdim; ndim++) {
874 snprintf(namebuf, 100,
"dim%d", ndim);
875 int maxi =
fXML->GetIntAttr(node, namebuf);
970 return fXML->AddDocComment(
fDoc, comment);
984 const char *media,
const char *charset)
989 return fXML->AddDocStyleSheet(
fDoc, href,
type, title, alternate, media, charset);
1035 while ((obj = next()) !=
nullptr) {
1057 while ((obj = next()) !=
nullptr) {
1088 while ((obj = next()) !=
nullptr) {
virtual RooAbsTestStatistic * create(const char *name, const char *title, RooAbsReal &real, RooAbsData &data, const RooArgSet &projDeps, Configuration const &cfg)=0
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
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
R__EXTERN TVirtualMutex * gROOTMutex
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD(mutex)
Array of chars or bytes (8 bits per element).
TClass instances represent classes, structs and namespaces in the ROOT type system.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Version_t GetClassVersion() const
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.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
const char * AsSQLString() const
Return the date & time in SQL compatible string format, like: 1997-01-15 20:16:28.
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.
Describe directory structure in memory.
virtual Long64_t GetSeekDir() const
virtual TList * GetList() const
virtual Int_t AppendKey(TKey *)
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
TDirectory * GetMotherDir() const
Long64_t fBytesRead
Number of bytes read from this file.
Double_t fSum2Buffer
Sum of squares of buffer sizes of objects written so far.
virtual void ReadStreamerInfo()
Read the list of StreamerInfo from this file.
TArrayC * fClassIndex
!Index of TStreamerInfo classes written to this file
Long64_t fSeekInfo
Location on disk of StreamerInfo record.
Int_t fVersion
File format version.
Int_t fNbytesInfo
Number of bytes for StreamerInfo record.
virtual void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Used to specify the compression level and algorithm.
Int_t GetCompressionLevel() const
TString fOption
File options.
Char_t fUnits
Number of bytes for file pointers.
TObjArray * fProcessIDs
!Array of pointers to TProcessIDs
Long64_t fBytesWrite
Number of bytes written to this file.
TList * fFree
Free segments linked list table.
TString fRealName
Effective real file name (not original url)
Double_t fSumBuffer
Sum of buffer sizes of objects written so far.
Int_t fNProcessIDs
Number of TProcessID written to this file.
Int_t fWritten
Number of objects written so far.
void UpdateObject(TObject *obj)
updates object, stored in the node Used for TDirectory data update
Long64_t GetKeyId() const
XMLNodePointer_t KeyNode() const
void UpdateAttributes()
update key attributes in key node
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
void Add(TObject *obj) override
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
TObject * At(Int_t idx) const override
Int_t GetLast() const override
Return index of last object in array.
void Add(TObject *obj) override
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
A TProcessID identifies a ROOT job in a unique way in time and space.
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.
const char * GetCountName() const
Int_t GetCountVersion() const
const char * GetCountClass() const
virtual void SetSize(Int_t dsize)
virtual Int_t GetSize() const
Returns size of this element in bytes.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
Int_t GetArrayDim() const
Int_t GetMaxIndex(Int_t i) const
const char * GetTypeName() const
TClass * IsA() const override
virtual void SetType(Int_t dtype)
virtual void SetTypeName(const char *name)
virtual void SetNewType(Int_t dtype)
virtual void SetMaxIndex(Int_t dim, Int_t max)
set maximum index for array with dimension dim
Describes a persistent version of a class.
Int_t GetClassVersion() const override
Int_t GetNumber() const override
TClass * IsA() const override
void SetClassVersion(Int_t vers) override
void SetOnFileClassVersion(Int_t vers)
void SetCheckSum(UInt_t checksum) override
TObjArray * GetElements() const override
UInt_t GetCheckSum() const override
const char * GetCountName() const
Int_t GetCountVersion() const
const char * GetCountClass() const
void ToLower()
Change string to lower-case.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
void ToUpper()
Change string to upper case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual int Unlink(const char *name)
Unlink, i.e.
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
~TXMLFile() override
destructor of TXMLFile object
Bool_t IsOpen() const final
return kTRUE if file is opened and can be accessed
Int_t fIOVersion
object for interface with xml library
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
void InitXmlFile(Bool_t create)
initialize xml file and correspondent structures identical to TFile::Init() function
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...
InfoListRet GetStreamerInfoListImpl(bool lookupSICache) final
Read streamerinfo structures from xml format and provide them in the list It is user responsibility t...
void SaveToFile()
Saves xml structures to the file xml elements are kept in list of TKeyXML objects When saving,...
XMLNodePointer_t fStreamerInfoNode
Long64_t fKeyCounter
indicates format of ROOT xml file
void CombineNodesTree(TDirectory *dir, XMLNodePointer_t topnode, Bool_t dolink)
Connect/disconnect all file nodes to single tree before/after saving.
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...
Long64_t GetSize() const final
Returns the current file size.
void DirWriteKeys(TDirectory *) final
Update key attributes.
void WriteStreamerInfo() final
convert all TStreamerInfo, used in file, to xml format
Int_t ReadKeysList(TDirectory *dir, XMLNodePointer_t topnode)
Read list of keys for directory.
void SetXmlLayout(EXMLLayout layout) final
Change layout of objects in xml file Can be changed only for newly created file.
void SetStoreStreamerInfos(Bool_t iConvert=kTRUE) final
If true, all correspondent to file TStreamerInfo objects will be stored in file this allows to apply ...
void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE) final
Specify usage of namespaces in xml file In current implementation every instrumented class in file ge...
Int_t GetIOVersion() const
static constexpr Version_t Class_Version()
counter of created keys, used for keys id
void SetUsedDtd(Bool_t use=kTRUE) final
Specify usage of DTD for this file.
void StoreStreamerElement(XMLNodePointer_t node, TStreamerElement *elem)
store data of single TStreamerElement in streamer node
void ReadStreamerElement(XMLNodePointer_t node, TStreamerInfo *info)
read and reconstruct single TStreamerElement from xml node
Int_t ReOpen(Option_t *mode) final
Reopen a file with a different access mode, like from READ to See TFile::Open() for details.
std::unique_ptr< TXMLEngine > fXML
pointer of node with streamer info data
void Close(Option_t *option="") final
Close a XML file For more comments see TFile::Close() function.
Bool_t ReadFromFile()
read document from file Now full content of document reads into the memory Then document decomposed t...
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...
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
virtual void SetUsedDtd(Bool_t use=kTRUE)
virtual void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE)
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
static TString DefaultXmlSetup()
return default value for XML setup
virtual void SetStoreStreamerInfos(Bool_t iConvert=kTRUE)
virtual void SetXmlLayout(EXMLLayout layout)
Simple struct of the return value of GetStreamerInfoListImpl.