template class InputNode

Overview

Implementation of an input node in the computation graph. More…

#include <input_node.h>

template <class DATA>
class InputNode: public ComputationalNode {
public:
    // construction

    InputNode(
        const std::string& id,
        InputNodePolicies::MsgPublishPolicy msgPublishPolicy = InputNodePolicies::MsgPublishPolicy::LAST,
        InputNodePolicies::MsgCachePolicy msgCachePolicy = InputNodePolicies::MsgCachePolicy::KEEP_CACHE,
        size_t queue_size = 10
    );

    // methods

    void registerOutput(const std::string& id);
    OutputPort<DATA>* getSinglePort(const std::string& id);
    OutputPort<std::vector<const DATA*>>* getListPort(const std::string& id);
    InputNodePolicies::MsgPublishPolicy msgPublishPolicy();
    InputNodePolicies::MsgCachePolicy msgCachePolicy();
    void setMsgPublishPolicy(InputNodePolicies::MsgPublishPolicy msgPublishPolicy);
    void setMsgCachePolicy(InputNodePolicies::MsgCachePolicy msgCachePolicy);
};

// direct descendants

class InputDummy;
class InputEngineNode;

template <class MSG_TYPE>
class InputMQTTNode;

template <class MSG_TYPE>
class InputROSNode;

class InputSpinnakerNode;
class InputTimeBaseNode;

Inherited Members

public:
    // enums

    enum NodeType;

    // fields

    static const static std::map<NodeType, std::string> nodeTypeStr = {{ComputationalNode::Input, "Input"},                                                                                            {ComputationalNode::Output, "Output"},                                                                                            {ComputationalNode::Functional, "Functional"}};

    // methods

    const std::string& id() const;
    NodeType type() const;
    virtual std::string typeStr() const;
    void setVisited(bool visited);
    bool isVisited() const;
    void setDoCompute(bool doCompute);
    virtual bool doCompute() const;

    static std::pair<std::string, std::string> parseNodeAddress(
        const std::string& address,
        bool hasPort = true
    );

Detailed Documentation

Implementation of an input node in the computation graph.

Input nodes are the connection points to feed data into the computation graph from outside. It owns output ports which are used to forward incoming data to other nodes. One node can handle multiple ports. The class is templated with the data type the node can handle. Each node implementation can handle only one data type.

Derived classes of InputNode remains responsible for the ownership of the data passed to InputNode through the updatePortData() virtual method.

Construction

InputNode(
    const std::string& id,
    InputNodePolicies::MsgPublishPolicy msgPublishPolicy = InputNodePolicies::MsgPublishPolicy::LAST,
    InputNodePolicies::MsgCachePolicy msgCachePolicy = InputNodePolicies::MsgCachePolicy::KEEP_CACHE,
    size_t queue_size = 10
)

Constructor.

Methods

void registerOutput(const std::string& id)

Registers an Output port with id ‘id’ with this node.

OutputPort<DATA>* getSinglePort(const std::string& id)

Returns a pointer to single output port if the port is registered, nullptr otherwise.

OutputPort<std::vector<const DATA*>>* getListPort(const std::string& id)

Returns a pointer to list output port if the port is registered, nullptr otherwise.