#include #include #include namespace moveit { namespace python { void export_properties(); namespace properties { /** Extension for boost::python::class_ to allow convienient definition of properties * * New method add_property(const char* name) adds a property getter. */ template < class W // class being wrapped , class X1 = ::boost::python::detail::not_specified , class X2 = ::boost::python::detail::not_specified , class X3 = ::boost::python::detail::not_specified > class class_ : public boost::python::class_ { public: typedef class_ self; // forward all constructors using boost::python::class_::class_; template self& add_property(const char* name, const char* docstr = 0) { auto getter = [name](const W& me) { const moveit::task_constructor::PropertyMap& props = me.properties(); return props.get(name); }; boost::python::class_::add_property (name, boost::python::make_function (getter, boost::python::default_call_policies(), boost::mpl::vector()), docstr); return *this; } }; } } }