BmnRoot
Loading...
Searching...
No Matches
MpdXMLNode.h
Go to the documentation of this file.
1/*
2 * FairXLMNode.h
3 *
4 * Created on: 13 wrz 2017
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#ifndef MPDXLMNODE_H
10#define MPDXLMNODE_H
11#include <TXMLNode.h>
12#include <TList.h>
13#include <TXMLAttr.h>
14#include <TXMLEngine.h>
15#include <TNamed.h>
16#include <memory>
20class MpdXMLAttrib: public TNamed{
21public :
25 MpdXMLAttrib():TNamed(){}
31 MpdXMLAttrib(TString name, TString value){
32 SetName(name);
33 SetTitle(value);}
38 TString GetValue() const{return GetTitle();};
43 void SetValue(TString val){SetTitle(val);};
44 virtual ~MpdXMLAttrib(){};
45 ClassDef(MpdXMLAttrib,1)
46};
50class MpdXMLNode : public TNamed{
51 TList fChildren;
52 TList fAttrib;
53public:
58 MpdXMLNode(const MpdXMLNode &other);
64 MpdXMLNode(TString name="",TString value="");
75 void Copy(TXMLNode *node);
80 void SetValue(TString value){SetTitle(value);};
86 void AddChild(MpdXMLNode *node){fChildren.AddLast(node);};
91 void AddAttrib(MpdXMLAttrib *attrib);
96 Int_t GetNChildren() const {return fChildren.GetEntries();};
101 Int_t GetNAttributes() const{return fAttrib.GetEntries();};
107 Int_t GetNChildren(TString name) const;
112 TString GetValue() const{return GetTitle();};
118 MpdXMLAttrib *GetAttrib(TString name)const;
124 MpdXMLAttrib *GetAttrib(Int_t index)const;
131 MpdXMLNode *GetChild(TString name, Int_t count =0) const;
137 MpdXMLNode *GetChild(Int_t index) const;
138 virtual ~MpdXMLNode();
139 ClassDef(MpdXMLNode,1)
140};
141
145class MpdXMLFile: public TObject{
146 std::unique_ptr<MpdXMLNode> fRootNode;
147 TString fName;
148 Bool_t fOverwrite;
149 void ExportNode(XMLNodePointer_t &nodePointer, TXMLEngine &engine,const MpdXMLNode &node) const;
150public:
156 MpdXMLFile(TString name="", TString mode="read");
161 void CreateRootNode(TString name);
171 MpdXMLNode *GetRootNode()const{return fRootNode.get();};
175 void Close();
179 virtual ~MpdXMLFile();
180 ClassDef(MpdXMLFile,1)
181};
182
183#endif /* MPDXLMNODE_H */
MpdXMLAttrib(TString name, TString value)
Definition MpdXMLNode.h:31
virtual ~MpdXMLAttrib()
Definition MpdXMLNode.h:44
TString GetValue() const
Definition MpdXMLNode.h:38
void SetValue(TString val)
Definition MpdXMLNode.h:43
void CreateRootNode(TString name)
virtual ~MpdXMLFile()
MpdXMLFile(TString name="", TString mode="read")
MpdXMLNode * GetRootNode() const
Definition MpdXMLNode.h:171
void SetRootNode(MpdXMLNode *node)
void Close()
void AddAttrib(MpdXMLAttrib *attrib)
TString GetValue() const
Definition MpdXMLNode.h:112
void Copy(TXMLNode *node)
MpdXMLNode & operator=(const MpdXMLNode &other)
virtual ~MpdXMLNode()
Int_t GetNAttributes() const
Definition MpdXMLNode.h:101
MpdXMLNode * GetChild(Int_t index) const
MpdXMLNode * GetChild(TString name, Int_t count=0) const
void AddChild(MpdXMLNode *node)
Definition MpdXMLNode.h:86
MpdXMLAttrib * GetAttrib(TString name) const
Int_t GetNChildren() const
Definition MpdXMLNode.h:96
MpdXMLAttrib * GetAttrib(Int_t index) const
Int_t GetNChildren(TString name) const
MpdXMLNode(const MpdXMLNode &other)
void SetValue(TString value)
Definition MpdXMLNode.h:80
MpdXMLNode(TString name="", TString value="")