123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #ifndef BOOST_MPI_EXCEPTION_HPP
- #define BOOST_MPI_EXCEPTION_HPP
- #include <boost/mpi/config.hpp>
- #include <exception>
- #include <cassert>
- #include <string>
- #include <boost/config.hpp>
- #include <boost/throw_exception.hpp>
- namespace boost { namespace mpi {
- class BOOST_MPI_DECL exception : public std::exception
- {
- public:
-
- exception(const char* routine, int result_code);
- virtual ~exception() throw();
-
- virtual const char * what () const throw ()
- {
- return this->message.c_str();
- }
-
- const char* routine() const { return routine_; }
-
- int result_code() const { return result_code_; }
-
- int error_class() const
- {
- int result;
- MPI_Error_class(result_code_, &result);
- return result;
- }
- protected:
-
- const char* routine_;
-
- int result_code_;
-
- std::string message;
- };
- #define BOOST_MPI_CHECK_RESULT( MPIFunc, Args ) \
- { \
- int _check_result = MPIFunc Args; \
- assert(_check_result == MPI_SUCCESS); \
- if (_check_result != MPI_SUCCESS) \
- boost::throw_exception(boost::mpi::exception(#MPIFunc, \
- _check_result)); \
- }
- } }
- #endif
|