|
| 1 | +#include "VersionBindings.hpp" |
| 2 | + |
| 3 | +// depthai |
| 4 | +#include "depthai/device/Version.hpp" |
| 5 | + |
| 6 | +void VersionBindings::bind(pybind11::module& m, void* pCallstack){ |
| 7 | + |
| 8 | + using namespace dai; |
| 9 | + |
| 10 | + // Type definitions |
| 11 | + py::class_<Version> version(m, "Version", DOC(dai, Version)); |
| 12 | + |
| 13 | + /////////////////////////////////////////////////////////////////////// |
| 14 | + /////////////////////////////////////////////////////////////////////// |
| 15 | + /////////////////////////////////////////////////////////////////////// |
| 16 | + // Call the rest of the type defines, then perform the actual bindings |
| 17 | + Callstack* callstack = (Callstack*) pCallstack; |
| 18 | + auto cb = callstack->top(); |
| 19 | + callstack->pop(); |
| 20 | + cb(m, pCallstack); |
| 21 | + /////////////////////////////////////////////////////////////////////// |
| 22 | + /////////////////////////////////////////////////////////////////////// |
| 23 | + /////////////////////////////////////////////////////////////////////// |
| 24 | + |
| 25 | + // Bind DeviceBootloader |
| 26 | + version |
| 27 | + .def(py::init<const std::string&>(), py::arg("v"), DOC(dai, Version, Version)) |
| 28 | + .def(py::init<unsigned, unsigned, unsigned>(), py::arg("major"), py::arg("minor"), py::arg("patch"), DOC(dai, Version, Version, 2)) |
| 29 | + .def("__str__", &Version::toString, DOC(dai, Version, toString)) |
| 30 | + .def("__eq__", &Version::operator==) |
| 31 | + .def("__lt__", &Version::operator<) |
| 32 | + .def("__gt__", &Version::operator>) |
| 33 | + .def("toStringSemver", &Version::toStringSemver, DOC(dai, Version, toStringSemver)) |
| 34 | + .def("getBuildInfo", &Version::getBuildInfo, DOC(dai, Version, getBuildInfo)) |
| 35 | + .def("getSemver", &Version::getSemver, DOC(dai, Version, getSemver)) |
| 36 | + ; |
| 37 | + |
| 38 | +} |
0 commit comments