19 #ifndef __CVC4__EXCEPTION_H 20 #define __CVC4__EXCEPTION_H 39 Exception(
const std::string& msg)
throw() : d_msg(msg) {}
46 void setMessage(
const std::string& msg)
throw() { d_msg = msg; }
50 virtual const char*
what()
const throw() {
return d_msg.c_str(); }
75 virtual void toStream(std::ostream& os)
const throw() { os << d_msg; }
83 void construct(
const char* header,
const char* extra,
84 const char*
function,
const char* fmt, ...) {
87 construct(header, extra,
function, fmt, args);
91 void construct(
const char* header,
const char* extra,
92 const char*
function,
const char* fmt, va_list args);
94 void construct(
const char* header,
const char* extra,
95 const char*
function);
99 const char*
function,
const char* fmt, ...) :
103 construct(
"Illegal argument detected",
104 ( std::string(
"`") + argDesc +
"' is a bad argument" 105 + (*condStr ==
'\0' ? std::string() :
106 ( std::string(
"; expected ") +
107 condStr +
" to hold" )) ).c_str(),
108 function, fmt, args);
113 const char*
function) :
115 construct(
"Illegal argument detected",
116 ( std::string(
"`") + argDesc +
"' is a bad argument" 117 + (*condStr ==
'\0' ? std::string() :
118 ( std::string(
"; expected ") +
119 condStr +
" to hold" )) ).c_str(),
132 #if (defined(__BUILDING_CVC4LIB) || defined(__BUILDING_CVC4LIB_UNIT_TEST)) && !defined(__BUILDING_STATISTICS_FOR_EXPORT) 133 # include "util/cvc4_assert.h" 138 #ifndef CheckArgument 140 template <
class T>
inline void CheckArgument(
bool cond,
const T& arg,
const char* fmt, ...) {
141 if(__builtin_expect( ( !cond ),
false )) { \
142 throw ::CVC4::IllegalArgumentException(
"",
"",
""); \
147 if(__builtin_expect( ( !cond ),
false )) { \
148 throw ::CVC4::IllegalArgumentException(
"",
"",
""); \
153 #ifndef DebugCheckArgument 156 if(__builtin_expect( ( !cond ),
false )) { \
157 throw ::CVC4::IllegalArgumentException(
"",
"",
""); \
162 if(__builtin_expect( ( !cond ),
false )) { \
163 throw ::CVC4::IllegalArgumentException(
"",
"",
""); \
IllegalArgumentException(const char *condStr, const char *argDesc, const char *function)
std::string toString() const
Get this exception as a string.
void DebugCheckArgument(bool cond, const T &arg, const char *fmt,...)
std::string getMessage() const
void CheckArgument(bool cond, const T &arg, const char *fmt,...)
virtual const char * what() const
IllegalArgumentException(const char *condStr, const char *argDesc, const char *function, const char *fmt,...)
Exception(const char *msg)
void construct(const char *header, const char *extra, const char *function, const char *fmt,...)
Exception(const std::string &msg)
virtual void toStream(std::ostream &os) const
Printing: feel free to redefine toStream().
Macros that should be defined everywhere during the building of the libraries and driver binary...
IllegalArgumentException()
void setMessage(const std::string &msg)
std::ostream & operator<<(std::ostream &out, ModelFormatMode mode)