Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 08:55:36

0001 /*
0002  *  Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
0003  *
0004  *  Distributed under the Boost Software License, Version 1.0.
0005  *    (See accompanying file LICENSE_1_0.txt or copy at
0006  *          http://www.boost.org/LICENSE_1_0.txt)
0007  *
0008  */
0009 #pragma once
0010 
0011 #include <memory>
0012 #include <stdexcept>
0013 #include <string>
0014 
0015 #include <H5Ipublic.h>
0016 
0017 namespace HighFive {
0018 
0019 ///
0020 /// \brief Basic HighFive Exception class
0021 ///
0022 ///
0023 class Exception: public std::exception {
0024   public:
0025     Exception(const std::string& err_msg)
0026         : _errmsg(err_msg)
0027         , _next()
0028         , _err_major(0)
0029         , _err_minor(0) {}
0030 
0031     virtual ~Exception() throw() {}
0032 
0033     ///
0034     /// \brief get the current exception error message
0035     /// \return
0036     ///
0037     inline const char* what() const throw() override {
0038         return _errmsg.c_str();
0039     }
0040 
0041     ///
0042     /// \brief define the error message
0043     /// \param errmsg
0044     ///
0045     inline virtual void setErrorMsg(const std::string& errmsg) {
0046         _errmsg = errmsg;
0047     }
0048 
0049     ///
0050     /// \brief nextException
0051     /// \return pointer to the next exception in the chain, or NULL if not
0052     /// existing
0053     ///
0054     inline Exception* nextException() const {
0055         return _next.get();
0056     }
0057 
0058     ///
0059     /// \brief HDF5 library error mapper
0060     /// \return HDF5 major error number
0061     ///
0062     inline hid_t getErrMajor() const {
0063         return _err_major;
0064     }
0065 
0066     ///
0067     /// \brief HDF5 library error mapper
0068     /// \return HDF5 minor error number
0069     ///
0070     inline hid_t getErrMinor() const {
0071         return _err_minor;
0072     }
0073 
0074   protected:
0075     std::string _errmsg;
0076     std::shared_ptr<Exception> _next;
0077     hid_t _err_major, _err_minor;
0078 
0079     friend struct HDF5ErrMapper;
0080 };
0081 
0082 ///
0083 /// \brief Exception specific to HighFive Object interface
0084 ///
0085 class ObjectException: public Exception {
0086   public:
0087     ObjectException(const std::string& err_msg)
0088         : Exception(err_msg) {}
0089 };
0090 
0091 ///
0092 /// \brief Exception specific to HighFive DataType interface
0093 ///
0094 class DataTypeException: public Exception {
0095   public:
0096     DataTypeException(const std::string& err_msg)
0097         : Exception(err_msg) {}
0098 };
0099 
0100 ///
0101 /// \brief Exception specific to HighFive File interface
0102 ///
0103 class FileException: public Exception {
0104   public:
0105     FileException(const std::string& err_msg)
0106         : Exception(err_msg) {}
0107 };
0108 
0109 ///
0110 /// \brief Exception specific to HighFive DataSpace interface
0111 ///
0112 class DataSpaceException: public Exception {
0113   public:
0114     DataSpaceException(const std::string& err_msg)
0115         : Exception(err_msg) {}
0116 };
0117 
0118 ///
0119 /// \brief Exception specific to HighFive Attribute interface
0120 ///
0121 class AttributeException: public Exception {
0122   public:
0123     AttributeException(const std::string& err_msg)
0124         : Exception(err_msg) {}
0125 };
0126 
0127 ///
0128 /// \brief Exception specific to HighFive DataSet interface
0129 ///
0130 class DataSetException: public Exception {
0131   public:
0132     DataSetException(const std::string& err_msg)
0133         : Exception(err_msg) {}
0134 };
0135 
0136 ///
0137 /// \brief Exception specific to HighFive Group interface
0138 ///
0139 class GroupException: public Exception {
0140   public:
0141     GroupException(const std::string& err_msg)
0142         : Exception(err_msg) {}
0143 };
0144 
0145 ///
0146 /// \brief Exception specific to HighFive Property interface
0147 ///
0148 class PropertyException: public Exception {
0149   public:
0150     PropertyException(const std::string& err_msg)
0151         : Exception(err_msg) {}
0152 };
0153 
0154 ///
0155 /// \brief Exception specific to HighFive Reference interface
0156 ///
0157 class ReferenceException: public Exception {
0158   public:
0159     ReferenceException(const std::string& err_msg)
0160         : Exception(err_msg) {}
0161 };
0162 }  // namespace HighFive
0163 
0164 #include "bits/H5Exception_misc.hpp"