LCOV - code coverage report
Current view: top level - usr/include/boost/interprocess - exceptions.hpp (source / functions) Hit Total Coverage
Test: ROSE Lines: 0 13 0.0 %
Date: 2022-12-08 13:48:47 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //////////////////////////////////////////////////////////////////////////////
       2             : //
       3             : // (C) Copyright Ion Gaztanaga 2005-2015. Distributed under the Boost
       4             : // Software License, Version 1.0. (See accompanying file
       5             : // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6             : //
       7             : // See http://www.boost.org/libs/interprocess for documentation.
       8             : //
       9             : //////////////////////////////////////////////////////////////////////////////
      10             : 
      11             : #ifndef BOOST_INTERPROCESS_EXCEPTIONS_HPP
      12             : #define BOOST_INTERPROCESS_EXCEPTIONS_HPP
      13             : 
      14             : #ifndef BOOST_CONFIG_HPP
      15             : #  include <boost/config.hpp>
      16             : #endif
      17             : #
      18             : #if defined(BOOST_HAS_PRAGMA_ONCE)
      19             : #  pragma once
      20             : #endif
      21             : 
      22             : #include <boost/interprocess/detail/config_begin.hpp>
      23             : #include <boost/interprocess/detail/workaround.hpp>
      24             : #include <boost/interprocess/errors.hpp>
      25             : #include <stdexcept>
      26             : 
      27             : //!\file
      28             : //!Describes exceptions thrown by interprocess classes
      29             : 
      30             : namespace boost {
      31             : 
      32             : namespace interprocess {
      33             : 
      34             : //!This class is the base class of all exceptions
      35             : //!thrown by boost::interprocess
      36             : class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception
      37             : {
      38             :    public:
      39             :    interprocess_exception(const char *err)
      40             :       :  m_err(other_error)
      41             :    {
      42             :       try   {  m_str = err; }
      43             :       catch (...) {}
      44             :    }
      45             : 
      46           0 :    interprocess_exception(const error_info &err_info, const char *str = 0)
      47           0 :       :  m_err(err_info)
      48             :    {
      49           0 :       try{
      50           0 :          if(m_err.get_native_error() != 0){
      51           0 :             fill_system_message(m_err.get_native_error(), m_str);
      52             :          }
      53           0 :          else if(str){
      54           0 :             m_str = str;
      55             :          }
      56             :          else{
      57           0 :             m_str = "boost::interprocess_exception::library_error";
      58             :          }
      59             :       }
      60           0 :       catch(...){}
      61           0 :    }
      62             : 
      63           0 :    virtual ~interprocess_exception() BOOST_NOEXCEPT_OR_NOTHROW {}
      64             : 
      65           0 :    virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
      66           0 :    {  return m_str.c_str();  }
      67             : 
      68             :    native_error_t get_native_error()const { return m_err.get_native_error(); }
      69             : 
      70             :    // Note: a value of other_error implies a library (rather than system) error
      71             :    error_code_t   get_error_code()  const { return m_err.get_error_code(); }
      72             : 
      73             :    #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
      74             :    private:
      75             :    error_info        m_err;
      76             :    std::string       m_str;
      77             :    #endif   //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
      78             : };
      79             : 
      80             : //!This is the exception thrown by shared interprocess_mutex family when a deadlock situation
      81             : //!is detected or when using a interprocess_condition the interprocess_mutex is not locked
      82             : class BOOST_SYMBOL_VISIBLE lock_exception : public interprocess_exception
      83             : {
      84             :    public:
      85             :    lock_exception()
      86             :       :  interprocess_exception(lock_error)
      87             :    {}
      88             : 
      89             :    virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW
      90             :    {  return "boost::interprocess::lock_exception";  }
      91             : };
      92             : 
      93             : 
      94             : //!This exception is thrown when a memory request can't be
      95             : //!fulfilled.
      96             : class BOOST_SYMBOL_VISIBLE bad_alloc : public interprocess_exception
      97             : {
      98             :  public:
      99             :    bad_alloc() : interprocess_exception("::boost::interprocess::bad_alloc"){}
     100             :    virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW
     101             :       {  return "boost::interprocess::bad_alloc";  }
     102             : };
     103             : 
     104             : }  // namespace interprocess {
     105             : 
     106             : }  // namespace boost
     107             : 
     108             : #include <boost/interprocess/detail/config_end.hpp>
     109             : 
     110             : #endif // BOOST_INTERPROCESS_EXCEPTIONS_HPP

Generated by: LCOV version 1.14