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