otsdaq  v2_05_02_indev
ConfigurationHandler.h
1 #ifndef _ots_ConfigurationHandler_h_
2 #define _ots_ConfigurationHandler_h_
3 
4 #include <string>
5 #include <xercesc/dom/DOMDocument.hpp>
6 #include <xercesc/util/XMLChar.hpp>
7 
8 #include "otsdaq/TableCore/TableVersion.h"
9 
10 namespace ots
11 {
12 class TableBase;
13 
15 {
16  public:
18  virtual ~ConfigurationHandler(void);
19  virtual void read(TableBase& /*configuration*/) { ; }
20  virtual void write(const TableBase& /*configuration*/) { ; }
21 
22  static void readXML(TableBase& configuration, TableVersion version);
23  static void readXML(TableBase* configuration, TableVersion version);
24  static std::string writeXML(const TableBase& configuration); // returns the file name
25  static std::string writeXML(const TableBase* configuration); // returns the file name
26 
27  // FIXME These are methods that should not exist as public but I don't know what to do
28  // until I know how to make the database interface
29  static std::string getXMLDir(const TableBase* configuration);
30 
31  private:
32  static void initPlatform(void);
33  static void terminatePlatform(void);
34  static bool validateNode(XMLCh* tagName, xercesc::DOMNode* node, const std::string& expectedValue);
35  static void outputXML(xercesc::DOMDocument* pmyDOMDocument, std::string filePath);
36  static std::string getXMLFileName(const TableBase& configuration, TableVersion version);
37 
38  static xercesc::DOMNode* getNode(XMLCh* tagName, xercesc::DOMNode* parent, unsigned int itemNumber);
39  static xercesc::DOMNode* getNode(XMLCh* tagName, xercesc::DOMElement* parent, unsigned int itemNumber);
40  static xercesc::DOMElement* getElement(XMLCh* tagName, xercesc::DOMNode* parent, unsigned int itemNumber);
41  static xercesc::DOMElement* getElement(XMLCh* tagName, xercesc::DOMElement* parent, unsigned int itemNumber);
42  static XMLCh* rootTag_;
43  static XMLCh* headerTag_;
44  static XMLCh* typeTag_;
45  static XMLCh* extensionTableNameTag_;
46  static XMLCh* nameTag_;
47  static XMLCh* runTag_;
48  static XMLCh* runTypeTag_;
49  static XMLCh* runNumberTag_;
50  static XMLCh* runBeginTimestampTag_;
51  static XMLCh* locationTag_;
52  static XMLCh* datasetTag_;
53  static XMLCh* versionTag_;
54  static XMLCh* commentDescriptionTag_;
55  static XMLCh* createdByUserTag_;
56  static XMLCh* partTag_;
57  static XMLCh* nameLabelTag_;
58  static XMLCh* kindOfPartTag_;
59  static XMLCh* dataTag_;
60 };
61 
62 } // namespace ots
63 
64 #endif // ots_ConfigurationHandler_h