diff --git a/python/handwritten/noiseModel_python.cpp b/python/handwritten/noiseModel_python.cpp index 34ec8393f..5ed919dd4 100644 --- a/python/handwritten/noiseModel_python.cpp +++ b/python/handwritten/noiseModel_python.cpp @@ -24,17 +24,17 @@ #include -#include - #include using namespace boost::python; using namespace gtsam; using namespace gtsam::noiseModel; -// Wrap around pure virtual class Base +// Wrap around pure virtual class Base. +// All pure virtual methods should be wrapped. Non-pure may be wrapped if we want to mimic the +// overloading through inheritance in Python. // See: http://www.boost.org/doc/libs/1_59_0/libs/python/doc/tutorial/doc/html/python/exposing.html#python.class_virtual_functions -struct BaseWrap : Base, wrapper +struct BaseCallback : Base, wrapper { void print (const std::string & name="") const { this->get_override("print")(); @@ -67,18 +67,20 @@ struct BaseWrap : Base, wrapper this->get_override("WhitenSystem")(); } - // TODO(Ellon) Wrap non-pure virtual methods here. See: http://www.boost.org/doc/libs/1_59_0/libs/python/doc/tutorial/doc/html/python/exposing.html#python.virtual_functions_with_default_implementations + // TODO(Ellon): Wrap non-pure virtual methods should go here. + // See: http://www.boost.org/doc/libs/1_59_0/libs/python/doc/tutorial/doc/html/python/exposing.html#python.virtual_functions_with_default_implementations }; BOOST_PYTHON_MODULE(libnoiseModel_python) { -class_("Base") +class_("Base") .def("print", pure_virtual(&Base::print)) ; -class_, bases >("Gaussian", no_init) +// NOTE: We should use "Base" in "bases<...>", and not "BaseCallback" (it was not clear at the begining) +class_, bases >("Gaussian", no_init) .def("SqrtInformation",&Gaussian::SqrtInformation) .staticmethod("SqrtInformation") .def("Information",&Gaussian::Information)