pinocchio  3.7.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
 
Loading...
Searching...
No Matches
copyable.hpp
1//
2// Copyright (c) 2016-2023 CNRS INRIA
3//
4
5#ifndef __pinocchio_python_utils_copyable_hpp__
6#define __pinocchio_python_utils_copyable_hpp__
7
8#include <eigenpy/eigenpy.hpp>
9
10namespace pinocchio
11{
12 namespace python
13 {
14
15 namespace bp = boost::python;
16
20 template<class C>
21 struct CopyableVisitor : public bp::def_visitor<CopyableVisitor<C>>
22 {
23 template<class PyClass>
24 void visit(PyClass & cl) const
25 {
26 cl.def("copy", &copy, bp::arg("self"), "Returns a copy of *this.");
27 cl.def("__copy__", &copy, bp::arg("self"), "Returns a copy of *this.");
28 cl.def(
29 "__deepcopy__", &deepcopy, bp::args("self", "memo"), "Returns a deep copy of *this.");
30 }
31
32 private:
33 static C copy(const C & self)
34 {
35 return C(self);
36 }
37 static C deepcopy(const C & self, bp::dict)
38 {
39 return C(self);
40 }
41 };
42 } // namespace python
43} // namespace pinocchio
44
45#endif // ifndef __pinocchio_python_utils_copyable_hpp__
Main pinocchio namespace.
Definition treeview.dox:11
void copy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &origin, DataTpl< Scalar, Options, JointCollectionTpl > &dest, KinematicLevel kinematic_level)
Copy part of the data from origin to dest. Template parameter can be used to select at which differen...
Definition copy.hpp:42