101 fStreamerInfoNode(0),
143 ::Fatal(
"TFile::TFile",
"ROOT system not initialized");
145 if (filename && !strncmp(filename,
"xml:", 4))
183 if (xmlsetup) recreate =
kTRUE;
185 if (!create && !recreate && !update && !read) {
191 const char *fname = 0;
193 if (!filename || !filename[0]) {
194 Error(
"TXMLFile",
"file name is not specified");
199 if (!strcmp(filename,
"/dev/null") &&
215 delete [] (
char*)fname;
218 Error(
"TXMLFile",
"error expanding path %s", filename);
231 Error(
"TXMLFile",
"file %s already exists", fname);
241 Error(
"TXMLFile",
"no write permission, could not open file %s", fname);
248 Error(
"TXMLFile",
"file %s does not exist", fname);
252 Error(
"TXMLFile",
"no read permission, could not open file %s", fname);
259 if (create || update)
286 Int_t len =
gROOT->GetListOfStreamerInfo()->GetSize()+1;
287 if (len<5000) len = 5000;
301 gROOT->GetListOfFiles()->Add(
this);
308 while ((key = (
TKey*)iter())!=0) {
366 gROOT->GetListOfFiles()->Remove(
this);
408 if (opt !=
"READ" && opt !=
"UPDATE") {
409 Error(
"ReOpen",
"mode must be either READ or UPDATE, not %s", opt.
Data());
463 hasxmlext = (last==
".xml");
561 while ((key=(
TKeyXML*)iter()) !=0) {
649 if ((dir==0) || (topnode==0))
return 0;
709 fXML->
NewAttr(infonode, 0,
"name", info->GetName());
710 fXML->
NewAttr(infonode, 0,
"title", info->GetTitle());
713 fXML->
NewIntAttr(infonode,
"classversion", info->GetClassVersion());
717 TIter iter2(info->GetElements());
738 while (sinfonode!=0) {
754 const char* canoptimize =
fXML->
GetAttr(sinfonode,
"canoptimize");
755 if ((canoptimize==0) || (strcmp(canoptimize,
xmlio::False)==0))
784 char sbuf[100], namebuf[100];
803 sprintf(namebuf,
"dim%d", ndim);
888 for (
int ndim=0;ndim<numdim;ndim++) {
889 sprintf(namebuf,
"dim%d", ndim);
1003 const char* charset)
1030 if (mother==0) mother =
this;
1045 if (motherdir==0) motherdir =
this;
1050 while ((obj = next())!=0) {
1066 if (motherdir==0) motherdir =
this;
1071 while ((obj = next())!=0) {
1088 if (key==0)
return 0;
1101 while ((obj = next())!=0) {
void ReadStreamerElement(XMLNodePointer_t node, TStreamerInfo *info)
read and reconstruct single TStreamerElement from xml node
TDatime fDatimeM
Date and time of last modification.
Describe Streamer information for one class version.
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Bool_t ValidateDocument(XMLDocPointer_t, Bool_t=kFALSE)
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode, like from READ to See TFile::Open() for details...
double read(const std::string &file_name)
reading
const char * GetCountClass() const
Char_t fUnits
Number of bytes for file pointers.
virtual ~TXMLFile()
destructor of TXMLFile object
virtual TList * GetListOfKeys() const
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
TObjArray * fProcessIDs
!Array of pointers to TProcessIDs
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Int_t GetCountVersion() const
void SetCheckSum(UInt_t checksum)
void FreeAttr(XMLNodePointer_t xmlnode, const char *name)
remove attribute from xmlnode
Long64_t fBytesWrite
Number of bytes written to this file.
Long64_t GetKeyId() const
Double_t fSumBuffer
Sum of buffer sizes of objects written so far.
virtual void SetSize(Int_t dsize)
TArrayC * fClassIndex
!Index of TStreamerInfo classes written to this file
virtual TDirectory * GetMotherDir() const
TKeyXML * FindDirKey(TDirectory *dir)
Serach for key which correspond to direcory dir.
virtual const char * GetClassName() const
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
XMLDocPointer_t NewDoc(const char *version="1.0")
creates new xml document with provided version
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
void ToUpper()
Change string to upper case.
virtual void SetXmlLayout(EXMLLayout layout)
Change layout of objects in xml file Can be changed only for newly created file.
virtual Bool_t IsOpen() const
return kTRUE if file is opened and can be accessed
virtual void SetTypeName(const char *name)
static TString DefaultXmlSetup()
return default value for XML setup
XMLNodePointer_t KeyNode() const
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
return next to xmlnode node if realnode==kTRUE, any special nodes in between will be skipped ...
virtual void DirWriteKeys(TDirectory *)
Update key attributes.
void ToLower()
Change string to lower-case.
R__EXTERN TVirtualMutex * gROOTMutex
virtual void Close(Option_t *option="")
Close a XML file For more comments see TFile::Close() function.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
TObject * At(Int_t idx) const
Int_t GetArrayDim() const
virtual TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize)
create XML key, which will store object in xml structures
Long64_t fSeekInfo
Location on disk of StreamerInfo record.
Int_t fIOVersion
object for interface with xml library
Int_t GetIOVersion() const
TXMLEngine * fXML
pointer of node with streamer info data
virtual void SetMaxIndex(Int_t dim, Int_t max)
set maximum index for array with dimension dim
void FreeDoc(XMLDocPointer_t xmldoc)
frees allocated document data and deletes document itself
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
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
void StoreStreamerElement(XMLNodePointer_t node, TStreamerElement *elem)
store data of single TStreamerElement in streamer node
Int_t fNbytesInfo
Number of bytes for StreamerInfo record.
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
virtual void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE)
Specifiy usage of namespaces in xml file In current implementation every instrumented class in file g...
XMLNodePointer_t fStreamerInfoNode
TDatime fDatimeC
Date and time when directory is created.
TString fRealName
Effective real file name (not original url)
void DocSetRootElement(XMLDocPointer_t xmldoc, XMLNodePointer_t xmlnode)
set main (root) node for document
Int_t AtoI(const char *sbuf, Int_t def=0, const char *errinfo=0)
converts string to integer.
const char * GetCountClass() const
void operator=(const TXMLFile &)
make private to exclude copy operator
void SetOnFileClassVersion(Int_t vers)
virtual TList * GetList() const
Book space in a file, create I/O buffers, to fill them, (un)compress them.
A TProcessID identifies a ROOT job in a unique way in time and space.
Long64_t fKeyCounter
indicates format of ROOT xml file
void InitXmlFile(Bool_t create)
initialize xml file and correspondent structures identical to TFile::Init() function ...
void SaveToFile()
Saves xml structures to file xml elements are kept in list of TKeyXML objects When saving...
const char * GetNodeName(XMLNodePointer_t xmlnode)
returns name of xmlnode
void CombineNodesTree(TDirectory *dir, XMLNodePointer_t topnode, Bool_t dolink)
Connect/disconnect all file nodes to single tree before/after saving.
virtual void SetUsedDtd(Bool_t use=kTRUE)
Int_t GetLast() const
Return index of last object in array.
void SaveDoc(XMLDocPointer_t xmldoc, const char *filename, Int_t layout=1)
store document content to file if layout<=0, no any spaces or newlines will be placed between xmlnode...
virtual void SetStoreStreamerInfos(Bool_t iConvert=kTRUE)
If true, all correspondent to file TStreamerInfo objects will be stored in file this allows to apply ...
void AddChild(XMLNodePointer_t parent, XMLNodePointer_t child)
add child element to xmlnode
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 ...
R__EXTERN TSystem * gSystem
void UpdateAttributes()
update key attributes in key node
TList * fKeys
Pointer to keys list in memory.
Int_t ReadKeysList(TDirectory *dir, XMLNodePointer_t topnode)
Read list of keys for directory.
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...
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
const char * AsSQLString() const
Return the date & time in SQL compatible string format, like: 1997-01-15 20:16:28.
Int_t GetMaxIndex(Int_t i) const
void UpdateObject(TObject *obj)
updates object, stored in the node Used for TDirectory data update
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Int_t DecrementCount()
The reference fCount is used to delete the TProcessID in the TFile destructor when fCount = 0...
virtual Long64_t GetSeekDir() const
The ROOT global object gROOT contains a list of all defined classes.
virtual void SetUsedDtd(Bool_t use=kTRUE)
Specify usage of DTD for this file.
void Build(TFile *motherFile=0, TDirectory *motherDir=0)
Initialise directory to defaults.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
void SetClassVersion(Int_t vers)
Bool_t AddDocStyleSheet(XMLDocPointer_t xmldoc, const char *href, const char *type="text/css", const char *title=0, int alternate=-1, const char *media=0, const char *charset=0)
Add style sheet definition on the top of document.
void SkipEmpty(XMLNodePointer_t &xmlnode)
Skip all current empty nodes and locate on first "true" node.
Bool_t fWritable
True if directory is writable.
static void ProduceFileNames(const char *filename, TString &fname, TString &dtdname)
function produces pair of xml and dtd file names
Bool_t HasAttr(XMLNodePointer_t xmlnode, const char *name)
checks if node has attribute of specified name
virtual Int_t AppendKey(TKey *)
Bool_t AddDocRawLine(XMLDocPointer_t xmldoc, const char *line)
Add just line on the top of xml document Line should has correct xml syntax that later it can be deco...
virtual void ReadStreamerInfo()
Read the list of StreamerInfo from this file.
Double_t fSum2Buffer
Sum of squares of buffer sizes of objects written so far.
XMLDocPointer_t ParseFile(const char *filename, Int_t maxbuf=100000)
Parses content of file and tries to produce xml structures.
TList * fFree
Free segments linked list table.
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
TFile * fFile
Pointer to current file in memory.
virtual void SetName(const char *newname)
Set the name for directory If the directory name is changed after the directory was written once...
void CleanNode(XMLNodePointer_t xmlnode)
remove all children node from xmlnode
const char * GetAttr(XMLNodePointer_t xmlnode, const char *name)
returns value of attribute for xmlnode
Bool_t AddDocComment(XMLDocPointer_t xmldoc, const char *comment)
add comment line to the top of the document
Describe directory structure in memory.
virtual void Clear(Option_t *option="")
delete the TObjArray pointing to referenced objects this function is called by TFile::Close("R") ...
virtual Int_t GetSize() const
Returns size of this element in bytes.
void SetWritable(Bool_t writable=kTRUE)
Set the new value of fWritable recursively.
const char * GetCountName() const
virtual void SetType(Int_t dtype)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
#define R__LOCKGUARD(mutex)
virtual TList * GetStreamerInfoList()
Read streamerinfo structures from xml format and provide them in the list It is user responsibility t...
TString fOption
File options.
static TProcessID * GetSessionProcessID()
static function returning the pointer to the session TProcessID
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 Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
void FreeNode(XMLNodePointer_t xmlnode)
release all memory, allocated fro this node and destroyes node itself
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
virtual void SetStoreStreamerInfos(Bool_t iConvert=kTRUE)
Mother of all ROOT objects.
TObjArray * GetElements() const
Bool_t ValidateVersion(XMLDocPointer_t doc, const char *version=0)
check that first node is xml processing instruction with correct xml version number ...
virtual void SetCompressionSettings(Int_t settings=1)
Used to specify the compression level and algorithm.
TString GetSetupAsString()
return setup values as string
const char * GetTypeName() const
virtual void Add(TObject *obj)
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xml node
Bool_t ReadFromFile()
read document from file Now full content of docuument reads into the memory Then document decomposed ...
Bool_t AddXmlStyleSheet(const char *href, const char *type="text/css", const char *title=0, int alternate=-1, const char *media=0, const char *charset=0)
Adds style sheet definition on the top of xml document Creates <?xml-stylesheet alternate="yes" title...
virtual void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE)
const char * GetCountName() const
virtual Long64_t DirCreateEntry(TDirectory *)
Create key for directory entry in the key.
virtual TList * GetListOfKeys() const
TXMLFile()
default TXMLFile constructor
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns, const char *name, const char *content=0)
create new child element for parent node
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
returns root node of document
Int_t fNProcessIDs
Number of TProcessID written to this file.
virtual void SetNewType(Int_t dtype)
void UnlinkNode(XMLNodePointer_t node)
unlink (dettach) xml node from parent
Bool_t IsStoreStreamerInfos() const
Int_t GetIntAttr(XMLNodePointer_t node, const char *name)
returns value of attribute as integer
virtual Int_t DirReadKeys(TDirectory *)
Read keys for directory Make sence only once, while next time no new subnodes will be created...
Bool_t ReadSetupFromStr(const char *setupstr)
get values from string
Int_t fVersion
File format version.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Int_t fWritten
Number of objects written so far.
virtual Long64_t GetSize() const
Returns the current file size.
TDirectory * FindKeyDir(TDirectory *mother, Long64_t keyid)
Find a directory in motherdir with a seek equal to keyid.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Bool_t IsWritable() const
virtual Int_t GetSize() const
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void DirWriteHeader(TDirectory *)
Write the directory header.
virtual void SetXmlLayout(EXMLLayout layout)
Int_t GetCompressionLevel() const
Long64_t fBytesRead
Number of bytes read from this file.
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...
virtual void WriteStreamerInfo()
convert all TStreamerInfo, used in file, to xml format
Int_t GetCountVersion() const
virtual const char * GetTitle() const
Returns title of object.
Bool_t IsValidXmlSetup(const char *setupstr)
checks if string is valid setup
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
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
Array of chars or bytes (8 bits per element).