escript  Revision_
EsysAssertException.h
Go to the documentation of this file.
00001 
00002 /*****************************************************************************
00003 *
00004 * Copyright (c) 2003-2014 by University of Queensland
00005 * http://www.uq.edu.au
00006 *
00007 * Primary Business: Queensland, Australia
00008 * Licensed under the Open Software License version 3.0
00009 * http://www.opensource.org/licenses/osl-3.0.php
00010 *
00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
00012 * Development 2012-2013 by School of Earth Sciences
00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
00014 *
00015 *****************************************************************************/
00016 
00017 
00018 #if !defined escript_EsysAssertException_20040330_H
00019 #define escript_EsysAssertException_20040330_H
00020 #include "system_dep.h"
00021 
00022 #include "EsysException.h"
00023 
00024 
00025 namespace esysUtils {
00026 
00035   class EsysAssertException : public EsysException
00036   {
00037 
00038   protected:
00039 
00040      typedef EsysException Parent;
00041 
00042   public:
00047     ESYSUTILS_DLL_API
00048     inline
00049     EsysAssertException() : Parent() { updateMessage();}
00054     ESYSUTILS_DLL_API
00055     inline
00056     EsysAssertException(const char *cstr) : Parent(cstr) { updateMessage();}
00061     ESYSUTILS_DLL_API
00062     inline
00063     EsysAssertException(const std::string &str) :
00064     Parent(str) { updateMessage();}
00069     ESYSUTILS_DLL_API
00070     inline
00071     EsysAssertException(const EsysAssertException &other) : Parent(other)
00072       {
00073         updateMessage();
00074       }
00075 
00076     ESYSUTILS_DLL_API
00077     inline 
00078     EsysAssertException &
00079     operator=(const EsysAssertException &other) THROW(NO_ARG)
00080         {
00081            Parent::operator=(other);
00082            updateMessage();   
00083            return *this;
00084         }
00085 
00086 
00088     ESYSUTILS_DLL_API
00089     virtual ~EsysAssertException() THROW(NO_ARG) {}
00090 
00095     ESYSUTILS_DLL_API
00096     virtual const std::string & exceptionName() const;
00097 
00102     ESYSUTILS_DLL_API
00103     static void assertFailure (const std::string& assertion,
00104                                const std::string& date,
00105                                const std::string& file,
00106                                int line, const std::string& errDesc);
00107   private:
00108 
00109     //
00110     // the exception name is immutable and class-wide.
00111     // Inheritor note; you need one of these too.
00112     // and an overloaded exceptionName() in your .cpp implementation file. 
00113     static const std::string exceptionNameValue;
00114   };
00115 
00116 } // end of namespace
00117  
00118 #endif