Class Node

Nested Relationships

Nested Types

Inheritance Relationships

Derived Types

Class Documentation

class Node

Abstract Node.

Subclassed by dai::NodeCRTP< Node, SPIOut, SPIOutProperties >, dai::NodeCRTP< Node, DetectionParser, DetectionParserProperties >, dai::NodeCRTP< Node, Cast, CastProperties >, dai::NodeCRTP< Node, PointCloud, PointCloudProperties >, dai::NodeCRTP< Node, AprilTag, AprilTagProperties >, dai::NodeCRTP< Node, ToF, ToFProperties >, dai::NodeCRTP< Node, SystemLogger, SystemLoggerProperties >, dai::NodeCRTP< Node, SPIIn, SPIInProperties >, dai::NodeCRTP< Node, UVC, UVCProperties >, dai::NodeCRTP< Node, ObjectTracker, ObjectTrackerProperties >, dai::NodeCRTP< Node, MonoCamera, MonoCameraProperties >, dai::NodeCRTP< Node, FeatureTracker, FeatureTrackerProperties >, dai::NodeCRTP< Node, ColorCamera, ColorCameraProperties >, dai::NodeCRTP< Node, Camera, CameraProperties >, dai::NodeCRTP< Node, Warp, WarpProperties >, dai::NodeCRTP< Node, SpatialLocationCalculator, SpatialLocationCalculatorProperties >, dai::NodeCRTP< Node, NeuralNetwork, NeuralNetworkProperties >, dai::NodeCRTP< Node, ImageManip, ImageManipProperties >, dai::NodeCRTP< Node, XLinkIn, XLinkInProperties >, dai::NodeCRTP< Node, Script, ScriptProperties >, dai::NodeCRTP< Node, IMU, IMUProperties >, dai::NodeCRTP< Node, EdgeDetector, EdgeDetectorProperties >, dai::NodeCRTP< Node, VideoEncoder, VideoEncoderProperties >, dai::NodeCRTP< Node, StereoDepth, StereoDepthProperties >, dai::NodeCRTP< Node, XLinkOut, XLinkOutProperties >, dai::NodeCRTP< Node, ImageAlign, ImageAlignProperties >, dai::NodeCRTP< Node, Sync, SyncProperties >, dai::NodeCRTP< Node, MessageDemux, MessageDemuxProperties >

Public Types

using Id = std::int64_t

Node identificator. Unique for every node on a single Pipeline.

Public Functions

Pipeline getParentPipeline()
const Pipeline getParentPipeline() const
virtual std::unique_ptr<Node> clone() const = 0

Deep copy the node.

virtual const char *getName() const = 0

Retrieves nodes name.

std::vector<Output> getOutputs()

Retrieves all nodes outputs.

std::vector<Input> getInputs()

Retrieves all nodes inputs.

std::vector<Output*> getOutputRefs()

Retrieves reference to node outputs.

std::vector<const Output*> getOutputRefs() const

Retrieves reference to node outputs.

std::vector<Input*> getInputRefs()

Retrieves reference to node inputs.

std::vector<const Input*> getInputRefs() const

Retrieves reference to node inputs.

Node(const std::shared_ptr<PipelineImpl> &p, Id nodeId, std::unique_ptr<Properties> props)

Constructs Node.

virtual ~Node() = default
const AssetManager &getAssetManager() const

Get node AssetManager as a const reference.

AssetManager &getAssetManager()

Get node AssetManager as a reference.

Public Members

const Id id

Id of node.

Properties &properties

Protected Functions

void setOutputRefs(std::initializer_list<Output*> l)
void setOutputRefs(Output *outRef)
void setInputRefs(std::initializer_list<Input*> l)
void setInputRefs(Input *inRef)
void setOutputMapRefs(std::initializer_list<OutputMap*> l)
void setOutputMapRefs(OutputMap *outMapRef)
void setInputMapRefs(std::initializer_list<InputMap*> l)
void setInputMapRefs(InputMap *inMapRef)
virtual Properties &getProperties()
virtual tl::optional<OpenVINO::Version> getRequiredOpenVINOVersion()

Protected Attributes

std::unordered_map<std::string, Output*> outputRefs
std::unordered_map<std::string, Input*> inputRefs
std::unordered_map<std::string, OutputMap*> outputMapRefs
std::unordered_map<std::string, InputMap*> inputMapRefs
std::weak_ptr<PipelineImpl> parent
AssetManager assetManager
copyable_unique_ptr<Properties> propertiesHolder
struct Connection

Connection between an Input and Output.

Public Functions

Connection(Output out, Input in)
bool operator==(const Connection &rhs) const

Public Members

