template class FunctionalNode<std::tuple<INPUT_TYPES…>, std::tuple<OUTPUT_TYPES…>>

Overview

Implementation of a functional node in the computational graph. More…

#include <functional_node.h>

template <typename... INPUT_TYPES, typename... OUTPUT_TYPES>
class FunctionalNode<std::tuple<INPUT_TYPES...>, std::tuple<OUTPUT_TYPES...>>: public FunctionalNodeBase {
public:
    // methods

    template <std::size_t N, class T_IN, class T_OUT>
    InputPort<T_IN, T_OUT>* registerInput(const std::string& id);

    Port* getInputByIndex(size_t idx);
    virtual Port* getInputById(const std::string& id);

    template <std::size_t N, class T>
    OutputPort<T>* registerOutput(const std::string& id);

    template <std::size_t N>
    Port* getOutputByIndex();

    virtual Port* getOutputById(const std::string& id);

    template <std::size_t N = 0>
    Port* getOutputByIdTuple(const std::string& id);
};

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
    );

    virtual Port* getInputById(const std::string&);
    virtual Port* getOutputById(const std::string&);
    virtual void configure();
    virtual void compute();
    void registerF2FEdge(const std::string& i_port, const std::string& address);

Detailed Documentation

Implementation of a functional node in the computational graph.

It stores an std::function object, ‘_function’ which is called in the node ‘compute’ method and which inputs and outputs can be connected to input and output ports respectively

_function return value is bool, which is used to decide whether to send outputs or not

Methods

template <std::size_t N, class T_IN, class T_OUT>
InputPort<T_IN, T_OUT>* registerInput(const std::string& id)

Creates an InputPort and connect it to an input specified by N. Returns the created port.

Port* getInputByIndex(size_t idx)

Returns an InputPort by index.

virtual Port* getInputById(const std::string& id)

Returns an InputPort by id.

template <std::size_t N, class T>
OutputPort<T>* registerOutput(const std::string& id)

Creates an OutputPort and connect it to an output specified by N. Returns the created port.

template <std::size_t N>
Port* getOutputByIndex()

Returns an OutputPort by index.

virtual Port* getOutputById(const std::string& id)

Returns an OutputPort by id.