OpenADFortTk (basic)
src/lib/support/Exception.cxx
Go to the documentation of this file.
00001 // -*-Mode: C++;-*-
00002 // $Header: /m_home/m_utkej/Argonne/cvs2svn/cvs/OpenADFortTk/src/lib/support/Exception.cxx,v 1.4 2008-05-21 15:13:01 utke Exp $
00003 
00004 #include "Exception.h"
00005 #include "Diagnostics.h"
00006 
00007 namespace fortTkSupport { 
00008 
00009   Exception::Exception(const char* m,
00010                        const char* filenm, unsigned int lineno) {
00011     std::string str = m;
00012     Ctor(str, filenm, lineno);
00013     Diagnostics::theMostVisitedBreakpointInHistory(filenm, lineno);
00014   }
00015 
00016 
00017   Exception::Exception(std::string m,
00018                        const char* filenm, unsigned int lineno) {
00019     Ctor(m, filenm, lineno);
00020     Diagnostics::theMostVisitedBreakpointInHistory(filenm, lineno);
00021   }
00022 
00023 
00024   Exception::~Exception() {
00025   }
00026 
00027 
00028   void 
00029   Exception::Ctor(std::string& m, 
00030                   const char* filenm, unsigned int lineno) {
00031     if (filenm && lineno != 0) {
00032       std::ostringstream os;
00033       os << "[" << filenm << ":" << lineno << "]: " << m.c_str();
00034       msg = os.str();
00035     } 
00036     else {
00037       msg = m;
00038     }
00039   }
00040 
00041   //***************************************************************************
00042     // FatalException
00043     //***************************************************************************
00044 
00045     FatalException::FatalException(const char* m,
00046                                    const char* filenm, unsigned int lineno)
00047       : Exception(m, filenm, lineno) {
00048     }
00049 
00050 
00051   FatalException::FatalException(std::string m,
00052                                  const char* filenm, unsigned int lineno)
00053     : Exception(m, filenm, lineno) {
00054   }
00055 
00056 
00057   FatalException::~FatalException() {
00058   }
00059   
00060 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines