Fix a few problems that were found by exercising the `plugin-dev.hpp`
code a bit more.
⚾ Use public inheritance in `SinkCompClsBridge`.
⚾ Add return statement in happy path of
`SinkCompClsBridge::graphIsConfigured`.
⚾ Use `DataT&` as the parameter type to `_addOutputPort` and
`_addInputPort` methods, matching what
`Self*Component::add*Port` expects.
⚾ Call `_outputPortConnected` instead of `outputPortConnected` in
`UserSourceComponent::outputPortConnected`, which otherwise results
in infinite recursion.
Change-Id: Ieab12436c4b85b5a33195be0ea388b3f545f07cd
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11789
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
template <typename UserCompClsT>
class SinkCompClsBridge final :
template <typename UserCompClsT>
class SinkCompClsBridge final :
- CompClsBridge<UserCompClsT, SinkCompClsLibTypes>,
- CompClsBridgeWithInputPorts<SinkCompClsBridge<UserCompClsT>, SinkCompClsLibTypes>
+ public CompClsBridge<UserCompClsT, SinkCompClsLibTypes>,
+ public CompClsBridgeWithInputPorts<SinkCompClsBridge<UserCompClsT>, SinkCompClsLibTypes>
{
private:
using CompClsBridge<UserCompClsT, SinkCompClsLibTypes>::userCompFromLibSelfCompPtr;
{
private:
using CompClsBridge<UserCompClsT, SinkCompClsLibTypes>::userCompFromLibSelfCompPtr;
{
try {
userCompFromLibSelfCompPtr(libSelfCompPtr).graphIsConfigured();
{
try {
userCompFromLibSelfCompPtr(libSelfCompPtr).graphIsConfigured();
+ return BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
} catch (const std::bad_alloc&) {
return BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR;
} catch (const Error&) {
} catch (const std::bad_alloc&) {
return BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR;
} catch (const Error&) {
void outputPortConnected(const SelfComponentOutputPort outputPort,
const ConstInputPort inputPort)
{
void outputPortConnected(const SelfComponentOutputPort outputPort,
const ConstInputPort inputPort)
{
- static_cast<UserComponentT&>(*this).outputPortConnected(outputPort, inputPort);
+ static_cast<UserComponentT&>(*this)._outputPortConnected(outputPort, inputPort);
}
template <typename DataT>
}
template <typename DataT>
- _OutputPorts::Port _addOutputPort(const bt2c::CStringView name, DataT * const data)
+ _OutputPorts::Port _addOutputPort(const bt2c::CStringView name, DataT& data)
{
return this->_selfComp().addOutputPort(name, data);
}
{
return this->_selfComp().addOutputPort(name, data);
}
}
template <typename DataT>
}
template <typename DataT>
- _OutputPorts::Port _addInputPort(const bt2c::CStringView name, DataT * const data)
+ _OutputPorts::Port _addInputPort(const bt2c::CStringView name, DataT& data)
{
return this->_selfComp().addInputPort(name, data);
}
{
return this->_selfComp().addInputPort(name, data);
}
}
template <typename DataT>
}
template <typename DataT>
- _OutputPorts::Port _addOutputPort(const bt2c::CStringView name, DataT * const data)
+ _OutputPorts::Port _addOutputPort(const bt2c::CStringView name, DataT& data)
{
return this->_selfComp().addOutputPort(name, data);
}
{
return this->_selfComp().addOutputPort(name, data);
}
}
template <typename DataT>
}
template <typename DataT>
- _InputPorts::Port _addInputPort(const bt2c::CStringView name, DataT * const data)
+ _InputPorts::Port _addInputPort(const bt2c::CStringView name, DataT& data)
{
return this->_selfComp().addInputPort(name, data);
}
{
return this->_selfComp().addInputPort(name, data);
}