23 #include <boost/python.hpp>
24 #include <eigenpy/eigenpy.hpp>
25 #include <hpp/util/pointer.hh>
28 #define INIT_PYHPP_MODULE \
29 boost::python::docstring_options local_docstring_options(true, true, false)
31 #define PYHPP_DEFINE_METHOD(CLASS, METHOD) def(#METHOD, &CLASS::METHOD)
32 #define PYHPP_DEFINE_METHOD1(CLASS, METHOD, ARG1) \
33 def(#METHOD, &CLASS::METHOD, ARG1)
34 #define PYHPP_DEFINE_METHOD2(CLASS, METHOD, ARG1, ARG2) \
35 def(#METHOD, &CLASS::METHOD, ARG1, ARG2)
36 #define PYHPP_DEFINE_METHOD_INTERNAL_REF(CLASS, METHOD) \
37 def(#METHOD, &CLASS::METHOD, return_internal_reference<>())
38 #define PYHPP_DEFINE_GETTER_SETTER(CLASS, METHOD, TYPE) \
39 def(#METHOD, static_cast<TYPE (CLASS::*)() const>(&CLASS::METHOD)) \
40 .def(#METHOD, static_cast<void (CLASS::*)(TYPE)>(&CLASS::METHOD))
41 #define PYHPP_DEFINE_GETTER_SETTER_INTERNAL_REF(CLASS, METHOD, TYPE) \
42 def(#METHOD, static_cast<TYPE (CLASS::*)() const>(&CLASS::METHOD), \
43 return_internal_reference<>()) \
44 .def(#METHOD, static_cast<void (CLASS::*)(TYPE)>(&CLASS::METHOD))
47 template <
typename ObjectWithPr
intMethod>
48 std::string
to_str(
const ObjectWithPrintMethod& obj) {
49 std::ostringstream oss;
53 template <
typename ObjectWithPr
intMethod>
55 std::ostringstream oss;
60 template <
typename T,
typename _Vector = std::vector<hpp::shared_ptr<T> > >
64 if (i > v.size())
throw std::invalid_argument(
"Out of range");
65 if (!v[i])
throw std::runtime_error(
"Null pointer");
std::string to_str(const ObjectWithPrintMethod &obj)
Definition: util.hh:48
std::string to_str_from_operator(const ObjectWithPrintMethod &obj)
Definition: util.hh:54
_Vector Vector
Definition: util.hh:62
static T & get_item(Vector &v, std::size_t i)
Definition: util.hh:63