Verified Commit 601790d0 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

python: remove JointModelVariant intermediates

parent 758c694a
// //
// Copyright (c) 2015-2020 CNRS INRIA // Copyright (c) 2015-2021 CNRS INRIA
// //
#ifndef __pinocchio_python_joint_hpp__ #ifndef __pinocchio_python_multibody_joint_joint_hpp__
#define __pinocchio_python_joint_hpp__ #define __pinocchio_python_multibody_joint_joint_hpp__
#include <boost/python.hpp> #include <boost/python.hpp>
...@@ -17,22 +17,20 @@ namespace pinocchio ...@@ -17,22 +17,20 @@ namespace pinocchio
namespace bp = boost::python; namespace bp = boost::python;
struct JointModelPythonVisitor struct JointModelPythonVisitor
: public boost::python::def_visitor< JointModelPythonVisitor > : public boost::python::def_visitor< JointModelPythonVisitor >
{ {
public:
template<class PyClass> template<class PyClass>
void visit(PyClass& cl) const void visit(PyClass& cl) const
{ {
cl cl
.def(bp::init<>()) .def(bp::init<>(bp::arg("self")))
// All are add_properties cause ReadOnly // All are add_properties cause ReadOnly
.add_property("id",&JointModelPythonVisitor::getId) .add_property("id",&getId)
.add_property("idx_q",&JointModelPythonVisitor::getIdx_q) .add_property("idx_q",&getIdx_q)
.add_property("idx_v",&JointModelPythonVisitor::getIdx_v) .add_property("idx_v",&getIdx_v)
.add_property("nq",&JointModelPythonVisitor::getNq) .add_property("nq",&getNq)
.add_property("nv",&JointModelPythonVisitor::getNv) .add_property("nv",&getNv)
.def("setIndexes",&JointModel::setIndexes) .def("setIndexes",&JointModel::setIndexes)
.def("shortname",&JointModel::shortname) .def("shortname",&JointModel::shortname)
; ;
...@@ -49,7 +47,7 @@ namespace pinocchio ...@@ -49,7 +47,7 @@ namespace pinocchio
bp::class_<JointModel>("JointModel", bp::class_<JointModel>("JointModel",
"Generic Joint Model", "Generic Joint Model",
bp::no_init) bp::no_init)
.def(bp::init<pinocchio::JointModelVariant>()) .def(bp::init<JointModel>(bp::args("self","other")))
.def(JointModelPythonVisitor()) .def(JointModelPythonVisitor())
.def(PrintableVisitor<JointModel>()) .def(PrintableVisitor<JointModel>())
; ;
...@@ -59,4 +57,4 @@ namespace pinocchio ...@@ -59,4 +57,4 @@ namespace pinocchio
}} // namespace pinocchio::python }} // namespace pinocchio::python
#endif // ifndef __pinocchio_python_joint_hpp__ #endif // ifndef __pinocchio_python_multibody_joint_joint_hpp__
// //
// Copyright (c) 2015-2020 CNRS INRIA // Copyright (c) 2015-2021 CNRS INRIA
// //
#ifndef __pinocchio_python_joints_variant_hpp__ #ifndef __pinocchio_python_joints_variant_hpp__
...@@ -45,7 +45,7 @@ namespace pinocchio ...@@ -45,7 +45,7 @@ namespace pinocchio
.def(JointDataDerivedPythonVisitor<T>()) .def(JointDataDerivedPythonVisitor<T>())
.def(PrintableVisitor<T>()) .def(PrintableVisitor<T>())
); );
bp::implicitly_convertible<T,pinocchio::JointDataVariant>(); bp::implicitly_convertible<T,pinocchio::JointData>();
} }
}; };
...@@ -61,7 +61,7 @@ namespace pinocchio ...@@ -61,7 +61,7 @@ namespace pinocchio
.def(JointModelDerivedPythonVisitor<T>()) .def(JointModelDerivedPythonVisitor<T>())
.def(PrintableVisitor<T>()) .def(PrintableVisitor<T>())
); );
bp::implicitly_convertible<T,pinocchio::JointModelVariant>(); bp::implicitly_convertible<T,pinocchio::JointModel>();
} }
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment