joints-variant.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2021 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_python_joints_variant_hpp__
6 #define __pinocchio_python_joints_variant_hpp__
7 
8 #include <boost/python.hpp>
9 
10 #include "pinocchio/multibody/joint/joint-collection.hpp"
14 
15 namespace pinocchio
16 {
17  namespace python
18  {
19  namespace bp = boost::python;
20 
21  template<typename VariantType>
22  struct JointVariantVisitor : boost::static_visitor<PyObject *>
23  {
24  static result_type convert(VariantType const & jv)
25  {
26  return apply_visitor(JointVariantVisitor<VariantType>(), jv);
27  }
28 
29  template<typename T>
30  result_type operator()(T const & t) const
31  {
32  return boost::python::incref(boost::python::object(t).ptr());
33  }
34  };
35 
37  {
38  template<class T>
39  void operator()(T)
40  {
41  expose_joint_data<T>(
42  bp::class_<T>(T::classname().c_str(),
43  T::classname().c_str(),
44  bp::init<>())
46  .def(PrintableVisitor<T>())
47  );
48  bp::implicitly_convertible<T,pinocchio::JointData>();
49  }
50  };
51 
53  {
54  template<class T>
55  void operator()(T)
56  {
57  expose_joint_model<T>(
58  bp::class_<T>(T::classname().c_str(),
59  T::classname().c_str(),
60  bp::no_init)
62  .def(PrintableVisitor<T>())
63  );
64  bp::implicitly_convertible<T,pinocchio::JointModel>();
65  }
66  };
67 
68 
69  } // namespace python
70 } // namespace pinocchio
71 
72 #endif // ifndef __pinocchio_python_joints_variant_hpp__
static result_type convert(VariantType const &jv)
Set the Python method str and repr to use the overloading operator<<.
Definition: printable.hpp:21
result_type operator()(T const &t) const
Main pinocchio namespace.
Definition: timings.cpp:30


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:04