1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef EXCEPTION_HANDLER_DWA2002810_HPP
6 # define EXCEPTION_HANDLER_DWA2002810_HPP
8 # include <boost/python/detail/config.hpp>
9 # include <boost/function/function0.hpp>
10 # include <boost/function/function2.hpp>
12 namespace boost { namespace python { namespace detail {
14 struct exception_handler;
16 typedef function2<bool, exception_handler const&, function0<void> const&> handler_function;
18 struct BOOST_PYTHON_DECL exception_handler
23 explicit exception_handler(handler_function const& impl);
25 inline bool handle(function0<void> const& f) const;
27 bool operator()(function0<void> const& f) const;
29 static exception_handler* chain;
32 static exception_handler* tail;
34 handler_function m_impl;
35 exception_handler* m_next;
39 inline bool exception_handler::handle(function0<void> const& f) const
41 return this->m_impl(*this, f);
44 BOOST_PYTHON_DECL void register_exception_handler(handler_function const& f);
46 }}} // namespace boost::python::detail
48 #endif // EXCEPTION_HANDLER_DWA2002810_HPP