00001 // Copyright (C) 2007 Peter Carbonetto. All Rights Reserved. 00002 // This code is published under the Common 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 // Class MatlabException 00015 // ----------------------------------------------------------------- 00016 // It is assumed that the argument passed to the constructor persists 00017 // as long as the MatlabException object is in scope. Usually, this 00018 // means that it should persist for the duration of the entire 00019 // program. This is always the case if the input "message" is a literal. 00020 class MatlabException : public std::exception { 00021 public: 00022 MatlabException (const char* message) throw(); 00023 ~MatlabException() throw() { }; 00024 00025 // The copy constructor makes a shallow copy. 00026 MatlabException (const MatlabException& source) throw(); 00027 00028 // The copy assignment operator makes a shallow copy as well. 00029 MatlabException& operator= (const MatlabException& source); 00030 00031 // Return the message string. 00032 virtual const char* what () const throw() { return message; }; 00033 00034 private: 00035 const char* message; // The error message. 00036 }; 00037 00038 #endif