eigenpy 3.12.0
Bindings between Numpy and Eigen using Boost.Python
Loading...
Searching...
No Matches
id.hpp
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
11namespace eigenpy {
12
17template <class C>
18struct 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__
Add the Python method id to retrieving a unique id for a given object exposed with Boost....
Definition id.hpp:18