src/type_info.cpp
Go to the documentation of this file.
1 
5 #include <typeinfo>
6 #include <typeindex>
7 
8 #include <boost/python.hpp>
9 #include <boost/type_index.hpp>
10 
11 #include "eigenpy/registration.hpp"
12 
13 namespace bp = boost::python;
14 
15 namespace eigenpy {
16 
18  typedef std::type_index Self;
19  if (register_symbolic_link_to_registered_type<Self>()) return;
20 
21  bp::class_<Self>(
22  "std_type_index",
23  "The class type_index holds implementation-specific information about a "
24  "type, including the name of the type and means to compare two types for "
25  "equality or collating order.",
26  bp::no_init)
27  .def(bp::self == bp::self)
28  .def(bp::self >= bp::self)
29  .def(bp::self > bp::self)
30  .def(bp::self < bp::self)
31  .def(bp::self <= bp::self)
32  .def("hash_code", &Self::hash_code, bp::arg("self"),
33  "Returns an unspecified value (here denoted by hash code) such that "
34  "for all std::type_info objects referring to the same type, their "
35  "hash code is the same.")
36  .def("name", &Self::name, bp::arg("self"),
37  "Returns an implementation defined null-terminated character string "
38  "containing the name of the type. No guarantees are given; in "
39  "particular, the returned string can be identical for several types "
40  "and change between invocations of the same program.")
41  .def(
42  "pretty_name",
43  +[](const Self &value) -> std::string {
44  return boost::core::demangle(value.name());
45  },
46  bp::arg("self"), "Human readible name.");
47 }
48 
50  typedef boost::typeindex::type_index Self;
51  if (register_symbolic_link_to_registered_type<Self>()) return;
52 
53  bp::class_<Self>(
54  "boost_type_index",
55  "The class type_index holds implementation-specific information about a "
56  "type, including the name of the type and means to compare two types for "
57  "equality or collating order.",
58  bp::no_init)
59  .def(bp::self == bp::self)
60  .def(bp::self >= bp::self)
61  .def(bp::self > bp::self)
62  .def(bp::self < bp::self)
63  .def(bp::self <= bp::self)
64  .def("hash_code", &Self::hash_code, bp::arg("self"),
65  "Returns an unspecified value (here denoted by hash code) such that "
66  "for all std::type_info objects referring to the same type, their "
67  "hash code is the same.")
68  .def("name", &Self::name, bp::arg("self"),
69  "Returns an implementation defined null-terminated character string "
70  "containing the name of the type. No guarantees are given; in "
71  "particular, the returned string can be identical for several types "
72  "and change between invocations of the same program.")
73  .def("pretty_name", &Self::pretty_name, bp::arg("self"),
74  "Human readible name.");
75 }
76 
80 }
81 } // namespace eigenpy
eigenpy::exposeBoostTypeIndex
void exposeBoostTypeIndex()
Definition: src/type_info.cpp:49
boost::python
Definition: alignment.hpp:49
registration.hpp
eigenpy
Definition: alignment.hpp:14
eigenpy::exposeTypeInfo
void exposeTypeInfo()
Definition: src/type_info.cpp:77
eigenpy::exposeStdTypeIndex
void exposeStdTypeIndex()
Definition: src/type_info.cpp:17
test_matrix.value
float value
Definition: test_matrix.py:161
setup.name
name
Definition: setup.in.py:179


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 26 2025 02:17:29