id.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2024 INRIA
3 //
4 
5 #ifndef __eigenpy_id_hpp__
6 #define __eigenpy_id_hpp__
7 
8 #include <boost/python.hpp>
9 #include <boost/cstdint.hpp>
10 
11 namespace eigenpy {
12 
17 template <class C>
18 struct IdVisitor : public bp::def_visitor<IdVisitor<C> > {
19  template <class PyClass>
20  void visit(PyClass& cl) const {
21  cl.def("id", &id, bp::arg("self"),
22  "Returns the unique identity of an object.\n"
23  "For object held in C++, it corresponds to its memory address.");
24  }
25 
26  private:
27  static boost::int64_t id(const C& self) {
28  return boost::int64_t(reinterpret_cast<const void*>(&self));
29  }
30 };
31 } // namespace eigenpy
32 
33 #endif // ifndef __eigenpy_id_hpp__
eigenpy::IdVisitor::visit
void visit(PyClass &cl) const
Definition: id.hpp:20
eigenpy::IdVisitor::id
static boost::int64_t id(const C &self)
Definition: id.hpp:27
eigenpy
Definition: alignment.hpp:14
eigenpy::IdVisitor
Add the Python method id to retrieving a unique id for a given object exposed with Boost....
Definition: id.hpp:18
test_matrix.int64_t
int64_t
Definition: test_matrix.py:204


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Nov 2 2024 02:14:45