22 #ifndef Rcpp__exceptions__h
23 #define Rcpp__exceptions__h
26 #include <Rinternals.h>
30 #define GET_STACKTRACE() stack_trace( __FILE__, __LINE__ )
36 explicit exception(
const char* message_) ;
37 exception(
const char* message_,
const char* file,
int line ) ;
39 virtual const char*
what()
const throw() ;
46 std::ostringstream ostr;
53 no_such_env(
const std::string& name )
throw() :
message( std::string(
"no such environment: '") + name +
"'" ){} ;
56 virtual const char*
what()
const throw(){
return message.c_str() ; } ;
67 virtual const char*
what()
const throw(){
return message.c_str() ; } ;
84 #define RCPP_EXCEPTION_CLASS(__CLASS__,__WHAT__) \
85 class __CLASS__ : public std::exception{ \
87 __CLASS__( const std::string& message ) throw() : message( __WHAT__ ){} ; \
88 virtual ~__CLASS__() throw(){} ; \
89 virtual const char* what() const throw() ; \
91 std::string message ; \
94 #define RCPP_SIMPLE_EXCEPTION_CLASS(__CLASS__,__MESSAGE__) \
95 class __CLASS__ : public std::exception{ \
97 __CLASS__() throw() {} ; \
98 virtual ~__CLASS__() throw(){} ; \
99 virtual const char* what() const throw() ; \
115 RCPP_EXCEPTION_CLASS(S4_creation_error, std::
string("error creating
object of S4 class : ") + message )
116 RCPP_EXCEPTION_CLASS(reference_creation_error, std::
string("error creating
object of reference class : ") + message )
124 #undef RCPP_EXCEPTION_CLASS
125 #undef RCPP_SIMPLE_EXCEPTION_CLASS
134 std::string
demangle(
const std::string& name) ;
135 #define DEMANGLE(__TYPE__) demangle( typeid(__TYPE__).name() ).c_str()