Should one always return false in the ProcessTransferFunction when nothing of relevance happened? What is a failed transfer according to the code skeleton?
Current behavior
I wonder why the ProcessTransferFunction
of a behavior has to return a bool
value. The signature looks like this:
virtual bool ProcessTransferFunction() override;
If inspected the ib2c
plugin and found this code:
tTargetRating tModule::ProcessData()
{
// Process Transfer Function
const bool success = this->ProcessTransferFunction();
// Process TargetRating, iff success
if (success)
{
this->last_targetrating = this->CalculateTargetRating();
} // else, keep OLD target rating
return this->last_targetrating;
}
According of the code templates of finroc_create
, the return value states whether the transfer function was successful.
//----------------------------------------------------------------------
// mbb%%NAME%% ProcessTransferFunction
//----------------------------------------------------------------------
bool mbb%%NAME%%::ProcessTransferFunction()
{
Use your input and output ports to transfer data through this module.
Return whether this transfer was successful or not.
}
Expected behavior
I expected that the ProcessTransferFunction
does not return any data at all and the target rating is always recalculated.
It looks like we return false
in the ProcessTransferFunction
when nothing of relevance happened to this module.
But that does not necessarily imply that a transfer was not successful.
What is a failed transfer?
In any case, we should document the meaning of the return value in the plugin itself and not only the code generator.