Implementation of an output node in the computation graph. More...
#include <output_node.h>
Public Member Functions | |
OutputNode (const std::string &id, OutputNodePolicies::PublishFormatPolicy publishFormatPolicy=OutputNodePolicies::PublishFormatPolicy::SERIES, bool publishFromCache=false, int maxPortConnections=0, unsigned int computePeriod=1) | |
Constructor. More... | |
template<class T_IN > | |
InputPort< T_IN, DATA > * | getOrRegisterInput (const std::string &id) |
Gets or register input port to this node and returns a pointer to it. More... | |
unsigned int | getComputePeriod () |
void | setComputePeriod (unsigned int computePeriod) |
bool | publishFromCache () |
virtual bool | doCompute () const override final |
Tells if this node should be executed in this graph execution cycle, used in some graph execution modes. More... | |
![]() | |
ComputationalNode ()=delete | |
virtual | ~ComputationalNode ()=default |
ComputationalNode (std::string id, NodeType type) | |
Constructor. More... | |
const std::string & | id () const |
Returns the node 'id'. More... | |
NodeType | type () const |
Returns the node 'type'. More... | |
virtual std::string | typeStr () const |
Returns the node 'type' as a string. More... | |
void | setVisited (bool visited) |
Sets a value for the node 'visited' property, used for graph traversing. More... | |
bool | isVisited () const |
Returns true if the node has been marked as visited, false otherwise. More... | |
void | setDoCompute (bool doCompute) |
Sets a value for the node 'doCompute' property, used in some graph execution modes. More... | |
Protected Member Functions | |
void | configure () override |
Configures the node making it ready to execute 'compute'. More... | |
virtual void | compute () override final |
Requests the node to execute its computation. More... | |
void | graphCycleStartCB () override final |
Function called by the Computational Graph at the beginning of a new execution cycle. More... | |
void | storeMsg (const std::string &id, const DATA *data) |
Stores a new msg in _storedMsgs['id']. More... | |
void | sendMsgs (const std::string &id) |
Sends all msgs stored in _storedMsgs['id'] and clears the storage. More... | |
virtual void | sendSingleMsg (const std::string &id, const DATA *data)=0 |
Sends out a single msg, to be implemented by derived classes. More... | |
virtual void | sendBatchMsg (const std::string &id, const std::vector< const DATA * > &data)=0 |
Sends out a vector of msg as a single batch, to be implemented by derived classes. More... | |
![]() | |
virtual void | graphLoadedCB () |
Function called by the Computational Graph to nodes that the graph has been completely loaded. More... | |
Protected Attributes | |
std::map< std::string, std::shared_ptr< Port > > | _inputPorts |
List of ports owned by this node. More... | |
std::map< std::string, std::vector< const DATA * > > | _storedMsgs |
List of msgs stored in this node. More... | |
OutputNodePolicies::PublishFormatPolicy | _publishFormatPolicy |
Send policy used by this node. More... | |
bool | _publishFromCache |
Publish frequency policy used by this node. More... | |
int | _maxPortConnections |
Maximum number of subscriptions of ports in this node. More... | |
bool | _isConfigured = false |
true if the node has been configured, false otherwise More... | |
unsigned int | _computePeriod |
Property specifying the number of loops that passes between executions of this node. More... | |
unsigned int | _nLoop = 0 |
Variable counting the number of times this nodes has been asked to execute (1 per loop) More... | |
Friends | |
class | ComputationalNodes_OUTPUT_NODE_Test |
class | ComputationalGraphPythonNodes_PYTHON_DECORATORS_BASIC_Test |
Additional Inherited Members | |
![]() | |
enum | NodeType { Input, Output, Functional } |
All the possible node types. More... | |
![]() | |
static std::pair< std::string, std::string > | parseNodeAddress (const std::string &address, bool hasPort=true) |
Parses a computational node address returning the node id and the port (if any) contained in the address. More... | |
![]() | |
const static std::map< NodeType, std::string > | nodeTypeStr |
Implementation of an output node in the computation graph.
Output nodes are the connection point to send data out of the computation graph. In its 'compute' operation all messages received since last 'compute' are sent using the 'sendSingleMsg' implemented by derived classes.
|
inline |
Constructor.
|
inlinefinaloverrideprotectedvirtual |
Requests the node to execute its computation.
Implements ComputationalNode.
|
inlineoverrideprotectedvirtual |
Configures the node making it ready to execute 'compute'.
Implements ComputationalNode.
|
inlinefinaloverridevirtual |
Tells if this node should be executed in this graph execution cycle, used in some graph execution modes.
ComputationalNode returns the value of its 'doCompute' property. Subclasses of ComputationalNode can implement further logic that can override this value
Reimplemented from ComputationalNode.
|
inline |
|
inline |
Gets or register input port to this node and returns a pointer to it.
|
inlinefinaloverrideprotectedvirtual |
Function called by the Computational Graph at the beginning of a new execution cycle.
Reimplemented from ComputationalNode.
|
inline |
|
protectedpure virtual |
Sends out a vector of msg as a single batch, to be implemented by derived classes.
Implemented in OutputDummy, OutputSpinnakerNode, OutputROSNode< MSG_TYPE >, OutputMQTTNode< MSG_TYPE >, and OutputMQTTNode< DataPack< MSG_TYPE > * >.
|
inlineprotected |
Sends all msgs stored in _storedMsgs['id'] and clears the storage.
|
protectedpure virtual |
Sends out a single msg, to be implemented by derived classes.
Implemented in OutputSpinnakerNode, OutputMQTTNode< MSG_TYPE >, OutputROSNode< MSG_TYPE >, OutputMQTTNode< DataPack< MSG_TYPE > * >, and OutputDummy.
|
inline |
|
inlineprotected |
Stores a new msg in _storedMsgs['id'].
|
friend |
|
friend |
|
protected |
Property specifying the number of loops that passes between executions of this node.
If '_computePeriod' is 1, the node is executed every loop, if 2, every 2 loops, and so on. If 0, the node would never execute unless 'setDoCompute(true)' is called
|
protected |
List of ports owned by this node.
|
protected |
true if the node has been configured, false otherwise
|
protected |
Maximum number of subscriptions of ports in this node.
|
protected |
Variable counting the number of times this nodes has been asked to execute (1 per loop)
|
protected |
Send policy used by this node.
|
protected |
Publish frequency policy used by this node.
|
protected |
List of msgs stored in this node.