GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [bugfix] fix python version GGroup no isHold and so on function bug · feiyunwill/CGraph@778e4cd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • python
    • PyCGraph.cpp
    • tutorial/MyGNode
      • MyHoldNode.py
    • wrapper
      • PyGCluster.h
      • PyGRegion.h
      • PyWrapperDefine.h
      • PyWrapperInclude.h
      • PywGCluster.h
      • PywGCondition.h
      • PywGNode.h
      • PywGRegion.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎python/PyCGraph.cpp‎

Copy file name to clipboardExpand all lines: python/PyCGraph.cpp
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,21 +286,23 @@ PYBIND11_MODULE(PyCGraph, m) {
286286
py::arg("name") = CGRAPH_EMPTY,
287287
py::arg("loop") = CGRAPH_DEFAULT_LOOP_TIMES);
288288

289-
py::class_<PyGCluster, GElement, std::unique_ptr<PyGCluster, py::nodelete> >(m, "GCluster")
289+
py::class_<PywGCluster, GElement, std::unique_ptr<PywGCluster, py::nodelete> >(m, "GCluster")
290290
.def(py::init<const GElementPtrArr&>(),
291291
py::arg("elements") = GElementPtrArr{},
292292
py::keep_alive<1, 2>())
293-
.def("addGElements", &PyGCluster::__addGElements_4py,
293+
.def("addGElements", &PywGCluster::__addGElements_4py,
294294
py::arg("elements"),
295295
py::keep_alive<1, 2>());
296+
PYCGRAPH_DECLARE_GGROUP_PYBIND11_FUNCTIONS(GClusterInterface);
296297

297-
py::class_<PyGRegion, GElement, std::unique_ptr<PyGRegion, py::nodelete> >(m, "GRegion")
298+
py::class_<PywGRegion, GElement, std::unique_ptr<PywGRegion, py::nodelete> >(m, "GRegion")
298299
.def(py::init<const GElementPtrArr&>(),
299300
py::arg("elements") = GElementPtrArr{},
300301
py::keep_alive<1, 2>())
301-
.def("addGElements", &PyGRegion::__addGElements_4py,
302+
.def("addGElements", &PywGRegion::__addGElements_4py,
302303
py::arg("elements"),
303304
py::keep_alive<1, 2>());
305+
PYCGRAPH_DECLARE_GGROUP_PYBIND11_FUNCTIONS(GRegionInterface);
304306

305307
py::class_<PywGCondition, GElement, std::unique_ptr<PywGCondition, py::nodelete> >(m, "GCondition")
306308
.def(py::init<const GElementPtrArr&>(),
@@ -310,6 +312,7 @@ PYBIND11_MODULE(PyCGraph, m) {
310312
.def("addGElements", &PywGCondition::__addGElements_4py,
311313
py::arg("elements"),
312314
py::keep_alive<1, 2>());
315+
PYCGRAPH_DECLARE_GGROUP_PYBIND11_FUNCTIONS(GConditionInterface);
313316

314317
py::class_<PyGMultiCondition<GMultiConditionType::SERIAL>,
315318
GElement, std::unique_ptr<PyGMultiCondition<GMultiConditionType::SERIAL>,
Collapse file

‎python/tutorial/MyGNode/MyHoldNode.py‎

Copy file name to clipboardExpand all lines: python/tutorial/MyGNode/MyHoldNode.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def run(self):
2424
def isHold(self):
2525
param: MyParam = self.getGParam(self._param_key)
2626
print('enter hold path, value is {0}'.format(param.value))
27-
return param.value < 5
27+
return param.value < 3
Collapse file

‎python/wrapper/PyGCluster.h‎

Copy file name to clipboardExpand all lines: python/wrapper/PyGCluster.h
-23Lines changed: 0 additions & 23 deletions
This file was deleted.
Collapse file

‎python/wrapper/PyGRegion.h‎

Copy file name to clipboardExpand all lines: python/wrapper/PyGRegion.h
-23Lines changed: 0 additions & 23 deletions
This file was deleted.
Collapse file

‎python/wrapper/PyWrapperDefine.h‎

Copy file name to clipboard
+57Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/***************************
2+
@Author: Chunel
3+
@Contact: [email protected]
4+
@File: PyWrapperDefine.h
5+
@Time: 2025/4/6 14:48
6+
@Desc:
7+
***************************/
8+
9+
#ifndef CGRAPH_PYWRAPPERDEFINE_H
10+
#define CGRAPH_PYWRAPPERDEFINE_H
11+
12+
#include <pybind11/pybind11.h>
13+
14+
#include "CGraph.h"
15+
16+
#define PYCGRAPH_DECLARE_GELEMENT_COMMON_FUNCTIONS(PCGE) \
17+
CBool isHold() override { \
18+
PYBIND11_OVERLOAD(CBool, PCGE, isHold); \
19+
} \
20+
\
21+
CBool isMatch() override { \
22+
PYBIND11_OVERLOAD(CBool, PCGE, isMatch); \
23+
} \
24+
\
25+
CStatus prepareRun() override { \
26+
PYBIND11_OVERLOAD(CStatus, PCGE, prepareRun); \
27+
} \
28+
\
29+
CStatus checkRunResult() override { \
30+
PYBIND11_OVERLOAD(CStatus, PCGE, checkRunResult); \
31+
} \
32+
\
33+
34+
35+
#define PYCGRAPH_DECLARE_GGROUP_INTERFACE_CLASS(PCGG, PVFunc) \
36+
class PCGG##Interface : public PCGG { \
37+
public: \
38+
explicit PCGG##Interface(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) : PCGG(elements) {}; \
39+
~PCGG##Interface() override = default; \
40+
protected: \
41+
PYCGRAPH_DECLARE_GELEMENT_COMMON_FUNCTIONS(PCGG##Interface) \
42+
PVFunc \
43+
}; \
44+
\
45+
46+
47+
#define PYCGRAPH_DECLARE_GGROUP_PYBIND11_FUNCTIONS(PCGG) \
48+
py::class_<Pyw##PCGG, GElement, std::unique_ptr<Pyw##PCGG, py::nodelete> >(m, #PCGG) \
49+
.def(py::init<const GElementPtrArr&>(), \
50+
py::arg("elements") = GElementPtrArr{}, \
51+
py::keep_alive<1, 2>()) \
52+
.def("addGElements", &Pyw##PCGG::__addGElements_4py, \
53+
py::arg("elements"), \
54+
py::keep_alive<1, 2>()) \
55+
\
56+
57+
#endif //CGRAPH_PYWRAPPERDEFINE_H
Collapse file

‎python/wrapper/PyWrapperInclude.h‎

Copy file name to clipboardExpand all lines: python/wrapper/PyWrapperInclude.h
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
#define CGRAPH_PYWRAPPERINCLUDE_H
1111

1212
#include "PyGPipeline.h"
13+
#include "PyGMultiCondition.h"
1314
#include "PywGElement.h"
1415
#include "PywGNode.h"
15-
#include "PyGCluster.h"
16-
#include "PyGRegion.h"
16+
#include "PywGCluster.h"
17+
#include "PywGRegion.h"
1718
#include "PywGCondition.h"
18-
#include "PyGMultiCondition.h"
1919
#include "PywGParam.h"
2020
#include "PywGAspect.h"
2121
#include "PywGEvent.h"
Collapse file

‎python/wrapper/PywGCluster.h‎

Copy file name to clipboard
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/***************************
2+
@Author: Chunel
3+
@Contact: [email protected]
4+
@File: PywGCluster.h
5+
@Time: 2025/4/6 19:00
6+
@Desc:
7+
***************************/
8+
9+
#ifndef CGRAPH_PYWGCLUSTER_H
10+
#define CGRAPH_PYWGCLUSTER_H
11+
12+
#include "CGraph.h"
13+
#include "PyWrapperDefine.h"
14+
15+
class PywGCluster : public CGraph::GCluster {
16+
public:
17+
explicit PywGCluster(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
18+
__addGElements_4py(elements);
19+
}
20+
21+
~PywGCluster() override = default;
22+
};
23+
24+
PYCGRAPH_DECLARE_GGROUP_INTERFACE_CLASS(PywGCluster, ;);
25+
26+
#endif //CGRAPH_PYWGCLUSTER_H
Collapse file

‎python/wrapper/PywGCondition.h‎

Copy file name to clipboardExpand all lines: python/wrapper/PywGCondition.h
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <pybind11/pybind11.h>
1313

1414
#include "CGraph.h"
15+
#include "PyWrapperDefine.h"
1516

1617
class PywGCondition : public CGraph::GCondition {
1718
public:
@@ -25,4 +26,9 @@ class PywGCondition : public CGraph::GCondition {
2526
}
2627
};
2728

29+
PYCGRAPH_DECLARE_GGROUP_INTERFACE_CLASS(PywGCondition,
30+
CIndex choose() override {
31+
PYBIND11_OVERLOAD_PURE(CIndex, PywGConditionInterface, choose);
32+
});
33+
2834
#endif //CGRAPH_PYWGCONDITION_H
Collapse file

‎python/wrapper/PywGNode.h‎

Copy file name to clipboardExpand all lines: python/wrapper/PywGNode.h
+2-15Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <pybind11/pybind11.h>
1313

1414
#include "CGraph.h"
15+
#include "PyWrapperDefine.h"
1516

1617
class PywGNode : public CGraph::GNode {
1718
public:
@@ -44,21 +45,7 @@ class PywGNode : public CGraph::GNode {
4445
PYBIND11_OVERLOAD(CStatus, GNode, destroy);
4546
}
4647

47-
CBool isHold() override {
48-
PYBIND11_OVERLOAD(CBool, GNode, isHold);
49-
}
50-
51-
CBool isMatch() override {
52-
PYBIND11_OVERLOAD(CBool, GNode, isMatch);
53-
}
54-
55-
CStatus prepareRun() override {
56-
PYBIND11_OVERLOAD(CStatus, GNode, prepareRun);
57-
}
58-
59-
CStatus checkRunResult() override {
60-
PYBIND11_OVERLOAD(CStatus, GNode, checkRunResult);
61-
}
48+
PYCGRAPH_DECLARE_GELEMENT_COMMON_FUNCTIONS(CGraph::GNode)
6249
};
6350

6451
#endif //CGRAPH_PYWGNODE_H
Collapse file

‎python/wrapper/PywGRegion.h‎

Copy file name to clipboard
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/***************************
2+
@Author: Chunel
3+
@Contact: [email protected]
4+
@File: PywGRegion.h
5+
@Time: 2025/4/6 19:03
6+
@Desc:
7+
***************************/
8+
9+
#ifndef CGRAPH_PYWGREGION_H
10+
#define CGRAPH_PYWGREGION_H
11+
12+
#include "CGraph.h"
13+
#include "PyWrapperDefine.h"
14+
15+
class PywGRegion : public CGraph::GRegion {
16+
public:
17+
explicit PywGRegion(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
18+
__addGElements_4py(elements);
19+
};
20+
21+
~PywGRegion() override = default;
22+
};
23+
24+
PYCGRAPH_DECLARE_GGROUP_INTERFACE_CLASS(PywGRegion, ;);
25+
26+
#endif //CGRAPH_PYWGREGION_H

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.