# matlabexception.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2007, 2009 Peter Carbonetto. All Rights Reserved.
    00002 // This code is published under the Eclipse Public License.
    00003 //
    00004 // Author: Peter Carbonetto
    00005 //         Dept. of Computer Science
    00006 //         University of British Columbia
    00007 //         May 19, 2007
    00008
    00009 #ifndef INCLUDE_MATLABEXCEPTION
    00010 #define INCLUDE_MATLABEXCEPTION
    00011
    00012 #include <exception>
    00013
    00014 #define ME_BUFLEN 512
    00015
    00016 // Class MatlabException
    00017 // -----------------------------------------------------------------
    00018 // It is assumed that the argument passed to the constructor persists
    00019 // as long as the MatlabException object is in scope. Usually, this
    00020 // means that it should persist for the duration of the entire
    00021 // program. This is always the case if the input "message" is a literal.
    00022 //
    00023 // AW: Since I would like to include more detailed information (e.g.,
    00024 // which option is the one that is unknown), I changed this so that
    00025 // this object keeps a copy of the exception
    00026 class MatlabException : public std::exception {
    00027 public:
    00028   MatlabException (const char* message) throw();
    00029   ~MatlabException()                    throw() { };
    00030
    00031   // The copy constructor makes a copy.
    00032   MatlabException (const MatlabException& source) throw();
    00033
    00034   // The copy assignment operator makes a copy as well.
    00035   MatlabException& operator= (const MatlabException& source);
    00036
    00037   // Return the message string.
    00038   virtual const char* what () const throw() { return message; };
    00039
    00040 private:
    00041   char message[ME_BUFLEN];  // The error message.
    00042 };
    00043
    00044 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines