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

Function blocks perform calculations on inputs/generate data, outputting new data in its output signals as packets. More...

Detailed Description

template<typename InterfaceType>
class GenericFunctionBlockPtr< InterfaceType >

Function blocks perform calculations on inputs/generate data, outputting new data in its output signals as packets.

Each function block describes its behaviour and identifiers in its FunctionBlockType structure. It provides a list of input ports that can be connected to signals that the input port accepts, as well as a list of output signals that carry the function block's output data.

Additionally, as each function block is a property object, it can define its own set of properties, providing user-configurable settings. In example, a FFT function block would expose a blockSize property, defining the amount of samples to be used for calculation in each block.

Function blocks also provide a status signal, through which a status packet is sent whenever a connection to a new input port is formed, or when the status changes.

Public Member Functions

daq::FunctionBlockTypePtr getFunctionBlockType () const
 Gets an information structure contain metadata of the function block type. More...
 
daq::ListPtr< daq::IInputPort > getInputPorts (const daq::SearchFilterPtr &searchFilter=nullptr) const
 Gets a list of the function block's input ports. More...
 
daq::ListPtr< daq::ISignal > getSignals (const daq::SearchFilterPtr &searchFilter=nullptr) const
 Gets the list of the function block's output signals. More...
 
daq::ListPtr< daq::ISignal > getSignalsRecursive (const daq::SearchFilterPtr &searchFilter=nullptr) const
 Gets the list of the function block's visible output signals including signals from visible child function blocks. More...
 
daq::SignalPtr getStatusSignal () const
 Gets the function block's status signal. More...
 
daq::ListPtr< daq::IFunctionBlock > getFunctionBlocks (const daq::SearchFilterPtr &searchFilter=nullptr) const
 Gets a list of sub-function blocks. More...
 
daq::DictPtr< daq::IString, daq::IFunctionBlockType > getAvailableFunctionBlockTypes () const
 Gets all neasted function block types that are supported, containing their description. More...
 
daq::FunctionBlockPtr addFunctionBlock (const daq::StringPtr &typeId, const daq::PropertyObjectPtr &config=nullptr) const
 Creates and adds a function block as the neasted of current function block with the provided unique ID and returns it. More...
 
void removeFunctionBlock (const daq::FunctionBlockPtr &functionBlock) const
 Removes the function block provided as argument, disconnecting its signals and input ports. More...
 

Member Function Documentation

◆ addFunctionBlock()

daq::FunctionBlockPtr addFunctionBlock ( const daq::StringPtr &  typeId,
const daq::PropertyObjectPtr &  config = nullptr 
) const
inline

Creates and adds a function block as the neasted of current function block with the provided unique ID and returns it.

Returns
The added function block.
Parameters
typeIdThe unique ID of the function block. Can be obtained from its corresponding Function Block Info object.
configA config object to configure a function block with custom settings specific to that function block type.

◆ getAvailableFunctionBlockTypes()

daq::DictPtr<daq::IString, daq::IFunctionBlockType> getAvailableFunctionBlockTypes ( ) const
inline

Gets all neasted function block types that are supported, containing their description.

Returns
A dictionary of available function block types.

◆ getFunctionBlocks()

daq::ListPtr<daq::IFunctionBlock> getFunctionBlocks ( const daq::SearchFilterPtr &  searchFilter = nullptr) const
inline

Gets a list of sub-function blocks.

Parameters
searchFilterProvides optional parameters such as "recursive" and "visibleOnly" to modify the search pattern.
Returns
The list of sub-function blocks.

If searchFilter is not provided, the returned list contains only visible function blocks and does not include those of child function blocks.

◆ getFunctionBlockType()

daq::FunctionBlockTypePtr getFunctionBlockType ( ) const
inline

Gets an information structure contain metadata of the function block type.

Returns
The Function block type object.

◆ getInputPorts()

daq::ListPtr<daq::IInputPort> getInputPorts ( const daq::SearchFilterPtr &  searchFilter = nullptr) const
inline

Gets a list of the function block's input ports.

Parameters
searchFilterProvides an optional filter that filters out unwanted components and allows for recursion.
Returns
The list of input ports.

If searchFilter is not provided, the returned list contains only visible input ports and does not include those of child function blocks.

◆ getSignals()

daq::ListPtr<daq::ISignal> getSignals ( const daq::SearchFilterPtr &  searchFilter = nullptr) const
inline

Gets the list of the function block's output signals.

Parameters
searchFilterProvides an optional filter that filters out unwanted components and allows for recursion.
Returns
The list of output signals.

If searchFilter is not provided, the returned list contains only visible signals and does not include those of child function blocks.

◆ getSignalsRecursive()

daq::ListPtr<daq::ISignal> getSignalsRecursive ( const daq::SearchFilterPtr &  searchFilter = nullptr) const
inline

Gets the list of the function block's visible output signals including signals from visible child function blocks.

Parameters
searchFilterProvides an optional filter that filters out unwanted components and allows for recursion.
Returns
The list of output signals.

◆ getStatusSignal()

daq::SignalPtr getStatusSignal ( ) const
inline

Gets the function block's status signal.

Returns
The status signal.

The status signal sends out a status event packet every time it is connected to an input port. Additionally, a status event packet is sent whenever the status of the function block changes.

◆ removeFunctionBlock()

void removeFunctionBlock ( const daq::FunctionBlockPtr &  functionBlock) const
inline

Removes the function block provided as argument, disconnecting its signals and input ports.

Parameters
functionBlockThe function block to be removed.