openDAQ
Open data acquisition platform
GenericInputPortPtr< InterfaceType > Class Template Reference

Signals accepted by input ports can be connected, forming a connection between the input port and signal, through which Packets can be sent. More...

Detailed Description

template<typename InterfaceType>
class GenericInputPortPtr< InterfaceType >

Signals accepted by input ports can be connected, forming a connection between the input port and signal, through which Packets can be sent.

Any openDAQ object which wishes to receive signal data must create an input port and connect it to said signals. Such objects are for example function blocks, and readers.

An input port can filter out incompatible signals by returning false when such a signal is passed as argument to acceptsSignal, and also rejects the signals when they are passed as argument to connect.

Depending on the configuration, an input port might not require a signal to be connected, returning false when requiresSignal is called. Such input ports are usually a part of function blocks that do not require a given signal to perform calculations.

Public Member Functions

daq::Bool acceptsSignal (const daq::SignalPtr &signal) const
 Returns true if the signal can be connected to the input port; false otherwise. More...
 
void connect (const daq::SignalPtr &signal) const
 Connects the signal to the input port, forming a Connection. More...
 
void disconnect () const
 Disconnects the signal from the input port.
 
daq::SignalPtr getSignal () const
 Gets the signal connected to the input port. More...
 
daq::Bool getRequiresSignal () const
 Returns true if the input port requires a signal to be connected; false otherwise. More...
 
daq::ConnectionPtr getConnection () const
 Gets the Connection object formed between the Signal and Input port. More...
 

Member Function Documentation

◆ acceptsSignal()

daq::Bool acceptsSignal ( const daq::SignalPtr &  signal) const
inline

Returns true if the signal can be connected to the input port; false otherwise.

Parameters
signalThe signal being evaluated for compatibility.
Returns
True if the signal can be connected; false otherwise.
Exceptions
NotAssignedExceptionif the accepted signal criteria is not defined by the input port.

◆ connect()

void connect ( const daq::SignalPtr &  signal) const
inline

Connects the signal to the input port, forming a Connection.

Parameters
signalThe signal to be connected to the input port.
Exceptions
OpendaqErrExceptionif the signal is not accepted.
NotAssignedExceptionif the accepted signal criteria is not defined by the input port.

The signal is notified of the connection formed between it and the input port.

◆ getConnection()

daq::ConnectionPtr getConnection ( ) const
inline

Gets the Connection object formed between the Signal and Input port.

Returns
The Connection object.

◆ getRequiresSignal()

daq::Bool getRequiresSignal ( ) const
inline

Returns true if the input port requires a signal to be connected; false otherwise.

Returns
True if the input port requires a signal to be connected; false otherwise.

◆ getSignal()

daq::SignalPtr getSignal ( ) const
inline

Gets the signal connected to the input port.

Returns
The signal connected to the input port.