From: Simon Marchi Date: Thu, 15 Feb 2024 21:19:17 +0000 (-0500) Subject: cpp-common/bt2: make `SinkCompClsBridge::userCompFromLibSelfCompPtr` public X-Git-Url: https://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=6216a78bea8d3832e682100ce0baf3f805de4908 cpp-common/bt2: make `SinkCompClsBridge::userCompFromLibSelfCompPtr` public `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::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::Shared bt2::internal::CommonSinkComponentClass::create() [with UserCompClsT = {anonymous}::DummySink; LibObjT = bt_component_class_sink; Shared = bt2::SharedObject, 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::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 Reviewed-on: https://review.lttng.org/c/babeltrace/+/11804 Reviewed-by: Philippe Proulx --- diff --git a/src/cpp-common/bt2/internal/comp-cls-bridge.hpp b/src/cpp-common/bt2/internal/comp-cls-bridge.hpp index 5d64c4b4..99d5bf77 100644 --- a/src/cpp-common/bt2/internal/comp-cls-bridge.hpp +++ b/src/cpp-common/bt2/internal/comp-cls-bridge.hpp @@ -231,10 +231,9 @@ class SinkCompClsBridge final : public CompClsBridge, public CompClsBridgeWithInputPorts, SinkCompClsLibTypes> { -private: +public: using CompClsBridge::userCompFromLibSelfCompPtr; -public: static bt_component_class_sink_consume_method_status consume(bt_self_component_sink * const libSelfCompPtr) noexcept {