hops
H5Exception.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
3  *
4  * Distributed under the Boost Software License, Version 1.0.
5  * (See accompanying file LICENSE_1_0.txt or copy at
6  * http://www.boost.org/LICENSE_1_0.txt)
7  *
8  */
9 #ifndef H5EXCEPTION_HPP
10 #define H5EXCEPTION_HPP
11 
12 #include <memory>
13 #include <stdexcept>
14 #include <string>
15 
16 #include <H5Ipublic.h>
17 
18 namespace HighFive {
19 
24 class Exception : public std::exception {
25  public:
26  Exception(const std::string& err_msg)
27  : _errmsg(err_msg), _next(), _err_major(0), _err_minor(0) {}
28 
29  virtual ~Exception() throw() {}
30 
35  inline const char* what() const throw() override { return _errmsg.c_str(); }
36 
41  inline virtual void setErrorMsg(const std::string& errmsg) {
42  _errmsg = errmsg;
43  }
44 
50  inline Exception* nextException() const { return _next.get(); }
51 
56  inline hid_t getErrMajor() const { return _err_major; }
57 
62  inline hid_t getErrMinor() const { return _err_minor; }
63 
64  protected:
66  std::shared_ptr<Exception> _next;
68 
69  friend struct HDF5ErrMapper;
70 };
71 
75 class ObjectException : public Exception {
76  public:
77  ObjectException(const std::string& err_msg) : Exception(err_msg) {}
78 };
79 
83 class DataTypeException : public Exception {
84  public:
85  DataTypeException(const std::string& err_msg) : Exception(err_msg) {}
86 };
87 
91 class FileException : public Exception {
92  public:
93  FileException(const std::string& err_msg) : Exception(err_msg) {}
94 };
95 
99 class DataSpaceException : public Exception {
100  public:
101  DataSpaceException(const std::string& err_msg) : Exception(err_msg) {}
102 };
103 
108  public:
109  AttributeException(const std::string& err_msg) : Exception(err_msg) {}
110 };
111 
115 class DataSetException : public Exception {
116  public:
117  DataSetException(const std::string& err_msg) : Exception(err_msg) {}
118 };
119 
123 class GroupException : public Exception {
124  public:
125  GroupException(const std::string& err_msg) : Exception(err_msg) {}
126 };
127 
131 class PropertyException : public Exception {
132  public:
133  PropertyException(const std::string& err_msg) : Exception(err_msg) {}
134 };
135 
140  public:
141  ReferenceException(const std::string& err_msg) : Exception(err_msg) {}
142 };
143 }
144 
145 #include "bits/H5Exception_misc.hpp"
146 
147 #endif // H5EXCEPTION_HPP
HighFive::PropertyException::PropertyException
PropertyException(const std::string &err_msg)
Definition: H5Exception.hpp:133
HighFive::ReferenceException
Exception specific to HighFive Reference interface.
Definition: H5Exception.hpp:139
HighFive::PropertyException
Exception specific to HighFive Property interface.
Definition: H5Exception.hpp:131
HighFive::ReferenceException::ReferenceException
ReferenceException(const std::string &err_msg)
Definition: H5Exception.hpp:141
HighFive::Exception::getErrMajor
hid_t getErrMajor() const
HDF5 library error mapper.
Definition: H5Exception.hpp:56
HighFive::DataSpaceException::DataSpaceException
DataSpaceException(const std::string &err_msg)
Definition: H5Exception.hpp:101
HighFive::GroupException
Exception specific to HighFive Group interface.
Definition: H5Exception.hpp:123
HighFive::Exception::nextException
Exception * nextException() const
nextException
Definition: H5Exception.hpp:50
HighFive::GroupException::GroupException
GroupException(const std::string &err_msg)
Definition: H5Exception.hpp:125
HighFive::FileException::FileException
FileException(const std::string &err_msg)
Definition: H5Exception.hpp:93
HighFive::Exception::_next
std::shared_ptr< Exception > _next
Definition: H5Exception.hpp:66
HighFive::Exception::setErrorMsg
virtual void setErrorMsg(const std::string &errmsg)
define the error message
Definition: H5Exception.hpp:41
HighFive::Exception::Exception
Exception(const std::string &err_msg)
Definition: H5Exception.hpp:26
HighFive::ObjectException::ObjectException
ObjectException(const std::string &err_msg)
Definition: H5Exception.hpp:77
HighFive::AttributeException
Exception specific to HighFive Attribute interface.
Definition: H5Exception.hpp:107
HighFive::AttributeException::AttributeException
AttributeException(const std::string &err_msg)
Definition: H5Exception.hpp:109
HighFive::DataSetException
Exception specific to HighFive DataSet interface.
Definition: H5Exception.hpp:115
HighFive::FileException
Exception specific to HighFive File interface.
Definition: H5Exception.hpp:91
HighFive::DataTypeException::DataTypeException
DataTypeException(const std::string &err_msg)
Definition: H5Exception.hpp:85
HighFive::Exception::_err_major
hid_t _err_major
Definition: H5Exception.hpp:67
HighFive::ObjectException
Exception specific to HighFive Object interface.
Definition: H5Exception.hpp:75
H5Exception_misc.hpp
HighFive::DataSetException::DataSetException
DataSetException(const std::string &err_msg)
Definition: H5Exception.hpp:117
HighFive::Exception::what
const char * what() const override
get the current exception error message
Definition: H5Exception.hpp:35
HighFive::Exception
Basic HighFive Exception class.
Definition: H5Exception.hpp:24
string
NAME string(REPLACE ".cpp" "_bin" example_name ${example_filename}) if($
Definition: hops/Third-party/HighFive/src/examples/CMakeLists.txt:6
HighFive::Exception::~Exception
virtual ~Exception()
Definition: H5Exception.hpp:29
HighFive::Exception::getErrMinor
hid_t getErrMinor() const
HDF5 library error mapper.
Definition: H5Exception.hpp:62
HighFive::HDF5ErrMapper
Definition: H5Exception_misc.hpp:19
HighFive::DataTypeException
Exception specific to HighFive DataType interface.
Definition: H5Exception.hpp:83
HighFive
Definition: H5_definitions.hpp:15
HighFive::Exception::_err_minor
hid_t _err_minor
Definition: H5Exception.hpp:67
HighFive::Exception::_errmsg
std::string _errmsg
Definition: H5Exception.hpp:65
HighFive::DataSpaceException
Exception specific to HighFive DataSpace interface.
Definition: H5Exception.hpp:99