5#ifndef DUNE_EXCEPTIONS_HH
6#define DUNE_EXCEPTIONS_HH
95 void message(
const std::string &msg);
96 const std::string&
what()
const;
100 std::string _message;
172 virtual void operator () () = 0;
179 inline Exception::Exception ()
182 if (_hook != 0) _hook->operator()();
207 return stream << e.
what();
214#define THROWSPEC(E) # E << " [" << __func__ << ":" << __FILE__ << ":" << __LINE__ << "]: "
244#define DUNE_THROW(E, m) do { E th__ex; std::ostringstream th__out; \
245 th__out << THROWSPEC(E) << m; th__ex.message(th__out.str()); throw th__ex; \
Base class for Dune-Exceptions.
Definition: exceptions.hh:92
Default exception class for I/O errors.
Definition: exceptions.hh:257
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:307
Default exception class for mathematical errors.
Definition: exceptions.hh:267
Default exception for dummy implementations.
Definition: exceptions.hh:289
Default exception if memory allocation fails.
Definition: exceptions.hh:302
Default exception if an error in the parallel communication of the programm occured.
Definition: exceptions.hh:313
Default exception class for range errors.
Definition: exceptions.hh:280
Default exception class for OS errors.
Definition: exceptions.hh:297
std::ostream & operator<<(std::ostream &s, const array< T, N > &e)
Output operator for array.
Definition: array.hh:159
static void registerHook(ExceptionHook *hook)
add a functor which is called before a Dune::Exception is emitted (see Dune::ExceptionHook)
Definition: exceptions.hh:185
static void clearHook()
remove all hooks
Definition: exceptions.hh:190
const std::string & what() const
output internal message buffer
Definition: exceptions.hh:200
void message(const std::string &msg)
store string in internal message buffer
Definition: exceptions.hh:195
Dune namespace.
Definition: alignment.hh:14
Base class to add a hook to the Dune::Exception.
Definition: exceptions.hh:170