Skip to content
Snippets Groups Projects
Commit 8b733156 authored by Christian Engwer's avatar Christian Engwer Committed by Christoph Grüninger
Browse files

[lib] move implementation of expctions to the lib

parent c4b1b118
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,38 @@
#include <dune/common/exceptions.hh>
namespace Dune {
// static member of Dune::Exception
/*
static member of Dune::Exception
*/
ExceptionHook * Exception::_hook = 0;
/*
Implementation of Dune::Exception
*/
Exception::Exception ()
{
// call the hook if necessary
if (_hook != 0) _hook->operator()();
}
void Exception::registerHook (ExceptionHook * hook)
{
_hook = hook;
}
void Exception::clearHook ()
{
_hook = 0;
}
void Exception::message(const std::string & msg)
{
_message = msg;
}
const char* Exception::what() const noexcept
{
return _message.data();
}
}
......@@ -174,36 +174,6 @@ namespace Dune {
virtual void operator () () = 0;
};
/*
Implementation of Dune::Exception
*/
inline Exception::Exception ()
{
// call the hook if necessary
if (_hook != 0) _hook->operator()();
}
inline void Exception::registerHook (ExceptionHook * hook)
{
_hook = hook;
}
inline void Exception::clearHook ()
{
_hook = 0;
}
inline void Exception::message(const std::string & msg)
{
_message = msg;
}
const char* Exception::what() const noexcept
{
return _message.data();
}
inline std::ostream& operator<<(std::ostream &stream, const Exception &e)
{
return stream << e.what();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment