-#include <boost/python.hpp>
#include "stl_container_adapter.hpp"
-using namespace boost::python;
+#include <boost/python.hpp>
void export_alphabet();
void export_annot();
void export_annotation_colors();
+void export_container_exceptions();
void export_conserved_path();
void export_flps();
void export_glsequence();
BOOST_PYTHON_MODULE(mussa)
{
- boost::python::register_exception_translator<IndexError>(&translate);
-
+ export_container_exceptions();
export_alphabet();
export_annot();
export_annotation_colors();
#include "stl_container_adapter.hpp"
-void translate(IndexError const& e)
+#include <boost/python/exception_translator.hpp>
+using namespace boost::python;
+
+void translate_index_error(IndexError const& e)
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
}
-void translate(KeyError const& e)
+void translate_key_error(KeyError const& e)
{
PyErr_SetString(PyExc_KeyError, "Key not found");
}
+void export_container_exceptions()
+{
+ boost::python::register_exception_translator<IndexError>(
+ &translate_index_error
+ );
+
+ boost::python::register_exception_translator<KeyError>(
+ &translate_key_error
+ );
+}
struct IndexError : std::exception
{
-public:
explicit IndexError(): std::exception() {};
};
-void translate(IndexError const &e);
+void translate_index_error(IndexError const &e);
template<typename T>
explicit KeyError(): std::exception() {};
};
-void translate(KeyError const &e);
+void translate_key_error(KeyError const &e);
template<typename T>
struct map_item