std-aligned-vector.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2020 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_python_utils_std_aligned_vector_hpp__
6 #define __pinocchio_python_utils_std_aligned_vector_hpp__
7 
8 #include <boost/python.hpp>
9 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
10 #include <string>
11 
12 #include "pinocchio/container/aligned-vector.hpp"
13 
16 
17 namespace pinocchio
18 {
19  namespace python
20  {
21 
30  template<class T, bool NoProxy = false, bool EnableFromPythonListConverter = true>
32  : public ::boost::python::vector_indexing_suite<typename container::aligned_vector<T>,NoProxy>
33  , public StdContainerFromPythonList< container::aligned_vector<T> >
34  {
37 
38  static ::boost::python::class_<vector_type> expose(const std::string & class_name,
39  const std::string & doc_string = "")
40  {
41  namespace bp = boost::python;
42 
43  bp::class_<vector_type> cl(class_name.c_str(),doc_string.c_str());
44  cl
46  .def("tolist",&FromPythonListConverter::tolist,bp::arg("self"),
47  "Returns the aligned_vector as a Python list.")
48  .def_pickle(PickleVector<vector_type>());
49 
50  // Register conversion
51  if(EnableFromPythonListConverter)
53 
54  return cl;
55  }
56  };
57  } // namespace python
58 } // namespace pinocchio
59 
60 #endif // ifndef __pinocchio_python_utils_std_aligned_vector_hpp__
::boost::python::list tolist(vector_type &self)
Definition: std-vector.hpp:148
static ::boost::python::class_< vector_type > expose(const std::string &class_name, const std::string &doc_string="")
StdContainerFromPythonList< vector_type > FromPythonListConverter
Expose an container::aligned_vector from a type given as template argument.
Register the conversion from a Python list to a std::vector.
Definition: std-vector.hpp:91
Specialization of an std::vector with an aligned allocator. This specialization might be used when th...
Create a pickle interface for the std::vector and aligned vector.
Main pinocchio namespace.
Definition: timings.cpp:28
cl


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:32