Go to the documentation of this file.
11 #ifndef __IPEXCEPTION_HPP__
12 #define __IPEXCEPTION_HPP__
65 std::string file_name,
67 std::string type =
"IpoptException"
70 file_name_(file_name),
71 line_number_(line_number),
80 file_name_(copy.file_name_),
81 line_number_(copy.line_number_),
97 "Exception of type: %s in file \"%s\" at line %d:\n Exception message: %s\n", type_.c_str(), file_name_.c_str(), line_number_, msg_.c_str());
132 #define THROW_EXCEPTION(__except_type, __msg) \
133 throw __except_type( (__msg), (__FILE__), (__LINE__) );
135 #define ASSERT_EXCEPTION(__condition, __except_type, __msg) \
136 if (! (__condition) ) { \
137 std::string newmsg = #__condition; \
138 newmsg += " evaluated false: "; \
140 throw __except_type( (newmsg), (__FILE__), (__LINE__) ); \
143 #define DECLARE_STD_EXCEPTION(__except_type) \
144 class IPOPTLIB_EXPORT __except_type : public Ipopt::IpoptException \
147 __except_type(std::string msg, std::string fname, Ipopt::Index line) \
148 : Ipopt::IpoptException(msg,fname,line, #__except_type) {} \
149 __except_type(const __except_type& copy) \
150 : Ipopt::IpoptException(copy) {} \
153 void operator=(const __except_type&); \
IpoptException(const IpoptException ©)
Copy Constructor.
virtual void Printf(EJournalLevel level, EJournalCategory category, const char *format,...) const
Method to print a formatted string.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
EJournalLevel
Print Level Enum.
This is the base class for all exceptions.
int Index
Type of all indices of vectors, matrices etc.
void operator=(const IpoptException &)
Default Assignment Operator.
IpoptException()
Default Constructor.
virtual ~IpoptException()
Default destructor.
const std::string & Message() const
void ReportException(const Journalist &jnlst, EJournalLevel level=J_ERROR) const
Method to report the exception to a journalist.
Class responsible for all message output.
IpoptException(std::string msg, std::string file_name, Index line_number, std::string type="IpoptException")
Constructor.