30 #ifndef CORE_UTILS_EXCEPTION_H
31 #define CORE_UTILS_EXCEPTION_H
34 #include <boost/exception/all.hpp>
35 #include <boost/tuple/tuple.hpp>
36 #include <boost/numeric/interval.hpp>
48 virtual const char* what()
const throw();
49 std::string typeName()
const;
52 typedef boost::error_info<struct tag_error_message, std::string>
ErrorMessage;
53 typedef boost::error_info<struct tag_null_object, std::string>
NullObjectInfo;
54 typedef boost::error_info<struct tag_file_not_found, std::string>
FileNotFound;
58 typedef boost::error_info<struct tag_double_out_of_range, boost::tuple<std::string, double, boost::numeric::interval<double> > >
DoubleOutOfRangeInfo;
59 typedef boost::error_info<struct tag_int_out_of_range, boost::tuple<std::string, int, boost::numeric::interval<int> > >
IntOutOfRangeInfo;
63 #define ENSURE_NOT_NULL(var, message) if (!(var)) BOOST_THROW_EXCEPTION(SCIRun::Core::NullPointerException() << SCIRun::Core::NullObjectInfo(message))
67 #define THROW_OUT_OF_RANGE(message) BOOST_THROW_EXCEPTION(SCIRun::Core::OutOfRangeException() << SCIRun::Core::ErrorMessage(message))
71 #define THROW_INVALID_ARGUMENT(message) BOOST_THROW_EXCEPTION(SCIRun::Core::InvalidArgumentException() << SCIRun::Core::ErrorMessage(message))
93 #define ENSURE_DIMENSIONS_MATCH(var1, var2, message) if (var1 != var2) \
94 BOOST_THROW_EXCEPTION(SCIRun::Core::DimensionMismatch() << SCIRun::Core::DimensionMismatchInfo( \
95 SCIRun::Core::DimensionMismatchInfo::value_type( \
96 std::string(message) )))
98 #define REPORT_INVALID_ARGUMENT_VALUE(message) \
99 BOOST_THROW_EXCEPTION(SCIRun::Core::InvalidArgumentValue() << SCIRun::Core::InvalidArgumentValueInfo( \
100 SCIRun::Core::InvalidArgumentValueInfo::value_type( \
101 std::string(message) )))
106 #define REPORT_NOT_IMPLEMENTED(message) \
107 BOOST_THROW_EXCEPTION(SCIRun::Core::NotImplemented() << SCIRun::Core::NotImplementedInfo( \
108 SCIRun::Core::NotImplementedInfo::value_type( \
109 std::string(message) )))
113 #define ASSERTMSG(condition,message) \
115 BOOST_THROW_EXCEPTION(SCIRun::Core::AssertionFailed() << SCIRun::Core::ErrorMessage(message)); \
Definition: Exception.h:69
Definition: Exception.h:111
boost::error_info< struct tag_invalid_argument_value, std::string > InvalidArgumentValueInfo
Definition: Exception.h:74
Definition: Exception.h:61
boost::error_info< struct tag_linear_algebra_error, std::string > LinearAlgebraErrorMessage
Definition: Exception.h:56
#define SCISHARE
Definition: share.h:39
boost::error_info< struct tag_int_out_of_range, boost::tuple< std::string, int, boost::numeric::interval< int > > > IntOutOfRangeInfo
Definition: Exception.h:59
boost::error_info< struct tag_error_message, std::string > ErrorMessage
Definition: Exception.h:52
Definition: Exception.h:46
boost::error_info< struct tag_double_out_of_range, boost::tuple< std::string, double, boost::numeric::interval< double > > > DoubleOutOfRangeInfo
Definition: Exception.h:58
Definition: Exception.h:82
Definition: Exception.h:89
Definition: Exception.h:78
boost::error_info< struct tag_null_object, std::string > NullObjectInfo
Definition: Exception.h:53
Definition: Exception.h:65
boost::error_info< struct tag_dimension_mismatch, std::string > DimensionMismatchInfo
Definition: Exception.h:73
boost::error_info< struct tag_file_not_found, std::string > FileNotFound
Definition: Exception.h:54
boost::error_info< struct tag_not_implemented, std::string > NotImplementedInfo
Definition: Exception.h:75