blockfactory
0.8
A framework for wrapping algorithms for dataflow programming
|
Abstract class for storing generic core::Block properties. More...
#include <BlockInformation.h>
Abstract class for storing generic core::Block properties.
core::BlockInformation provides an interface for handling implementation-specific properties such as input / output number, size and type, number of parameters, ...
A core::Block needs to know on what kind of data it operates, and retrieving this information is often specific on the framework on top of which blocks run. In order to allow using the same core::Block class from different frameworks (e.g. Simulink, C++, etc), different implementation of this interface can be developed to provide a transparent translation of such functionalities.
As an example, take the core::BlockInformation::parseParameters. In Simulink, parameters are read from the block masks and Matlab provides APIs for reading them. The mex::SimulinkBlockInformation implementation will use those APIs. However, if you want to call the same block class (which is just a wrapper of an algorithm) from a pure C++ main, parameters are read e.g. from an xml file. In this case, core::BlockInformation::parseParameters will parse the xml and fill the core::Parameters argument.
Public Member Functions | |
BlockInformation ()=default | |
virtual | ~BlockInformation ()=default |
virtual bool | getUniqueName (std::string &blockUniqueName) const =0 |
Get the unique name of the block instance. More... | |
virtual bool | optionFromKey (const std::string &key, double &option) const =0 |
Convert a block option from its string identifier to a specific implementation. More... | |
virtual bool | parseParameters (Parameters ¶meters)=0 |
Parse the core::Block parameters. More... | |
virtual bool | addParameterMetadata (const ParameterMetadata ¶mMD)=0 |
Add a parameter metadata. More... | |
virtual bool | setPortsInfo (const InputPortsInfo &inputPortsInfo, const OutputPortsInfo &outputPortsInfo)=0 |
Set input / output ports information. More... | |
virtual Port::Info | getInputPortInfo (Port::Index idx) const =0 |
Get information of an input port. More... | |
virtual Port::Info | getOutputPortInfo (Port::Index idx) const =0 |
Get information of an output port. More... | |
virtual Port::Size::Vector | getInputPortWidth (const Port::Index idx) const =0 |
Get the size of a 1D input port. More... | |
virtual Port::Size::Vector | getOutputPortWidth (const Port::Index idx) const =0 |
Get the size of a 1D output port. More... | |
virtual Port::Size::Matrix | getInputPortMatrixSize (const Port::Index idx) const =0 |
Get the size of a 2D input port. More... | |
virtual Port::Size::Matrix | getOutputPortMatrixSize (const Port::Index idx) const =0 |
Get the size of a 2D output port. More... | |
virtual InputSignalPtr | getInputPortSignal (const Port::Index idx) const =0 |
Get the signal connected to an input input port. More... | |
virtual OutputSignalPtr | getOutputPortSignal (const Port::Index idx) const =0 |
Get the signal connected to an output port. More... | |
|
default |
|
virtualdefault |
|
pure virtual |
Add a parameter metadata.
In order to gather parameters from the running engine, the block must pass their metadata.
paramMD | The metadata to add. |
Implemented in blockfactory::mex::SimulinkBlockInformation, and blockfactory::coder::CoderBlockInformation.
|
pure virtual |
Get information of an input port.
idx | The index of the port. |
Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.
|
pure virtual |
Get the size of a 2D input port.
idx | The index of the port. |
Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.
|
pure virtual |
Get the signal connected to an input input port.
idx | The index of the port to which the signal is connected. |
nullptr
otherwise. Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.
|
pure virtual |
Get the size of a 1D input port.
idx | The index of the port. |
Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.
|
pure virtual |
Get information of an output port.
idx | The index of the port. |
Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.
|
pure virtual |
Get the size of a 2D output port.
idx | The index of the port. |
Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.
|
pure virtual |
Get the signal connected to an output port.
idx | The index of the port to which the signal is connected. |
nullptr
otherwise. Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.
|
pure virtual |
Get the size of a 1D output port.
idx | The index of the port. |
Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.
|
pure virtual |
Get the unique name of the block instance.
Retrive from the engine the unique name of the block. A typical example is the scoped name of the block that takes into account its location in the model hierarchy.
[out] | blockUniqueName | The unique name of the block instance. |
Implemented in blockfactory::mex::SimulinkBlockInformation, and blockfactory::coder::CoderBlockInformation.
|
pure virtual |
Convert a block option from its string identifier to a specific implementation.
[in] | key | Identifier of the block option. |
[out] | option | Implementation-specific block option. |
Implemented in blockfactory::mex::SimulinkBlockInformation, and blockfactory::coder::CoderBlockInformation.
|
pure virtual |
Parse the core::Block parameters.
This method allows defining how to gather block parameters from a specific implementation.
[out] | parameters | A container filled with the parsed parameters. |
Implemented in blockfactory::mex::SimulinkBlockInformation, and blockfactory::coder::CoderBlockInformation.
|
pure virtual |
Set input / output ports information.
Specify I/O ports information such as indices, dimensions, and datatype.
inputPortsInfo | Vector of core::Port::Info objects storing input port information. |
outputPortsInfo | Vector of core::Port::Info objects storing output port information. |
Implemented in blockfactory::coder::CoderBlockInformation, and blockfactory::mex::SimulinkBlockInformation.