Added DTRException translator to python world
This commit is contained in:
parent
306c391a11
commit
4d1e23eaea
|
@ -3,8 +3,13 @@ using namespace boost::python;
|
|||
|
||||
#include "io/dtr/Techno.h"
|
||||
#include "io/dtr/Rules.h"
|
||||
#include "io/dtr/DTRException.h"
|
||||
|
||||
namespace DTR {
|
||||
void translator(DTRException const& e) {
|
||||
PyErr_SetString(PyExc_UserWarning, e.what());
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE(pyDTR) {
|
||||
// class DTR::Name
|
||||
class_<Name>("Name", init<std::string>())
|
||||
|
@ -39,5 +44,9 @@ BOOST_PYTHON_MODULE(pyDTR) {
|
|||
.def("getValue" , static_cast<double(Techno::*)(Name, Name )>(&Techno::getValue))
|
||||
.def("getValue" , static_cast<double(Techno::*)(Name, Name, Name)>(&Techno::getValue))
|
||||
;
|
||||
|
||||
// DTRException translator
|
||||
register_exception_translator<DTRException>(translator)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue