escript  Revision_Unversioneddirectory
EsysAssertException.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 
18 #if !defined escript_EsysAssertException_20040330_H
19 #define escript_EsysAssertException_20040330_H
20 #include "system_dep.h"
21 
22 #include "EsysException.h"
23 
24 
25 namespace esysUtils {
26 
36  {
37 
38  protected:
39 
41 
42  public:
48  inline
55  inline
56  EsysAssertException(const char *cstr) : Parent(cstr) { updateMessage();}
62  inline
63  EsysAssertException(const std::string &str) :
64  Parent(str) { updateMessage();}
70  inline
71  EsysAssertException(const EsysAssertException &other) : Parent(other)
72  {
73  updateMessage();
74  }
75 
77  inline
80  {
81  Parent::operator=(other);
82  updateMessage();
83  return *this;
84  }
85 
86 
90 
96  virtual const std::string & exceptionName() const;
97 
103  static void assertFailure (const std::string& assertion,
104  const std::string& date,
105  const std::string& file,
106  int line, const std::string& errDesc);
107  private:
108 
109  //
110  // the exception name is immutable and class-wide.
111  // Inheritor note; you need one of these too.
112  // and an overloaded exceptionName() in your .cpp implementation file.
113  static const std::string exceptionNameValue;
114  };
115 
116 } // end of namespace
117 
118 #endif
void updateMessage()
update m_exceptionMessage after a reason update.
Definition: EsysException.h:202
EsysAssertException exception class.
Definition: EsysAssertException.h:35
A base class for exception classes used within Esys system.
Definition: EsysException.h:31
#define NO_ARG
Definition: esysUtils/src/system_dep.h:56
virtual ~EsysAssertException()
Destructor.
Definition: EsysAssertException.h:89
virtual const std::string & exceptionName() const
Returns the name of the exception.
Definition: EsysAssertException.cpp:29
EsysException & operator=(const EsysException &other)
Assignment needed to override any automatic assignment of std::exception, which can potentially copy ...
Definition: EsysException.cpp:56
EsysAssertException(const std::string &str)
Constructor for the exception.
Definition: EsysAssertException.h:63
#define ESYSUTILS_DLL_API
Definition: esysUtils/src/system_dep.h:31
static const std::string exceptionNameValue
Definition: EsysAssertException.h:113
EsysAssertException()
Default constructor for the exception.
Definition: EsysAssertException.h:49
EsysAssertException(const EsysAssertException &other)
Copy Constructor for the exception.
Definition: EsysAssertException.h:71
#define THROW(ARG)
Definition: esysUtils/src/system_dep.h:53
Definition: Esys_MPI.cpp:32
EsysAssertException & operator=(const EsysAssertException &other)
Definition: EsysAssertException.h:79
EsysAssertException(const char *cstr)
Constructor for the exception.
Definition: EsysAssertException.h:56
EsysException Parent
Definition: EsysAssertException.h:40
static void assertFailure(const std::string &assertion, const std::string &date, const std::string &file, int line, const std::string &errDesc)
Builds a formatted message and throws an EsysAssertException.
Definition: EsysAssertException.cpp:37