23#ifndef Rcpp__exceptionscpp98__h
24#define Rcpp__exceptionscpp98__h
28#define RCPP_ADVANCED_EXCEPTION_CLASS(__CLASS__, __WHAT__) \
29class __CLASS__ : public std::exception{ \
31 __CLASS__( ) throw() : message( std::string(__WHAT__) + "." ){} \
32 __CLASS__( const std::string& message ) throw() : message( std::string(__WHAT__) + ": " + message + "." ){} \
33 template <typename T1> \
34 __CLASS__(const char* fmt, const T1& arg1) throw() : \
35 message( tfm::format(fmt, arg1 ) ){} \
36 template <typename T1, typename T2> \
37 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2) throw() : \
38 message( tfm::format(fmt, arg1, arg2 ) ){} \
39 template <typename T1, typename T2, typename T3> \
40 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3) throw() : \
41 message( tfm::format(fmt, arg1, arg2, arg3 ) ){} \
42 template <typename T1, typename T2, typename T3, typename T4> \
43 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4) throw() : \
44 message( tfm::format(fmt, arg1, arg2, arg3, arg4 ) ){} \
45 template <typename T1, typename T2, typename T3, typename T4, typename T5> \
46 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5) throw() : \
47 message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5 ) ){} \
48 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> \
49 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6) throw() : \
50 message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6 ) ){} \
51 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
52 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7) throw() : \
53 message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7 ) ){} \
54 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
55 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8) throw() : \
56 message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ) ){} \
57 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> \
58 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8, const T9& arg9) throw() : \
59 message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ) ){} \
60 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> \
61 __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8, const T9& arg9, const T10& arg10) throw() : \
62 message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 ) ){} \
63 virtual ~__CLASS__() throw(){} \
64 virtual const char* what() const throw() { return message.c_str() ; } \
66 std::string message ; \
76template <
typename T1,
typename T2>
81template <
typename T1,
typename T2,
typename T3>
86template <
typename T1,
typename T2,
typename T3,
typename T4>
91template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
96template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
101template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
106template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
111template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
113 Rf_warning(
"%s",
tfm::format(
fmt,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9).
c_str());
116template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10>
117inline void warning(
const char*
fmt,
const T1&
arg1,
const T2&
arg2,
const T3&
arg3,
const T4&
arg4,
const T5&
arg5,
const T6&
arg6,
const T7&
arg7,
const T8&
arg8,
const T9&
arg9,
const T10&
arg10) {
118 Rf_warning(
"%s",
tfm::format(
fmt,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10).
c_str());
125template <
typename T1>
130template <
typename T1,
typename T2>
135template <
typename T1,
typename T2,
typename T3>
140template <
typename T1,
typename T2,
typename T3,
typename T4>
145template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
150template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
155template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
160template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
165template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
170template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10>
171inline void NORET stop(
const char*
fmt,
const T1&
arg1,
const T2&
arg2,
const T3&
arg3,
const T4&
arg4,
const T5&
arg5,
const T6&
arg6,
const T7&
arg7,
const T8&
arg8,
const T9&
arg9,
const T10&
arg10) {
172 throw Rcpp::exception(
tfm::format(
fmt,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10).
c_str());
void NORET stop(const std::string &message)
void warning(const std::string &message)