Skip to content

Commit 6e2af53

Browse files
committed
Make XLink nodes internal
1 parent 159c798 commit 6e2af53

File tree

110 files changed

+302
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+302
-263
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ set(TARGET_CORE_SOURCES
242242
src/pipeline/ThreadedNode.cpp
243243
src/pipeline/DeviceNode.cpp
244244
src/pipeline/DeviceNodeGroup.cpp
245-
src/pipeline/node/XLinkIn.cpp
246-
src/pipeline/node/XLinkOut.cpp
245+
src/pipeline/node/internal/XLinkIn.cpp
246+
src/pipeline/node/internal/XLinkOut.cpp
247247
src/pipeline/node/ColorCamera.cpp
248248
src/pipeline/node/Camera.cpp
249249
src/pipeline/node/Thermal.cpp
@@ -277,8 +277,8 @@ set(TARGET_CORE_SOURCES
277277
src/pipeline/node/test/MyProducer.cpp
278278
src/pipeline/node/test/MyConsumer.cpp
279279
src/pipeline/node/UVC.cpp
280-
src/pipeline/node/host/XLinkInHost.cpp
281-
src/pipeline/node/host/XLinkOutHost.cpp
280+
src/pipeline/node/internal/XLinkInHost.cpp
281+
src/pipeline/node/internal/XLinkOutHost.cpp
282282
src/pipeline/node/host/HostNode.cpp
283283
src/pipeline/node/host/RGBD.cpp
284284
src/pipeline/datatype/DatatypeEnum.cpp

bindings/python/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ set(SOURCE_LIST
7171

7272
src/pipeline/node/NodeBindings.cpp
7373

74-
src/pipeline/node/XLinkInBindings.cpp
75-
src/pipeline/node/XLinkOutBindings.cpp
74+
src/pipeline/node/internal/XLinkInBindings.cpp
75+
src/pipeline/node/internal/XLinkOutBindings.cpp
7676
src/pipeline/node/ColorCameraBindings.cpp
7777
src/pipeline/node/CameraBindings.cpp
7878
src/pipeline/node/MonoCameraBindings.cpp

bindings/python/src/pipeline/PipelineBindings.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
#include "depthai/pipeline/node/UVC.hpp"
3737
#include "depthai/pipeline/node/VideoEncoder.hpp"
3838
#include "depthai/pipeline/node/Warp.hpp"
39-
#include "depthai/pipeline/node/XLinkIn.hpp"
40-
#include "depthai/pipeline/node/XLinkOut.hpp"
39+
#include "depthai/pipeline/node/internal/XLinkIn.hpp"
40+
#include "depthai/pipeline/node/internal/XLinkOut.hpp"
4141

4242
// depthai/
4343
#include <memory>
@@ -206,8 +206,8 @@ void PipelineBindings::bind(pybind11::module& m, void* pCallstack) {
206206
py::keep_alive<1, 0>())
207207
// TODO(themarpe) DEPRECATE, use pipeline.create([class name])
208208
// templated create<NODE> function
209-
.def("createXLinkIn", &Pipeline::create<node::XLinkIn>)
210-
.def("createXLinkOut", &Pipeline::create<node::XLinkOut>)
209+
.def("createXLinkIn", &Pipeline::create<node::internal::XLinkIn>)
210+
.def("createXLinkOut", &Pipeline::create<node::internal::XLinkOut>)
211211
.def("createNeuralNetwork", &Pipeline::create<node::NeuralNetwork>)
212212
.def("createColorCamera", &Pipeline::create<node::ColorCamera>)
213213
.def("createVideoEncoder", &Pipeline::create<node::VideoEncoder>)

bindings/python/src/pipeline/node/Common.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// Map of python node classes and call to pipeline to create it
1616
extern std::vector<std::pair<py::handle, std::function<std::shared_ptr<dai::Node>(dai::Pipeline&, py::object class_)>>> pyNodeCreateMap;
1717
extern py::handle daiNodeModule;
18+
extern py::handle daiNodeInternalModule;
1819

1920
template <typename T, typename DERIVED = dai::DeviceNode>
2021
py::class_<T, DERIVED, std::shared_ptr<T>> addNode(const char* name, const char* docstring = nullptr) {
@@ -23,6 +24,13 @@ py::class_<T, DERIVED, std::shared_ptr<T>> addNode(const char* name, const char*
2324
return node;
2425
}
2526

27+
template <typename T, typename DERIVED = dai::DeviceNode>
28+
py::class_<T, DERIVED, std::shared_ptr<T>> addNodeInternal(const char* name, const char* docstring = nullptr) {
29+
auto node = py::class_<T, DERIVED, std::shared_ptr<T>>(daiNodeInternalModule, name, docstring);
30+
pyNodeCreateMap.push_back(std::make_pair(node, [](dai::Pipeline& p, py::object class_) { return p.create<T>(); }));
31+
return node;
32+
}
33+
2634
template <typename T, typename DERIVED = dai::DeviceNode>
2735
py::class_<T, DERIVED, std::shared_ptr<T>> addNodeAbstract(const char* name, const char* docstring = nullptr) {
2836
auto node = py::class_<T, DERIVED, std::shared_ptr<T>>(daiNodeModule, name, docstring);
@@ -36,7 +44,8 @@ py::class_<T, DERIVED, std::shared_ptr<T>> addNodeAbstract(const char* name, con
3644
// Macro helpers
3745
#define ADD_NODE(NodeName) addNode<NodeName>(#NodeName, DOC(dai, node, NodeName))
3846
#define ADD_NODE_DERIVED(NodeName, Derived) addNode<NodeName, Derived>(#NodeName, DOC(dai, node, NodeName))
47+
#define ADD_NODE_INTERNAL(NodeName) addNodeInternal<NodeName>(#NodeName, DOC(dai, node, internal, NodeName))
3948
#define ADD_NODE_ABSTRACT(NodeName) addNodeAbstract<NodeName>(#NodeName, DOC(dai, node, NodeName))
4049
#define ADD_NODE_DERIVED_ABSTRACT(NodeName, Derived) addNodeAbstract<NodeName, Derived>(#NodeName, DOC(dai, node, NodeName))
4150
#define ADD_NODE_DOC(NodeName, docstring) addNode<NodeName>(#NodeName, docstring)
42-
#define ADD_NODE_DERIVED_DOC(NodeName, Derived, docstring) addNode<NodeName, Derived>(#NodeName, docstring)
51+
#define ADD_NODE_DERIVED_DOC(NodeName, Derived, docstring) addNode<NodeName, Derived>(#NodeName, docstring)

bindings/python/src/pipeline/node/NodeBindings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void delImplicitPipeline() {
4242
// Map of python node classes and call to pipeline to create it
4343
std::vector<std::pair<py::handle, std::function<std::shared_ptr<dai::Node>(dai::Pipeline&, py::object class_)>>> pyNodeCreateMap;
4444
py::handle daiNodeModule;
45+
py::handle daiNodeInternalModule;
4546

4647
std::vector<std::pair<py::handle, std::function<std::shared_ptr<dai::Node>(dai::Pipeline&, py::object class_)>>> NodeBindings::getNodeCreateMap() {
4748
return pyNodeCreateMap;
@@ -227,6 +228,7 @@ void NodeBindings::bind(pybind11::module& m, void* pCallstack) {
227228
//// Bindings for actual nodes
228229
// Move properties into nodes and nodes under 'node' submodule
229230
daiNodeModule = m.def_submodule("node");
231+
daiNodeInternalModule = m.def_submodule("node").def_submodule("internal");
230232

231233
// Properties
232234
py::class_<Node, std::shared_ptr<Node>> pyNode(m, "Node", DOC(dai, Node));

bindings/python/src/pipeline/node/XLinkInBindings.cpp renamed to bindings/python/src/pipeline/node/internal/XLinkInBindings.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
#include "Common.hpp"
2-
#include "NodeBindings.hpp"
1+
#include "../Common.hpp"
2+
#include "../NodeBindings.hpp"
33
#include "depthai/pipeline/Node.hpp"
44
#include "depthai/pipeline/Pipeline.hpp"
5-
#include "depthai/pipeline/node/XLinkIn.hpp"
5+
#include "depthai/pipeline/node/internal/XLinkIn.hpp"
6+
7+
extern py::handle daiNodeInternalModule;
68

79
void bind_xlinkin(pybind11::module& m, void* pCallstack) {
810
using namespace dai;
911
using namespace dai::node;
12+
using namespace dai::node::internal;
1013

1114
// Node and Properties declare upfront
1215
py::class_<XLinkInProperties> xlinkInProperties(m, "XLinkInProperties", DOC(dai, XLinkInProperties));
13-
auto xlinkIn = ADD_NODE(XLinkIn);
16+
auto xlinkIn = ADD_NODE_INTERNAL(XLinkIn);
1417

1518
///////////////////////////////////////////////////////////////////////
1619
///////////////////////////////////////////////////////////////////////
@@ -38,5 +41,5 @@ void bind_xlinkin(pybind11::module& m, void* pCallstack) {
3841
.def("getStreamName", &XLinkIn::getStreamName, DOC(dai, node, XLinkIn, getStreamName))
3942
.def("getMaxDataSize", &XLinkIn::getMaxDataSize, DOC(dai, node, XLinkIn, getMaxDataSize))
4043
.def("getNumFrames", &XLinkIn::getNumFrames, DOC(dai, node, XLinkIn, getNumFrames));
41-
daiNodeModule.attr("XLinkIn").attr("Properties") = xlinkInProperties;
44+
daiNodeInternalModule.attr("XLinkIn").attr("Properties") = xlinkInProperties;
4245
}

bindings/python/src/pipeline/node/XLinkOutBindings.cpp renamed to bindings/python/src/pipeline/node/internal/XLinkOutBindings.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
#include "Common.hpp"
2-
#include "NodeBindings.hpp"
1+
#include "../Common.hpp"
2+
#include "../NodeBindings.hpp"
33
#include "depthai/pipeline/Node.hpp"
44
#include "depthai/pipeline/Pipeline.hpp"
5-
#include "depthai/pipeline/node/XLinkOut.hpp"
5+
#include "depthai/pipeline/node/internal/XLinkOut.hpp"
6+
7+
extern py::handle daiNodeInternalModule;
68

79
void bind_xlinkout(pybind11::module& m, void* pCallstack) {
810
using namespace dai;
911
using namespace dai::node;
12+
using namespace dai::node::internal;
1013

1114
// Node and Properties declare upfront
1215
py::class_<XLinkOutProperties> xlinkOutProperties(m, "XLinkOutProperties", DOC(dai, XLinkOutProperties));
13-
auto xlinkOut = ADD_NODE(XLinkOut);
16+
auto xlinkOut = ADD_NODE_INTERNAL(XLinkOut);
1417

1518
///////////////////////////////////////////////////////////////////////
1619
///////////////////////////////////////////////////////////////////////
@@ -38,5 +41,5 @@ void bind_xlinkout(pybind11::module& m, void* pCallstack) {
3841
.def("getFpsLimit", &XLinkOut::getFpsLimit, DOC(dai, node, XLinkOut, getFpsLimit))
3942
.def("setMetadataOnly", &XLinkOut::setMetadataOnly, DOC(dai, node, XLinkOut, setMetadataOnly))
4043
.def("getMetadataOnly", &XLinkOut::getMetadataOnly, DOC(dai, node, XLinkOut, getMetadataOnly));
41-
daiNodeModule.attr("XLinkOut").attr("Properties") = xlinkOutProperties;
44+
daiNodeInternalModule.attr("XLinkOut").attr("Properties") = xlinkOutProperties;
4245
}

examples/cpp/v2_examples/AprilTag/apriltag.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ int main() {
1515
auto monoLeft = pipeline.create<dai::node::MonoCamera>();
1616
auto aprilTag = pipeline.create<dai::node::AprilTag>();
1717

18-
auto xoutMono = pipeline.create<dai::node::XLinkOut>();
19-
auto xoutAprilTag = pipeline.create<dai::node::XLinkOut>();
18+
auto xoutMono = pipeline.create<dai::node::internal::XLinkOut>();
19+
auto xoutAprilTag = pipeline.create<dai::node::internal::XLinkOut>();
2020

2121
xoutMono->setStreamName("mono");
2222
xoutAprilTag->setStreamName("aprilTagData");

examples/cpp/v2_examples/AprilTag/apriltag_rgb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ int main() {
1616
auto aprilTag = pipeline.create<dai::node::AprilTag>();
1717
auto manip = pipeline.create<dai::node::ImageManip>();
1818

19-
auto xoutAprilTag = pipeline.create<dai::node::XLinkOut>();
20-
auto xoutAprilTagImage = pipeline.create<dai::node::XLinkOut>();
19+
auto xoutAprilTag = pipeline.create<dai::node::internal::XLinkOut>();
20+
auto xoutAprilTagImage = pipeline.create<dai::node::internal::XLinkOut>();
2121

2222
xoutAprilTag->setStreamName("aprilTagData");
2323
xoutAprilTagImage->setStreamName("aprilTagImage");

examples/cpp/v2_examples/Camera/thermal_cam.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ int main() {
3636
throw std::runtime_error("Thermal camera not found!");
3737
}
3838
thermal->setPreviewSize(width, height);
39-
auto xlink = pipeline.create<dai::node::XLinkOut>();
40-
auto xlinkRaw = pipeline.create<dai::node::XLinkOut>();
39+
auto xlink = pipeline.create<dai::node::internal::XLinkOut>();
40+
auto xlinkRaw = pipeline.create<dai::node::internal::XLinkOut>();
4141
// Output preview,video, isp: RGB or NV12 or YUV420 thermal image.
4242
thermal->preview.link(xlink->input);
4343
// Output raw: FP16 temperature data (degrees Celsius)

0 commit comments

Comments
 (0)