Skip to content

Commit b22772e

Browse files
committed
Put generic methods on abstract base class.
1 parent 17da541 commit b22772e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/python_bindings.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,19 @@ PYBIND11_MODULE(btpy_cpp, m)
166166

167167
// Register the C++ type hierarchy so that we can refer to Python subclasses
168168
// by their superclass ptr types in generic C++ code.
169-
py::class_<TreeNode>(m, "_TreeNode");
169+
py::class_<TreeNode>(m, "_TreeNode")
170+
.def("get_input", &Py_getInput)
171+
.def("set_output", &Py_setOutput);
170172
py::class_<ActionNodeBase, TreeNode>(m, "_ActionNodeBase");
171173
py::class_<SyncActionNode, ActionNodeBase>(m, "_SyncActionNode");
172174
py::class_<StatefulActionNode, ActionNodeBase>(m, "_StatefulActionNode");
173175

174176
py::class_<Py_SyncActionNode, SyncActionNode>(m, "SyncActionNode")
175177
.def(py::init<const std::string&, const NodeConfig&>())
176-
.def("get_input", &Py_getInput)
177-
.def("set_output", &Py_setOutput)
178178
.def("tick", &Py_SyncActionNode::tick);
179179

180180
py::class_<Py_StatefulActionNode, StatefulActionNode>(m, "StatefulActionNode")
181181
.def(py::init<const std::string&, const NodeConfig&>())
182-
.def("get_input", &Py_getInput)
183-
.def("set_output", &Py_setOutput)
184182
.def("on_start", &Py_StatefulActionNode::onStart)
185183
.def("on_running", &Py_StatefulActionNode::onRunning)
186184
.def("on_halted", &Py_StatefulActionNode::onHalted);

0 commit comments

Comments
 (0)