areaDetector  3-5-0
EPICS areaDetector framework
NDFileHDF5LayoutXML.h
Go to the documentation of this file.
1 /*
2  * NDFileHDF5LayoutXML.h
3  *
4  * Created on: 26 Jan 2012
5  * Author: up45
6  */
7 
8 #ifndef NDFILEHDF5LAYOUTXML_H_
9 #define NDFILEHDF5LAYOUTXML_H_
10 
11 #include <libxml/xmlreader.h>
12 #include <string>
13 #include <map>
14 #ifdef LOG4CXX
15 #include <log4cxx/logger.h>
16 #else
17 
18 // std::cout logging if log4cxx is not defined
19 // define HDF5_LOGGING 1 to print log messages
20 //#define HDF5_LOGGING 1
21 
22 namespace log4cxx
23 {
24  class Logger
25  {
26  public:
27  static Logger* getLogger(const std::string& name){ return new Logger(); }
28  };
29  typedef Logger* LoggerPtr;
30 } // namespace log4cxx
31 
32 #ifdef HDF5_LOGGING
33  #define LOG4CXX_ERROR(LOG, msg) std::cout << msg << std::endl
34  #define LOG4CXX_INFO(LOG, msg) std::cout << msg << std::endl
35  #define LOG4CXX_DEBUG(LOG, msg) std::cout << msg << std::endl
36  #define LOG4CXX_WARN(LOG, msg) std::cout << msg << std::endl
37 #else
38  #define LOG4CXX_ERROR(LOG, msg)
39  #define LOG4CXX_INFO(LOG, msg)
40  #define LOG4CXX_DEBUG(LOG, msg)
41  #define LOG4CXX_WARN(LOG, msg)
42 #endif
43 #endif
44 
45 namespace hdf5
46 {
47 
48  // forward declarations
49  class Group;
50  class Root;
51  class DataSource;
52  class Attribute;
53  class Element;
54 
55  int main_xml(const char *fname);
56 
59  class epicsShareClass LayoutXML
60  {
61  public:
63  static const std::string ATTR_ROOT;
64  static const std::string ATTR_GROUP;
65  static const std::string ATTR_DATASET;
67  static const std::string ATTR_GLOBAL;
68  static const std::string ATTR_HARDLINK;
69 
71  static const std::string ATTR_SOURCE;
79  static const std::string ATTR_SRC_WHEN;
84 
86 
87  LayoutXML();
88  ~LayoutXML();
89 
90  int load_xml();
91  int load_xml(const std::string& filename);
92  int verify_xml(const std::string& filename);
93  int unload_xml();
94 
95  Root* get_hdftree();
96  std::string get_global(const std::string& name);
97  bool getAutoNDAttrDefault();
98 
99  private:
100  int process_node();
101 
102  int process_dset_xml_attribute(DataSource& out);
103  int process_attribute_xml_attribute(Attribute& out);
104 
105  int parse_root();
106  int new_group();
107  int new_dataset();
108  int new_attribute();
109  int new_global();
110  int new_hardlink();
111 
112  bool auto_ndattr_default;
113  log4cxx::LoggerPtr log;
114  Root* ptr_tree;
115  Element *ptr_curr_element;
116  xmlTextReaderPtr xmlreader;
117  std::map<std::string, std::string> globals;
118  };
119 
120 } // hdf5
121 
122 #endif /* NDFILEHDF5LAYOUTXML_H_ */
123 
static const std::string ATTR_ATTRIBUTE
Definition: NDFileHDF5LayoutXML.h:66
Class used for writing an Attribute with the NDFileHDF5 plugin.
Definition: NDFileHDF5Layout.h:85
static const std::string ATTR_ROOT_NDATTR_DEFAULT
Definition: NDFileHDF5LayoutXML.h:70
static const std::string ATTR_GLOBAL_VALUE
Definition: NDFileHDF5LayoutXML.h:81
static const std::string ATTR_ELEMENT_NAME
Definition: NDFileHDF5LayoutXML.h:62
name
Definition: makeDbAndEdl.py:232
static const std::string ATTR_SRC_DETECTOR
Definition: NDFileHDF5LayoutXML.h:72
static const std::string ATTR_ROOT
Definition: NDFileHDF5LayoutXML.h:63
static const std::string ATTR_DATASET
Definition: NDFileHDF5LayoutXML.h:65
static const std::string ATTR_SOURCE
Definition: NDFileHDF5LayoutXML.h:71
static const std::string ATTR_HARDLINK_TARGET
Definition: NDFileHDF5LayoutXML.h:83
Used to define layout of HDF5 file with NDFileHDF5 plugin.
Definition: NDFileHDF5LayoutXML.h:59
static const std::string ATTR_SRC_NDATTR
Definition: NDFileHDF5LayoutXML.h:74
static const std::string ATTR_SRC_CONST_TYPE
Definition: NDFileHDF5LayoutXML.h:77
static const std::string ATTR_SRC_CONST_VALUE
Definition: NDFileHDF5LayoutXML.h:76
static const std::string DEFAULT_LAYOUT
Definition: NDFileHDF5LayoutXML.h:85
static const std::string ATTR_SRC_CONST
Definition: NDFileHDF5LayoutXML.h:75
Definition: NDFileHDF5Layout.cpp:16
Class used for writing the root of the file with the NDFileHDF5 plugin.
Definition: NDFileHDF5Layout.h:273
static const std::string ATTR_HARDLINK_NAME
Definition: NDFileHDF5LayoutXML.h:82
Logger * LoggerPtr
Definition: NDFileHDF5LayoutXML.h:29
Definition: NDFileHDF5LayoutXML.h:24
static const std::string ATTR_SRC_WHEN
Definition: NDFileHDF5LayoutXML.h:79
static const std::string ATTR_GRP_NDATTR_DEFAULT
Definition: NDFileHDF5LayoutXML.h:78
static const std::string ATTR_GLOBAL
Definition: NDFileHDF5LayoutXML.h:67
static const std::string ATTR_HARDLINK
Definition: NDFileHDF5LayoutXML.h:68
static const std::string ATTR_GROUP
Definition: NDFileHDF5LayoutXML.h:64
int main_xml(const char *fname)
static Logger * getLogger(const std::string &name)
Definition: NDFileHDF5LayoutXML.h:27
static const std::string ATTR_SRC_DET_DEFAULT
Definition: NDFileHDF5LayoutXML.h:73
Definition: NDFileHDF5Layout.h:42
Describe a generic structure element with the NDFileHDF5 plugin.
Definition: NDFileHDF5Layout.h:112
Definition: NDFileHDF5LayoutXML.h:22
Class used for writing a DataSource with the NDFileHDF5 plugin.
Definition: NDFileHDF5Layout.h:47
static const std::string ATTR_GLOBAL_NAME
Definition: NDFileHDF5LayoutXML.h:80