Id outputId
std::string outputName
std::string outputGroup
Id inputId
std::string inputName
std::string inputGroup

Friends

friend struct std::hash< Connection >
struct DatatypeHierarchy

Public Functions

inline DatatypeHierarchy(DatatypeEnum d, bool c)

Public Members

DatatypeEnum datatype
bool descendants
class Input

Public Types

enum class Type

Values:

enumerator SReceiver
enumerator MReceiver

Public Functions

inline Input(Node &par, std::string n, Type t, std::vector<DatatypeHierarchy> types)

Constructs Input with default blocking and queueSize options.

inline Input(Node &par, std::string n, Type t, bool blocking, int queueSize, std::vector<DatatypeHierarchy> types)

Constructs Input with specified blocking and queueSize options.

inline Input(Node &par, std::string n, Type t, bool blocking, int queueSize, bool waitForMessage, std::vector<DatatypeHierarchy> types)

Constructs Input with specified blocking and queueSize as well as additional options.

inline Input(Node &par, std::string group, std::string n, Type t, bool blocking, int queueSize, bool waitForMessage, std::vector<DatatypeHierarchy> types)

Constructs Input with specified blocking and queueSize as well as additional options.

inline Node &getParent()
inline const Node &getParent() const
std::string toString() const

Input to string representation.

void setBlocking(bool blocking)

Overrides default input queue behavior.

Parameters:

blocking – True blocking, false overwriting

bool getBlocking() const

Get input queue behavior

Returns:

True blocking, false overwriting

void setQueueSize(int size)

Overrides default input queue size. If queue size fills up, behavior depends on blocking attribute

Parameters:

size – Maximum input queue size

int getQueueSize() const

Get input queue size.

Returns:

Maximum input queue size

void setWaitForMessage(bool waitForMessage)

Overrides default wait for message behavior. Applicable for nodes with multiple inputs. Specifies behavior whether to wait for this input when a Node processes certain data or not.

Parameters:

waitForMessage – Whether to wait for message to arrive to this input or not

bool getWaitForMessage() const

Get behavior whether to wait for this input when a Node processes certain data or not

Returns:

Whether to wait for message to arrive to this input or not

void setReusePreviousMessage(bool reusePreviousMessage)

Equivalent to setWaitForMessage but with inverted logic.

bool getReusePreviousMessage() const

Equivalent to getWaitForMessage but with inverted logic.

Public Members

std::string group = ""
std::string name
Type type
bool defaultBlocking = {true}
int defaultQueueSize = {8}
tl::optional<bool> blocking
tl::optional<int> queueSize
tl::optional<bool> waitForMessage
bool defaultWaitForMessage = {false}
std::vector<DatatypeHierarchy> possibleDatatypes

Friends

friend class Output
class InputMap : public std::unordered_map<std::string, Input>

Input map which keeps track of inputs assigned to a node Extends std::unordered_map<std::string, dai::Node::Input>

Public Functions

InputMap(Input defaultInput)
InputMap(std::string name, Input defaultInput)
Input &operator[](const std::string &key)

Create or modify an input.

Public Members

std::string name
class Output

Public Types

enum class Type

Values:

enumerator MSender
enumerator SSender

Public Functions

inline Output(Node &par, std::string n, Type t, std::vector<DatatypeHierarchy> types)
inline Output(Node &par, std::string group, std::string n, Type t, std::vector<DatatypeHierarchy> types)
inline Node &getParent()
inline const Node &getParent() const
std::string toString() const

Output to string representation.

bool isSamePipeline(const Input &in)

Check if this output and given input are on the same pipeline.

See also

canConnect for checking if connection is possible

Returns:

True if output and input are on the same pipeline

bool canConnect(const Input &in)

Check if connection is possible

Parameters:

inInput to connect to

Returns:

True if connection is possible, false otherwise

std::vector<Connection> getConnections()

Retrieve all connections from this output

Returns:

Vector of connections

void link(const Input &in)

Link current output to input.

Throws an error if this output cannot be linked to given input, or if they are already linked

Parameters:

inInput to link to

void unlink(const Input &in)

Unlink a previously linked connection

Throws an error if not linked.

Parameters:

inInput from which to unlink from

Public Members

std::string group = ""
std::string name
Type type
std::vector<DatatypeHierarchy> possibleDatatypes
class OutputMap : public std::unordered_map<std::string, Output>

Output map which keeps track of extra outputs assigned to a node Extends std::unordered_map<std::string, dai::Node::Output>

Public Functions

OutputMap(std::string name, Output defaultOutput)
OutputMap(Output defaultOutput)
Output &operator[](const std::string &key)

Create or modify an input.

Public Members

std::string name