- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Utils/Exceptions/Exception.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #include "Exception.h"
    00015
    00017
    00018 using Mers::Utils::Exceptions::Exception;
    00019 using Mers::Utils::Lang::String;
    00020 using std::ostream;
    00021 using std::endl;
    00022
    00024 // Construction/Destruction
    00026
    00027 Exception::Exception() throw()
    00028         : exception(), mMessage("")
    00029 {
    00030 }
    00031
    00033
    00034 Exception::Exception(String const &str) throw()
    00035         : exception(), mMessage(str)
    00036 {
    00037 }
    00038
    00040
    00041 Exception::Exception(char const * str) throw()
    00042         : exception(), mMessage(str)
    00043 {
    00044 }
    00045
    00047
    00048 Exception::~Exception() throw()
    00049 {
    00050
    00051 }
    00052
    00054
    00055 const char * Exception::what() const throw()
    00056 {
    00057         return mMessage.c_str();
    00058 }
    00059
    00061
    00062 String const & Exception::toString() const throw()
    00063 {
    00064         return mMessage;
    00065 }
    00066
    00068
    00069 #ifndef EMBEDDED
    00070
    00071 void Exception::print(ostream &out) const
    00072 {
    00073         out << toString() << endl;
    00074 }
    00075
    00076 #endif
    00077
    00079
    00080 void Exception::setMessage(String const &str)
    00081 {
    00082         mMessage = str;
    00083 }
    00084
    00086
    00087 void Exception::setMessage(char const * str)
    00088 {
    00089         mMessage = str;
    00090 }
    00091