Ipopt  3.12.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
matlabexception.hpp
Go to the documentation of this file.
1 // Copyright (C) 2007, 2009 Peter Carbonetto. All Rights Reserved.
2 // This code is published under the Eclipse Public License.
3 //
4 // Author: Peter Carbonetto
5 // Dept. of Computer Science
6 // University of British Columbia
7 // May 19, 2007
8 
9 #ifndef INCLUDE_MATLABEXCEPTION
10 #define INCLUDE_MATLABEXCEPTION
11 
12 #include <exception>
13 
14 #define ME_BUFLEN 512
15 
16 // Class MatlabException
17 // -----------------------------------------------------------------
18 // It is assumed that the argument passed to the constructor persists
19 // as long as the MatlabException object is in scope. Usually, this
20 // means that it should persist for the duration of the entire
21 // program. This is always the case if the input "message" is a literal.
22 //
23 // AW: Since I would like to include more detailed information (e.g.,
24 // which option is the one that is unknown), I changed this so that
25 // this object keeps a copy of the exception
26 class MatlabException : public std::exception {
27 public:
28  MatlabException (const char* message) throw();
29  ~MatlabException() throw() { };
30 
31  // The copy constructor makes a copy.
32  MatlabException (const MatlabException& source) throw();
33 
34  // The copy assignment operator makes a copy as well.
36 
37  // Return the message string.
38  virtual const char* what () const throw() { return message; };
39 
40 private:
41  char message[ME_BUFLEN]; // The error message.
42 };
43 
44 #endif
MatlabException & operator=(const MatlabException &source)
virtual const char * what() const
MatlabException(const char *message)
#define ME_BUFLEN
char message[ME_BUFLEN]