23 #ifndef Rcpp__exceptionscpp98__h
24 #define Rcpp__exceptionscpp98__h
28 #define RCPP_ADVANCED_EXCEPTION_CLASS(__CLASS__, __WHAT__) \
29 class __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 ; \
71 template <
typename T1>
72 inline void warning(
const char* fmt,
const T1& arg1) {
76 template <
typename T1,
typename T2>
77 inline void warning(
const char* fmt,
const T1& arg1,
const T2& arg2) {
78 Rf_warning(
"%s",
tfm::format(fmt, arg1, arg2).c_str());
81 template <
typename T1,
typename T2,
typename T3>
82 inline void warning(
const char* fmt,
const T1& arg1,
const T2& arg2,
const T3& arg3) {
83 Rf_warning(
"%s",
tfm::format(fmt, arg1, arg2, arg3).c_str());
86 template <
typename T1,
typename T2,
typename T3,
typename T4>
87 inline void warning(
const char* fmt,
const T1& arg1,
const T2& arg2,
const T3& arg3,
const T4& arg4) {
88 Rf_warning(
"%s",
tfm::format(fmt, arg1, arg2, arg3, arg4).c_str());
91 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
92 inline void warning(
const char* fmt,
const T1& arg1,
const T2& arg2,
const T3& arg3,
const T4& arg4,
const T5& arg5) {
93 Rf_warning(
"%s",
tfm::format(fmt, arg1, arg2, arg3, arg4, arg5).c_str());
96 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
97 inline void warning(
const char* fmt,
const T1& arg1,
const T2& arg2,
const T3& arg3,
const T4& arg4,
const T5& arg5,
const T6& arg6) {
98 Rf_warning(
"%s",
tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6).c_str());
101 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
102 inline 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) {
103 Rf_warning(
"%s",
tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7).c_str());
106 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
107 inline 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) {
108 Rf_warning(
"%s",
tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8).c_str());
111 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
112 inline 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) {
113 Rf_warning(
"%s",
tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9).c_str());
116 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10>
117 inline 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());
125 template <
typename T1>
126 inline void NORET stop(
const char* fmt,
const T1& arg1) {
130 template <
typename T1,
typename T2>
131 inline void NORET stop(
const char* fmt,
const T1& arg1,
const T2& arg2) {
135 template <
typename T1,
typename T2,
typename T3>
136 inline void NORET stop(
const char* fmt,
const T1& arg1,
const T2& arg2,
const T3& arg3) {
140 template <
typename T1,
typename T2,
typename T3,
typename T4>
141 inline void NORET stop(
const char* fmt,
const T1& arg1,
const T2& arg2,
const T3& arg3,
const T4& arg4) {
145 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
146 inline void NORET stop(
const char* fmt,
const T1& arg1,
const T2& arg2,
const T3& arg3,
const T4& arg4,
const T5& arg5) {
150 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
151 inline void NORET stop(
const char* fmt,
const T1& arg1,
const T2& arg2,
const T3& arg3,
const T4& arg4,
const T5& arg5,
const T6& arg6) {
155 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
156 inline 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) {
160 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
161 inline 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) {
165 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
166 inline 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) {
170 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9,
typename T10>
171 inline 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 warning(const char *fmt, Args &&... args)
void NORET stop(const char *fmt, Args &&... args)