File indexing completed on 2026-09-17 08:52:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_INTERPROCESS_EXCEPTIONS_HPP
0012 #define BOOST_INTERPROCESS_EXCEPTIONS_HPP
0013
0014 #ifndef BOOST_CONFIG_HPP
0015 # include <boost/config.hpp>
0016 #endif
0017 0018 ">#
0019 #if defined(BOOST_HAS_PRAGMA_ONCE)
0020 # pragma once
0021 #endif
0022
0023 #include <boost/interprocess/detail/config_begin.hpp>
0024 #include <boost/interprocess/detail/workaround.hpp>
0025 #include <boost/interprocess/errors.hpp>
0026 #include <stdexcept>
0027
0028
0029
0030
0031 namespace boost {
0032
0033 namespace interprocess {
0034
0035
0036
0037 class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception
0038 {
0039 public:
0040 interprocess_exception(const char *err) BOOST_NOEXCEPT
0041 : m_err(other_error)
0042 {
0043 BOOST_INTERPROCESS_TRY { m_str = err; }
0044 BOOST_INTERPROCESS_CATCH(...) {} BOOST_INTERPROCESS_CATCH_END
0045 }
0046
0047 interprocess_exception(const error_info &err_info, const char *str = 0)
0048 : m_err(err_info)
0049 {
0050 BOOST_INTERPROCESS_TRY{
0051 if(m_err.get_native_error() != 0){
0052 fill_system_message(m_err.get_native_error(), m_str);
0053 }
0054 else if(str){
0055 m_str = str;
0056 }
0057 else{
0058 m_str = "boost::interprocess_exception::library_error";
0059 }
0060 }
0061 BOOST_INTERPROCESS_CATCH(...){} BOOST_INTERPROCESS_CATCH_END
0062 }
0063
0064 ~interprocess_exception() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {}
0065
0066 const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
0067 { return m_str.c_str(); }
0068
0069 native_error_t get_native_error() const BOOST_NOEXCEPT { return m_err.get_native_error(); }
0070
0071
0072 error_code_t get_error_code() const BOOST_NOEXCEPT { return m_err.get_error_code(); }
0073
0074 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0075 private:
0076 error_info m_err;
0077 std::string m_str;
0078 #endif
0079 };
0080
0081
0082
0083 class BOOST_SYMBOL_VISIBLE lock_exception : public interprocess_exception
0084 {
0085 public:
0086 lock_exception(error_code_t err = lock_error) BOOST_NOEXCEPT
0087 : interprocess_exception(err)
0088 {}
0089
0090 const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
0091 { return "boost::interprocess::lock_exception"; }
0092 };
0093
0094
0095
0096
0097 class BOOST_SYMBOL_VISIBLE bad_alloc : public interprocess_exception
0098 {
0099 public:
0100 bad_alloc() : interprocess_exception("::boost::interprocess::bad_alloc") {}
0101
0102 const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
0103 { return "boost::interprocess::bad_alloc"; }
0104 };
0105
0106 }
0107
0108 }
0109
0110 #include <boost/interprocess/detail/config_end.hpp>
0111
0112 #endif