Skip to content

Commit

Permalink
Add python bindings for Split algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelS239 authored and chernishev committed May 4, 2024
1 parent 16f8fac commit 97957fd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/python_bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "bind_main_classes.h"
#include "cfd/bind_cfd.h"
#include "data/bind_data_types.h"
#include "dd/bind_split.h"
#include "fd/bind_fd.h"
#include "fd/bind_fd_verification.h"
#include "gfd/bind_gfd_verification.h"
Expand Down Expand Up @@ -35,7 +36,7 @@ PYBIND11_MODULE(desbordante, module) {

for (auto bind_func : {BindMainClasses, BindDataTypes, BindFd, BindCfd, BindAr, BindUcc, BindAc,
BindOd, BindFdVerification, BindMfdVerification, BindUccVerification,
BindStatistics, BindInd, BindGfdVerification}) {
BindStatistics, BindInd, BindGfdVerification, BindSplit}) {
bind_func(module);
}
}
Expand Down
25 changes: 25 additions & 0 deletions src/python_bindings/dd/bind_split.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "bind_split.h"

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "algorithms/dd/dd.h"
#include "algorithms/dd/mining_algorithms.h"
#include "py_util/bind_primitive.h"

namespace {
namespace py = pybind11;
} // namespace

namespace python_bindings {
void BindSplit(py::module_& main_module) {
using namespace algos;

auto dd_module = main_module.def_submodule("dd");
py::class_<model::DDString>(dd_module, "DD")
.def("__str__", &model::DDString::ToString)
.def("__repr__", &model::DDString::ToString);

BindPrimitiveNoBase<dd::Split>(dd_module, "Split").def("get_dds", &dd::Split::GetDDStringList);
}
} // namespace python_bindings
7 changes: 7 additions & 0 deletions src/python_bindings/dd/bind_split.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <pybind11/pybind11.h>

namespace python_bindings {
void BindSplit(pybind11::module_& main_module);
} // namespace python_bindings

0 comments on commit 97957fd

Please sign in to comment.