Skip to content

Commit

Permalink
[feat] add GMultiCdontionPy.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Jan 29, 2025
1 parent 7ecbf2d commit 109f57c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
13 changes: 13 additions & 0 deletions python/pyCGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ PYBIND11_MODULE(pyCGraph, m) {
.def("getInfo", &CStatus::getInfo)
.def("isOK", &CStatus::isOK);

py::enum_<GMultiConditionType>(m, "GMultiConditionType")
.value("SERIAL", GMultiConditionType::SERIAL)
.value("PARALLEL", GMultiConditionType::PARALLEL)
.export_values();

py::class_<GPipelinePy, std::unique_ptr<GPipelinePy, py::nodelete> >(m, "GPipeline")
.def(py::init<>())
.def("init", &GPipelinePy::init)
Expand Down Expand Up @@ -49,4 +54,12 @@ PYBIND11_MODULE(pyCGraph, m) {
.def(py::init<>())
.def("addGElement", &GConditionPyw::addGElement,
py::arg("element"));

py::class_<GMultiConditionPy<CGraph::GMultiConditionType::SERIAL>, GElement>(m, "GSerialMultiCondition")
.def(py::init<>())
.def("addGElement", &GMultiConditionPy<CGraph::GMultiConditionType::SERIAL>::addGElement);

py::class_<GMultiConditionPy<CGraph::GMultiConditionType::PARALLEL>, GElement>(m, "GParallelMultiCondition")
.def(py::init<>())
.def("addGElement", &GMultiConditionPy<CGraph::GMultiConditionType::PARALLEL>::addGElement);
}
17 changes: 17 additions & 0 deletions python/wrapper/GMultiConditionPy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef CGRAPH_GMULTICONDITION_PY_H
#define CGRAPH_GMULTICONDITION_PY_H

#include "CGraph.h"

template<CGraph::GMultiConditionType type>
class GMultiConditionPy : public CGraph::GMultiCondition<type> {
public:
explicit GMultiConditionPy() : CGraph::GMultiCondition<type>() {};
~GMultiConditionPy() override {};

CStatus addGElement(CGraph::GElementPtr element) {
return CGraph::GMultiCondition<type>::addElement(element);
}
};

#endif // CGRAPH_GMULTICONDITION_PY_H
1 change: 1 addition & 0 deletions python/wrapper/PyWrapperInclude.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
#include "GNodePyw.h"
#include "GRegionPy.h"
#include "GConditionPyw.h"
#include "GMulticonditionPy.h"

#endif // CGRAPH_PYWRAPPER_INCLUDE_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
@Desc:
***************************/


#ifndef CGRAPH_GCONDITIONDEFINE_H
#define CGRAPH_GCONDITIONDEFINE_H

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ CGRAPH_NAMESPACE_BEGIN

template<GMultiConditionType type>
class GMultiCondition : public GCondition {
private:
protected:
explicit GMultiCondition();

private:
CStatus run() final;

/**
Expand Down

0 comments on commit 109f57c

Please sign in to comment.