cpp-common/bt2: make `SinkCompClsBridge::userCompFromLibSelfCompPtr` public
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 15 Feb 2024 21:19:17 +0000 (16:19 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 19 Feb 2024 18:10:15 +0000 (13:10 -0500)
`SinkCompClsBridge::userCompFromLibSelfCompPtr` needs to be public for
`CompClsBridgeWithInputPorts::inputPortConnected` to access it, for
instance.

Here's the error I got when trying to use `SinkCompClsBridge` in a
following patch, which lead to this fix:

      CXX      utils/run-in.lo
    In file included from /home/smarchi/src/babeltrace/src/cpp-common/bt2/component-class.hpp:12,
                     from /home/smarchi/src/babeltrace/tests/lib/utils/run-in.cpp:10:
    /home/smarchi/src/babeltrace/src/cpp-common/bt2/plugin-dev.hpp: In instantiation of 'static bt_component_class_port_connected_method_status bt2::internal::CompClsBridgeWithInputPorts<SpecCompClsBridgeT, LibTypesT>::inputPortConnected(typename LibTypesT::SelfComp*, bt_self_component_port_input*, const bt_port_output*) [with SpecCompClsBridgeT = bt2::internal::SinkCompClsBridge<{anonymous}::DummySink>; LibTypesT = bt2::internal::SinkCompClsLibTypes; bt_component_class_port_connected_method_status = bt_component_class_port_connected_method_status; typename LibTypesT::SelfComp = bt_self_component_sink; bt_self_component_port_input = bt_self_component_port_input; bt_port_output = bt_port_output]':
    /home/smarchi/src/babeltrace/src/cpp-common/bt2/component-class.hpp:477:88:   required from 'static bt2::internal::CommonSinkComponentClass<LibObjT>::Shared bt2::internal::CommonSinkComponentClass<LibObjT>::create() [with UserCompClsT = {anonymous}::DummySink; LibObjT = bt_component_class_sink; Shared = bt2::SharedObject<bt2::internal::CommonSinkComponentClass<bt_component_class_sink>, bt_component_class_sink, bt2::internal::SinkComponentClassRefFuncs>]'
    /home/smarchi/src/babeltrace/tests/lib/utils/run-in.cpp:141:72:   required from here
    /home/smarchi/src/babeltrace/src/cpp-common/bt2/plugin-dev.hpp:160:59: error: 'static UserCompClsT& bt2::internal::CompClsBridge<UserCompClsT, LibTypesT>::userCompFromLibSelfCompPtr(_LibSelfCompPtr) [with UserCompClsT = {anonymous}::DummySink; LibTypesT = bt2::internal::SinkCompClsLibTypes; _LibSelfCompPtr = bt_self_component_sink*]' is inaccessible within this context
      160 |             SpecCompClsBridgeT::userCompFromLibSelfCompPtr(libSelfCompPtr)
          |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
    /home/smarchi/src/babeltrace/src/cpp-common/bt2/plugin-dev.hpp:62:26: note: declared here
       62 |     static UserCompClsT& userCompFromLibSelfCompPtr(const _LibSelfCompPtr libSelfCompPtr) noexcept
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: If7dabf6280f3d861854dd21fa92f785f7176bd5e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11804
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/cpp-common/bt2/internal/comp-cls-bridge.hpp

index 5d64c4b4aa1e55d2bf544edfbd30158ccb00fc39..99d5bf777861f0defa9a26b254722eb781f84e90 100644 (file)
@@ -231,10 +231,9 @@ class SinkCompClsBridge final :
     public CompClsBridge<UserCompClsT, SinkCompClsLibTypes>,
     public CompClsBridgeWithInputPorts<SinkCompClsBridge<UserCompClsT>, SinkCompClsLibTypes>
 {
-private:
+public:
     using CompClsBridge<UserCompClsT, SinkCompClsLibTypes>::userCompFromLibSelfCompPtr;
 
-public:
     static bt_component_class_sink_consume_method_status
     consume(bt_self_component_sink * const libSelfCompPtr) noexcept
     {
This page took 0.026544 seconds and 4 git commands to generate.