From 25d5e75363199413239e5c69dda2c41faca896ac Mon Sep 17 00:00:00 2001
From: Josh Morman <mormjb@gmail.com>
Date: Thu, 23 Apr 2020 10:57:01 -0400
Subject: trellis: add pybind11 bindings

---
 gr-trellis/python/trellis/bindings/fsm_python.cc | 113 +++++++++++++++++++++++
 1 file changed, 113 insertions(+)
 create mode 100644 gr-trellis/python/trellis/bindings/fsm_python.cc

(limited to 'gr-trellis/python/trellis/bindings/fsm_python.cc')

diff --git a/gr-trellis/python/trellis/bindings/fsm_python.cc b/gr-trellis/python/trellis/bindings/fsm_python.cc
new file mode 100644
index 0000000000..03f6d7b3ac
--- /dev/null
+++ b/gr-trellis/python/trellis/bindings/fsm_python.cc
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2020 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+/* This file is automatically generated using bindtool */
+
+#include <pybind11/complex.h>
+#include <pybind11/pybind11.h>
+#include <pybind11/stl.h>
+
+namespace py = pybind11;
+
+#include <gnuradio/trellis/fsm.h>
+// pydoc.h is automatically generated in the build directory
+#include <fsm_pydoc.h>
+
+void bind_fsm(py::module& m)
+{
+
+    using fsm = ::gr::trellis::fsm;
+
+
+    py::class_<fsm, std::shared_ptr<fsm>>(m, "fsm", D(fsm))
+
+        .def(py::init<>(), D(fsm, fsm, 0))
+        .def(py::init<gr::trellis::fsm const&>(), py::arg("FSM"), D(fsm, fsm, 1))
+        .def(py::init<int,
+                      int,
+                      int,
+                      std::vector<int, std::allocator<int>> const&,
+                      std::vector<int, std::allocator<int>> const&>(),
+             py::arg("I"),
+             py::arg("S"),
+             py::arg("O"),
+             py::arg("NS"),
+             py::arg("OS"),
+             D(fsm, fsm, 2))
+        .def(py::init<char const*>(), py::arg("name"), D(fsm, fsm, 3))
+        .def(py::init<int, int, std::vector<int, std::allocator<int>> const&>(),
+             py::arg("k"),
+             py::arg("n"),
+             py::arg("G"),
+             D(fsm, fsm, 4))
+        .def(py::init<int, int>(),
+             py::arg("mod_size"),
+             py::arg("ch_length"),
+             D(fsm, fsm, 5))
+        .def(py::init<int, int, int>(),
+             py::arg("P"),
+             py::arg("M"),
+             py::arg("L"),
+             D(fsm, fsm, 6))
+        .def(py::init<gr::trellis::fsm const&, gr::trellis::fsm const&>(),
+             py::arg("FSM1"),
+             py::arg("FSM2"),
+             D(fsm, fsm, 7))
+        .def(py::init<gr::trellis::fsm const&, gr::trellis::fsm const&, bool>(),
+             py::arg("FSMo"),
+             py::arg("FSMi"),
+             py::arg("serial"),
+             D(fsm, fsm, 8))
+        .def(py::init<gr::trellis::fsm const&, int>(),
+             py::arg("FSM"),
+             py::arg("n"),
+             D(fsm, fsm, 9))
+
+
+        .def("I", &fsm::I, D(fsm, I))
+
+
+        .def("S", &fsm::S, D(fsm, S))
+
+
+        .def("O", &fsm::O, D(fsm, O))
+
+
+        .def("NS", &fsm::NS, D(fsm, NS))
+
+
+        .def("OS", &fsm::OS, D(fsm, OS))
+
+
+        .def("PS", &fsm::PS, D(fsm, PS))
+
+
+        .def("PI", &fsm::PI, D(fsm, PI))
+
+
+        .def("TMi", &fsm::TMi, D(fsm, TMi))
+
+
+        .def("TMl", &fsm::TMl, D(fsm, TMl))
+
+
+        .def("write_trellis_svg",
+             &fsm::write_trellis_svg,
+             py::arg("filename"),
+             py::arg("number_stages"),
+             D(fsm, write_trellis_svg))
+
+
+        .def("write_fsm_txt",
+             &fsm::write_fsm_txt,
+             py::arg("filename"),
+             D(fsm, write_fsm_txt))
+
+        ;
+}
-- 
cgit v1.2.3