comparable.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 INRIA
3 //
4 
5 #ifndef __pinocchio_python_utils_comparable_hpp__
6 #define __pinocchio_python_utils_comparable_hpp__
7 
8 #include <boost/python.hpp>
9 
10 namespace pinocchio
11 {
12  namespace python
13  {
14 
15  namespace bp = boost::python;
16 
20  template<class C, bool has_comparison_operators = true>
22  : public bp::def_visitor<ComparableVisitor<C, has_comparison_operators>>
23  {
24  template<class PyClass>
25  void visit(PyClass & cl) const
26  {
27  cl.def(bp::self == bp::self).def(bp::self != bp::self);
28  }
29  };
30 
31  template<class C>
32  struct ComparableVisitor<C, false> : public bp::def_visitor<ComparableVisitor<C, false>>
33  {
34  template<class PyClass>
35  void visit(PyClass &) const
36  {
37  }
38  };
39  } // namespace python
40 } // namespace pinocchio
41 
42 #endif // ifndef __pinocchio_python_utils_comparable_hpp__
boost::python
pinocchio::python::ComparableVisitor< C, false >::visit
void visit(PyClass &) const
Definition: comparable.hpp:35
pinocchio::python::ComparableVisitor
Add the Python method == and != to allow a comparison of this.
Definition: comparable.hpp:21
dcrba.C
C
Definition: dcrba.py:469
python
cl
cl
pinocchio::python::ComparableVisitor::visit
void visit(PyClass &cl) const
Definition: comparable.hpp:25
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Tue Jun 25 2024 02:42:36