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_TRANSLATOR_DWA2002810_HPP
6 # define EXCEPTION_TRANSLATOR_DWA2002810_HPP
7 
8 # include <boost/python/detail/prefix.hpp>
9 
10 # include <boost/bind.hpp>
11 # include <boost/bind/placeholders.hpp>
12 # include <boost/type.hpp>
13 # include <boost/python/detail/translate_exception.hpp>
14 # include <boost/python/detail/exception_handler.hpp>
15 
16 namespace boost { namespace python {
17 
18 template <class ExceptionType, class Translate>
register_exception_translator(Translate translate,boost::type<ExceptionType> * =0)19 void register_exception_translator(Translate translate, boost::type<ExceptionType>* = 0)
20 {
21     detail::register_exception_handler(
22         boost::bind<bool>(detail::translate_exception<ExceptionType,Translate>(), _1, _2, translate)
23         );
24 }
25 
26 }} // namespace boost::python
27 
28 #endif // EXCEPTION_TRANSLATOR_DWA2002810_HPP
29