NRP Core  1.4.1
OutputPort< T > Class Template Reference

Implementation of an output port in the computation graph. More...

#include <output_port.h>

Inheritance diagram for OutputPort< T >:
Port

Public Member Functions

 OutputPort (const std::string &id, ComputationalNode *parent)
 Constructor. More...
 
void publish (const T *msg)
 Publish a msg to all subscribers. More...
 
size_t subscriptionsSize () override
 Return the number the number of ports subscribed to this port. More...
 
- Public Member Functions inherited from Port
 Port ()=delete
 
virtual ~Port ()=default
 
 Port (std::string id, ComputationalNode *parent)
 Constructor. More...
 
const std::string & id ()
 Returns the port 'id'. More...
 
ComputationalNodeparent () const
 Returns the port parent node. More...
 

Protected Member Functions

void add_subscriber (std::function< void(const T *)> callback)
 Adds a subscriber to this port. More...
 

Friends

template<typename , typename >
class InputPort
 

Detailed Description

template<class T>
class OutputPort< T >

Implementation of an output port in the computation graph.

It forwards msgs to subscribed ports via its 'publish' method

Constructor & Destructor Documentation

◆ OutputPort()

template<class T >
OutputPort< T >::OutputPort ( const std::string &  id,
ComputationalNode parent 
)
inline

Constructor.

Member Function Documentation

◆ add_subscriber()

template<class T >
void OutputPort< T >::add_subscriber ( std::function< void(const T *)>  callback)
inlineprotected

Adds a subscriber to this port.

InputPorts subscribe themselves to OutputPorts

◆ publish()

template<class T >
void OutputPort< T >::publish ( const T *  msg)
inline

Publish a msg to all subscribers.

◆ subscriptionsSize()

template<class T >
size_t OutputPort< T >::subscriptionsSize ( )
inlineoverridevirtual

Return the number the number of ports subscribed to this port.

Implements Port.

Friends And Related Function Documentation

◆ InputPort

template<class T >
template<typename , typename >
friend class InputPort
friend

The documentation for this class was generated from the following file: