otsdaq  v2_05_02_indev
RootFileExplorer.h
1 #ifndef __RootFileExplorer_H__
2 #define __RootFileExplorer_H__
3 
4 #include <dirent.h>
5 #include <errno.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include <sys/stat.h>
9 #include <sys/types.h>
10 #include <unistd.h>
11 #include <iostream>
12 #include <list>
13 #include <map>
14 #include <sstream>
15 #include <stdexcept>
16 #include <string>
17 #include <vector>
18 
19 #include "otsdaq/Macros/CoutMacros.h"
20 #include "otsdaq/MessageFacility/MessageFacility.h"
21 //#include "otsdaq/XmlUtilities/ConvertFromXML.h"
22 //#include "otsdaq/XmlUtilities/ConvertToXML.h"
23 
24 #include <xercesc/dom/DOM.hpp>
25 #include <xercesc/framework/LocalFileFormatTarget.hpp>
26 #include <xercesc/framework/StdOutFormatTarget.hpp>
27 #include <xercesc/util/OutOfMemoryException.hpp>
28 #include <xercesc/util/PlatformUtils.hpp>
29 #include <xercesc/util/XMLString.hpp>
30 
31 #include <xercesc/dom/DOM.hpp>
32 #include <xercesc/dom/DOMDocument.hpp>
33 #include <xercesc/dom/DOMDocumentType.hpp>
34 #include <xercesc/dom/DOMElement.hpp>
35 #include <xercesc/dom/DOMImplementation.hpp>
36 #include <xercesc/dom/DOMImplementationLS.hpp>
37 #include <xercesc/dom/DOMImplementationRegistry.hpp>
38 #include <xercesc/dom/DOMNodeIterator.hpp>
39 #include <xercesc/dom/DOMNodeList.hpp>
40 #include <xercesc/dom/DOMText.hpp>
41 #include <xercesc/framework/LocalFileFormatTarget.hpp>
42 #include <xercesc/parsers/XercesDOMParser.hpp>
43 #include <xercesc/util/OutOfMemoryException.hpp>
44 #include <xercesc/util/XMLUni.hpp>
45 #include <xercesc/util/XercesDefs.hpp>
46 #include <xercesc/validators/common/Grammar.hpp>
47 //#include <xercesc/dom/DOMLSSerializer.hpp>
48 //#include <xercesc/dom/DOMLSOutput.hpp>
49 
50 #include "otsdaq/XmlUtilities/HttpXmlDocument.h"
51 
52 #if defined(XERCES_NEW_IOSTREAMS)
53 #include <iostream>
54 #else
55 #include <iostream.h>
56 #endif
57 
58 #include <TDirectory.h>
59 #include <TFile.h>
60 #include <TKey.h>
61 
62 using namespace ots;
63 
64 // clang-format off
66 {
67  public:
68 
69  RootFileExplorer (std::string fSystemPath ,
70  std::string fRootPath ,
71  std::string fFoldersPath ,
72  std::string fHistName ,
73  std::string fFileName ,
74  HttpXmlDocument & xmlOut ) ;
75  ~RootFileExplorer (void ) {;}
76  xercesc::DOMDocument * initialize (void ) ;
77  void makeDirectoryBinaryTree(TDirectory * currentDirectory,
78  int indent ,
79  xercesc::DOMElement * anchorNode ) ;
80  xercesc::DOMElement * populateBinaryTreeNode (xercesc::DOMElement * anchorNode ,
81  std::string name ,
82  int level ,
83  bool isLeaf ) ;
84 
85  private:
86 
87  bool debug_ ;
88  std::string fSystemPath_ ;
89  std::string fRootPath_ ;
90  std::string fFoldersPath_ ;
91  std::string fFileName_ ;
92  std::string fRFoldersPath_ ;
93  std::string fHistName_ ;
94  std::string fThisFolderPath_ ;
95  xercesc::DOMImplementation * theImplementation_;
96  xercesc::DOMDocument * theDocument_ ;
97  xercesc::DOMElement * rootElement_ ;
98  std::map<int, xercesc::DOMElement *> theNodes_ ;
99  std::map<int, std::string> theHierarchy_ ;
100  std::map<bool,std::string> isALeaf_ ;
101  const std::string rootTagName_ ;
102  TFile * rootFile_ ;
103  int level_ ;
104  std::stringstream ss_ ;
105  HttpXmlDocument xmlOut_ ;
106 } ;
107 // clang-format on
108 #endif