py_typedefs.cpp 896 B

12345678910111213141516171819
  1. py::class_<RotationList>(m, "RotationList")
  2. .def(py::init<>())
  3. .def(py::init<size_t>())
  4. .def("pop_back", &RotationList::pop_back)
  5. /* There are multiple versions of push_back(), etc. Select the right ones. */
  6. .def("append", (void (RotationList::*)(const Eigen::Quaterniond &)) &RotationList::push_back)
  7. .def("back", (Eigen::Quaterniond &(RotationList::*)()) &RotationList::back)
  8. .def("__len__", [](const RotationList &v) { return v.size(); })
  9. .def("__getitem__", [](const RotationList &v, int b) { return v.at(b); })
  10. .def("__setitem__", [](RotationList &v, int b, Eigen::Quaterniond &c) { return v.at(b) = c; })
  11. .def("__iter__", [](RotationList &v) {
  12. return py::make_iterator(v.begin(), v.end());
  13. }, py::keep_alive<0, 1>());
  14. py::bind_vector<std::vector<int>>(m, "VectorInt");
  15. py::bind_vector<std::vector<std::vector<int>>>(m, "VectorVectorInt");