HighFive 3.0.0
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
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#pragma once
10
11#include <memory>
12#include <stdexcept>
13#include <string>
14
15#include <H5Ipublic.h>
16
17namespace HighFive {
18
23class Exception: public std::exception {
24 public:
25 explicit Exception(const std::string& err_msg)
26 : _errmsg(err_msg) {}
27
28 Exception(const Exception& other) = default;
29 Exception(Exception&& other) noexcept = default;
30
31 Exception& operator=(const Exception& other) = default;
32 Exception& operator=(Exception&& other) noexcept = default;
33
34 ~Exception() noexcept override {}
35
40 inline const char* what() const noexcept override {
41 return _errmsg.c_str();
42 }
43
48 inline virtual void setErrorMsg(const std::string& errmsg) {
49 _errmsg = errmsg;
50 }
51
57 inline Exception* nextException() const {
58 return _next.get();
59 }
60
65 inline hid_t getErrMajor() const {
66 return _err_major;
67 }
68
73 inline hid_t getErrMinor() const {
74 return _err_minor;
75 }
76
77 private:
78 std::string _errmsg;
79 std::shared_ptr<Exception> _next = nullptr;
80 hid_t _err_major = 0, _err_minor = 0;
81
82 friend struct HDF5ErrMapper;
83};
84
89 public:
90 explicit ObjectException(const std::string& err_msg)
91 : Exception(err_msg) {}
92};
93
98 public:
99 explicit DataTypeException(const std::string& err_msg)
100 : Exception(err_msg) {}
101};
102
107 public:
108 explicit FileException(const std::string& err_msg)
109 : Exception(err_msg) {}
110};
111
116 public:
117 explicit DataSpaceException(const std::string& err_msg)
118 : Exception(err_msg) {}
119};
120
125 public:
126 explicit AttributeException(const std::string& err_msg)
127 : Exception(err_msg) {}
128};
129
134 public:
135 explicit DataSetException(const std::string& err_msg)
136 : Exception(err_msg) {}
137};
138
143 public:
144 explicit GroupException(const std::string& err_msg)
145 : Exception(err_msg) {}
146};
147
152 public:
153 explicit PropertyException(const std::string& err_msg)
154 : Exception(err_msg) {}
155};
156
161 public:
162 explicit ReferenceException(const std::string& err_msg)
163 : Exception(err_msg) {}
164};
165} // namespace HighFive
166
Exception specific to HighFive Attribute interface.
Definition H5Exception.hpp:124
AttributeException(const std::string &err_msg)
Definition H5Exception.hpp:126
Exception specific to HighFive DataSet interface.
Definition H5Exception.hpp:133
DataSetException(const std::string &err_msg)
Definition H5Exception.hpp:135
Exception specific to HighFive DataSpace interface.
Definition H5Exception.hpp:115
DataSpaceException(const std::string &err_msg)
Definition H5Exception.hpp:117
Exception specific to HighFive DataType interface.
Definition H5Exception.hpp:97
DataTypeException(const std::string &err_msg)
Definition H5Exception.hpp:99
Basic HighFive Exception class.
Definition H5Exception.hpp:23
Exception * nextException() const
nextException
Definition H5Exception.hpp:57
Exception & operator=(Exception &&other) noexcept=default
Exception(Exception &&other) noexcept=default
Exception & operator=(const Exception &other)=default
virtual void setErrorMsg(const std::string &errmsg)
define the error message
Definition H5Exception.hpp:48
Exception(const Exception &other)=default
hid_t getErrMajor() const
HDF5 library error mapper.
Definition H5Exception.hpp:65
const char * what() const noexcept override
get the current exception error message
Definition H5Exception.hpp:40
~Exception() noexcept override
Definition H5Exception.hpp:34
hid_t getErrMinor() const
HDF5 library error mapper.
Definition H5Exception.hpp:73
Exception(const std::string &err_msg)
Definition H5Exception.hpp:25
Exception specific to HighFive File interface.
Definition H5Exception.hpp:106
FileException(const std::string &err_msg)
Definition H5Exception.hpp:108
Exception specific to HighFive Group interface.
Definition H5Exception.hpp:142
GroupException(const std::string &err_msg)
Definition H5Exception.hpp:144
Exception specific to HighFive Object interface.
Definition H5Exception.hpp:88
ObjectException(const std::string &err_msg)
Definition H5Exception.hpp:90
Exception specific to HighFive Property interface.
Definition H5Exception.hpp:151
PropertyException(const std::string &err_msg)
Definition H5Exception.hpp:153
Exception specific to HighFive Reference interface.
Definition H5Exception.hpp:160
ReferenceException(const std::string &err_msg)
Definition H5Exception.hpp:162
Definition assert_compatible_spaces.hpp:15
Definition H5Exception_misc.hpp:19