libpniio
h5_error.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2013 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpniio.
5 //
6 // libpniio is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpniio is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpniio. If not, see <http://www.gnu.org/licenses/>.
18 // ===========================================================================
19 // Created on: Feb 6, 2013
20 // Author: Eugen Wintersberger
21 //
22 #pragma once
23 
24 extern "C"{
25 #include <hdf5.h>
26 }
27 
28 #include <iostream>
29 #include <vector>
30 
31 #include <pni/core/types.hpp>
32 #include <pni/core/error.hpp>
33 
34 
35 namespace pni {
36 namespace io {
37 namespace nx {
38 namespace h5 {
39 
50  class h5_error
51  {
52  private:
53  pni::core::string _class_name;
54  pni::core::string _file_name;
57  pni::core::string _func_name;
58  pni::core::string _description;
59  pni::core::string _minor_message;
60  pni::core::string _major_message;
61 
72  static pni::core::string get_message(hid_t mid,H5E_type_t *mtype);
73  public:
74  //-----------------------------------------------------------------
80  h5_error() noexcept;
81 
82  //-----------------------------------------------------------------
86  h5_error(const h5_error &e) ;
87 
88  //-----------------------------------------------------------------
90  virtual ~h5_error();
91 
92  //-----------------------------------------------------------------
96  h5_error &operator=(const h5_error &e);
97 
98  //-----------------------------------------------------------------
107  void class_name(hid_t id);
108 
109  //----------------------------------------------------------------
113  pni::core::string class_name() const;
114 
115  //-----------------------------------------------------------------
123  void major_message(hid_t mid);
124 
125  //-----------------------------------------------------------------
129  pni::core::string major_message() const;
130 
131 
132  //-----------------------------------------------------------------
140  void minor_message(hid_t mid);
141 
142  //-----------------------------------------------------------------
146  pni::core::string minor_message() const;
147 
148  //-----------------------------------------------------------------
152  pni::core::string file_name() const;
153 
154  //-----------------------------------------------------------------
158  void file_name(const pni::core::string &n);
159 
160  //-----------------------------------------------------------------
164  pni::core::string func_name() const;
165 
166  //-----------------------------------------------------------------
170  void func_name(const pni::core::string &n);
171 
172  //-----------------------------------------------------------------
176  pni::core::string description() const;
177 
178  //-----------------------------------------------------------------
182  void description(const pni::core::string &n);
183 
184 
185  };
186 
187 
188  //-----------------------------------------------------------------
193  std::ostream &operator<<(std::ostream &o,const h5_error &e);
194 //end of namespace
195 }
196 }
197 }
198 }
199 
pni::core::string minor_message() const
get minor message
Definition: h5_error.cpp:195
static pni::core::string get_message(hid_t mid, H5E_type_t *mtype)
get error message
Definition: h5_error.cpp:78
pni::core::string description() const
get description
Definition: h5_error.cpp:175
pni::core::string _description
optional description of the error
Definition: h5_error.hpp:58
STL namespace.
h5_error() noexcept
default constructor
Definition: h5_error.cpp:39
pni::core::string _file_name
name of the source file where the error occurred
Definition: h5_error.hpp:55
Definition: cbf_reader.hpp:41
pni::core::string _class_name
Definition: h5_error.hpp:53
pni::core::string major_message() const
get major message
Definition: h5_error.cpp:188
pni::core::string _func_name
name of the HDF5 function where the error occurred
Definition: h5_error.hpp:57
pni::core::string _major_message
major message of the error
Definition: h5_error.hpp:60
pni::core::string func_name() const
get function name
Definition: h5_error.cpp:163
pni::core::string file_name() const
get file name
Definition: h5_error.cpp:151
pni::core::string class_name() const
get class name
Definition: h5_error.cpp:121
HDF5 error record.
Definition: h5_error.hpp:50
pni::core::string _minor_message
minor message of the error
Definition: h5_error.hpp:59