enum_pybind.cpp
Go to the documentation of this file.
1 
2 
3 #include <pybind11/eigen.h>
4 #include <pybind11/stl_bind.h>
5 #include <pybind11/pybind11.h>
6 #include <pybind11/operators.h>
7 #include "gtsam/nonlinear/utilities.h" // for RedirectCout.
8 
9 
10 #include "wrap/serialization.h"
11 #include <boost/serialization/export.hpp>
12 
13 
14 
15 
16 
17 using namespace std;
18 
19 namespace py = pybind11;
20 
21 PYBIND11_MODULE(enum_py, m_) {
22  m_.doc() = "pybind11 wrapper of enum_py";
23 
24  py::enum_<Color>(m_, "Color", py::arithmetic())
25  .value("Red", Color::Red)
26  .value("Green", Color::Green)
27  .value("Blue", Color::Blue);
28 
29 
30  py::class_<Pet, std::shared_ptr<Pet>> pet(m_, "Pet");
31  pet
32  .def(py::init<const string&, Kind>(), py::arg("name"), py::arg("type"))
33  .def_readwrite("name", &Pet::name)
34  .def_readwrite("type", &Pet::type);
35 
36  py::enum_<Pet::Kind>(pet, "Kind", py::arithmetic())
37  .value("Dog", Pet::Kind::Dog)
38  .value("Cat", Pet::Kind::Cat);
39 
40  pybind11::module m_gtsam = m_.def_submodule("gtsam", "gtsam submodule");
41  py::enum_<gtsam::VerbosityLM>(m_gtsam, "VerbosityLM", py::arithmetic())
42  .value("SILENT", gtsam::VerbosityLM::SILENT)
43  .value("SUMMARY", gtsam::VerbosityLM::SUMMARY)
44  .value("TERMINATION", gtsam::VerbosityLM::TERMINATION)
45  .value("LAMBDA", gtsam::VerbosityLM::LAMBDA)
46  .value("TRYLAMBDA", gtsam::VerbosityLM::TRYLAMBDA)
47  .value("TRYCONFIG", gtsam::VerbosityLM::TRYCONFIG)
48  .value("DAMPED", gtsam::VerbosityLM::DAMPED)
49  .value("TRYDELTA", gtsam::VerbosityLM::TRYDELTA);
50 
51 
52  py::class_<gtsam::MCU, std::shared_ptr<gtsam::MCU>> mcu(m_gtsam, "MCU");
53  mcu
54  .def(py::init<>());
55 
56  py::enum_<gtsam::MCU::Avengers>(mcu, "Avengers", py::arithmetic())
57  .value("CaptainAmerica", gtsam::MCU::Avengers::CaptainAmerica)
58  .value("IronMan", gtsam::MCU::Avengers::IronMan)
59  .value("Hulk", gtsam::MCU::Avengers::Hulk)
60  .value("Hawkeye", gtsam::MCU::Avengers::Hawkeye)
61  .value("Thor", gtsam::MCU::Avengers::Thor);
62 
63 
64  py::enum_<gtsam::MCU::GotG>(mcu, "GotG", py::arithmetic())
65  .value("Starlord", gtsam::MCU::GotG::Starlord)
66  .value("Gamorra", gtsam::MCU::GotG::Gamorra)
67  .value("Rocket", gtsam::MCU::GotG::Rocket)
68  .value("Drax", gtsam::MCU::GotG::Drax)
69  .value("Groot", gtsam::MCU::GotG::Groot);
70 
71 
72 
73 #include "python/specializations.h"
74 
75 }
76 
module_ module
Definition: pybind11.h:943
module_ def_submodule(const char *name, const char *doc=nullptr)
Definition: pybind11.h:903
Definition: Half.h:150
PYBIND11_MODULE(enum_py, m_)
Definition: enum_pybind.cpp:21
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:02