diff --git a/python_binding/graphRegex/pybind_GraphRegex.cpp b/python_binding/graphRegex/pybind_GraphRegex.cpp index be3cd9e9124ba1306226dcbdc13ee39748cf0606..921f204d017f90823b9c4a1a024efa271a4691e5 100644 --- a/python_binding/graphRegex/pybind_GraphRegex.cpp +++ b/python_binding/graphRegex/pybind_GraphRegex.cpp @@ -10,6 +10,7 @@ ********************************************************************************/ #include <pybind11/pybind11.h> +#include <pybind11/functional.h> #include "aidge/graphRegex/GraphRegex.hpp" namespace py = pybind11; @@ -20,7 +21,7 @@ void init_GraphRegex(py::module& m){ py::class_<GraphRegex, std::shared_ptr<GraphRegex>>(m, "GraphRegex", "GraphRegex class describes a regex to test a graph.") .def(py::init<>()) - .def("add_query", &GraphRegex::addQuery, R"mydelimiter( + .def("add_query", &GraphRegex::addQuery, py::arg("query"), py::arg("f") = nullptr, R"mydelimiter( :rtype: str )mydelimiter") @@ -47,10 +48,10 @@ void init_GraphRegex(py::module& m){ Add a node test :param key: the key of the node test to use in the query. :param conditionalExpressions: the test to do . - + )mydelimiter") - + .def("set_node_key", (void (GraphRegex::*)(const std::string, std::function<bool(NodePtr)>)) & GraphRegex::setNodeKey, @@ -59,7 +60,7 @@ void init_GraphRegex(py::module& m){ Add a node test :param key: the key of the lambda test to use in the conditional expressions. :param f: bool lambda (nodePtr) . - + )mydelimiter") diff --git a/python_binding/graphRegex/pybind_MatchSolution.cpp b/python_binding/graphRegex/pybind_MatchSolution.cpp new file mode 100644 index 0000000000000000000000000000000000000000..81d39f86ed6da5b7b63a2d43b3a4fcbb2f8e9043 --- /dev/null +++ b/python_binding/graphRegex/pybind_MatchSolution.cpp @@ -0,0 +1,40 @@ +/******************************************************************************** + * Copyright (c) 2023 CEA-List + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + ********************************************************************************/ + +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> +#include "aidge/graphRegex/matchFsm/MatchResult.hpp" + +namespace py = pybind11; +namespace Aidge { +void init_MatchSolution(py::module& m){ + + + py::class_<MatchSolution, std::shared_ptr<MatchSolution>>(m, "MatchSolution", "MatchSolution class contains the result of one match and the associated key, the query and the start node.") + .def("at", &MatchSolution::at, py::arg("key"), + R"mydelimiter( + :rtype: str + )mydelimiter") + + .def("get_all", &MatchSolution::getAll, + R"mydelimiter( + )mydelimiter") + + .def("get_query", &MatchSolution::getQuery, + R"mydelimiter( + )mydelimiter") + + .def("get_start_node", &MatchSolution::getStartNode, + R"mydelimiter( + )mydelimiter") + ; +} +} // namespace Aidge diff --git a/python_binding/pybind_core.cpp b/python_binding/pybind_core.cpp index 0353953fda39cd6dc283d20a0a3e36659dd891a4..be0d357b7f73e26aad44994f407696f70617ad71 100644 --- a/python_binding/pybind_core.cpp +++ b/python_binding/pybind_core.cpp @@ -56,6 +56,7 @@ void init_OpArgs(py::module&); void init_Connector(py::module&); void init_GraphRegex(py::module&); +void init_MatchSolution(py::module&); void init_Recipies(py::module&); @@ -106,7 +107,9 @@ void init_Aidge(py::module& m){ init_Identity(m); init_Producer(m); + init_GraphRegex(m); + init_MatchSolution(m); init_Recipies(m); init_Scheduler(m);