forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPywGNode.h
More file actions
58 lines (45 loc) · 1.31 KB
/
PywGNode.h
File metadata and controls
58 lines (45 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: PywGNode.h
@Time: 2025/1/30 21:41
@Desc:
***************************/
#ifndef CGRAPH_PYWGNODE_H
#define CGRAPH_PYWGNODE_H
#include <pybind11/pybind11.h>
#include "CGraph.h"
namespace py = pybind11;
class PywGNode : public CGraph::GNode {
public:
explicit PywGNode(const std::string& name,
int loop = CGraph::CGRAPH_DEFAULT_LOOP_TIMES) {
setName(name);
setLoop(loop);
}
explicit PywGNode(const CGraph::GElementPtrSet& depends = CGraph::GElementPtrSet{},
const std::string& name = CGraph::CGRAPH_EMPTY,
int loop = CGraph::CGRAPH_DEFAULT_LOOP_TIMES) {
addDependGElements(depends);
setLoop(loop);
setName(name);
}
~PywGNode() override = default;
protected:
CStatus init() override {
PYBIND11_OVERLOAD(CStatus, GNode, init);
}
CStatus run() override {
PYBIND11_OVERLOAD_PURE(CStatus, GNode, run);
}
CStatus destroy() override {
PYBIND11_OVERLOAD(CStatus, GNode, destroy);
}
CBool isHold() override {
PYBIND11_OVERLOAD(CBool, GNode, isHold);
}
CBool isMatch() override {
PYBIND11_OVERLOAD(CBool, GNode, isMatch);
}
};
#endif //CGRAPH_PYWGNODE_H