diff --git a/score/mw/com/api_surface.lock.json b/score/mw/com/api_surface.lock.json index 3f640d3037..6c1252011b 100644 --- a/score/mw/com/api_surface.lock.json +++ b/score/mw/com/api_surface.lock.json @@ -819,12 +819,6 @@ "kind": "method", "signature": "GetReferenceToMoveable : typename ReferenceToMoveable::Reference &()" }, - { - "name": "GetSampleSize", - "qualified_name": "score::mw::com::GenericProxyEvent::GetSampleSize", - "kind": "method", - "signature": "GetSampleSize : std::size_t () const noexcept [[deprecated]]" - }, { "name": "HasSerializedFormat", "qualified_name": "score::mw::com::GenericProxyEvent::HasSerializedFormat", diff --git a/score/mw/com/dependability/requirements/component_requirements/component_requirements_ipc_generic_proxy.trlc b/score/mw/com/dependability/requirements/component_requirements/component_requirements_ipc_generic_proxy.trlc index 0d407017d7..22304f7129 100644 --- a/score/mw/com/dependability/requirements/component_requirements/component_requirements_ipc_generic_proxy.trlc +++ b/score/mw/com/dependability/requirements/component_requirements/component_requirements_ipc_generic_proxy.trlc @@ -34,7 +34,7 @@ section "com" { ScoreReq.CompReq EventTypeInfoSource { description = '''The type information for each of the events supported by a {{GenericProxy}} instance, shall be gathered from the shared memory data section published by the {{LoLa}} skeleton instance providing the service instance, the {{GenericProxy}} is connected with. - Note: This information is needed for the [GetSampleSize() API|ISSUE:14035184].''' + Note: This information is needed for the [GetDataTypeSizeInfo()].''' safety = ScoreReq.Asil.B derived_from = [Communication.EventType@1] version = 1 @@ -509,25 +509,10 @@ section "com" { version = 1 } - /* broken_link_c/issue/14035184 */ - /* GetSampleSize is deprecated in favor of GetDataTypeSizeInfo (see GenericProxyEventGetDataTypeSizeInfo), it will be removed in https://github.com/eclipse-score/communication/issues/975 */ - ScoreReq.CompReq GenericProxyEventGetSampleSize { - description = '''The {{GenericProxyEvent}} shall provide a public method: - - {{{std::size\_t GenericProxyEvent::GetSampleSize() const noexcept}}} - - Behaviour: {{GetSampleSize}} shall adhere to the re-entrancy and thread-safety specifications described in Re-entrancy and Thread-safety. - - Return value: returns the aligned size in bytes of the underlying event sample data type. I.e. in case the underlying data type is T, it shall return {{sizeof(T)}}.''' - safety = ScoreReq.Asil.B - derived_from = [Communication.EventType@1] - version = 1 - } - ScoreReq.CompReq GenericProxyEventGetDataTypeSizeInfo { description = '''The {{GenericProxyEvent}} shall provide a public method: - {{{memory::DataTypeSizeInfo GetDataTypeSizeInfo() const noexcept}}} + {{{memory::DataTypeSizeInfo GetDataTypeSizeInfo() const}}} Behaviour: {{GetDataTypeSizeInfo}} shall adhere to the re-entrance and thread-safety specifications described in Re-entrance and Thread-safety. @@ -727,16 +712,16 @@ section "com" { version = 1 } - ScoreReq.CompReq GenericProxyFieldGetSampleSize { + ScoreReq.CompReq GenericProxyFieldGetDataTypeSizeInfo { description = '''The {{GenericProxyField}} shall provide a public method: - {{{std::size_t GenericProxyField::GetSampleSize() const noexcept}}} + {{{memory::DataTypeSizeInfo GetDataTypeSizeInfo() const noexcept}}} - Behaviour: {{GetSampleSize}} shall adhere to the re-entrancy and thread-safety specifications described in Re-entrancy and Thread-safety. + Behaviour: {{GetDataTypeSizeInfo}} shall adhere to the re-entrance and thread-safety specifications described in Re-entrance and Thread-safety. - Return value: returns the aligned size in bytes of the underlying event sample data type. I.e. in case the underlying data type is T, it shall return {{sizeof(T)}}.''' + Return value: returns the data type size info (size in bites and alignment in bytes) of the underlying event sample data type.''' safety = ScoreReq.Asil.B - derived_from = [Communication.Field@1] + derived_from = [Communication.EventType@1] version = 1 } diff --git a/score/mw/com/dependability/safety_analysis/aou.trlc b/score/mw/com/dependability/safety_analysis/aou.trlc index 355e85e80e..28f20f24e9 100644 --- a/score/mw/com/dependability/safety_analysis/aou.trlc +++ b/score/mw/com/dependability/safety_analysis/aou.trlc @@ -303,7 +303,7 @@ ScoreReq.AoU SameCompilerSettingsForProviderAndConsumerSide { /* broken_link_c/issue/21209491 */ ScoreReq.AoU EventOrFieldReceptionViaGenericProxyNeedsSpecificCare { - description = "When receiving event or field data via untyped {{GenericProxyEvent}} or {{GenericProxyField}}, care has to be taken when accessing the corresponding {{SamplePtr}} delivered by calls to {{GetNewSamples()}}: When casting it to the expected type, it needs to be checked that no access behind the size returned by {{GetSampleSize()}} will happen." + description = "When receiving event or field data via untyped {{GenericProxyEvent}} or {{GenericProxyField}}, care has to be taken when accessing the corresponding {{SamplePtr}} delivered by calls to {{GetNewSamples()}}: When casting it to the expected type, it needs to be checked that no access behind the size returned by {{GetDataTypeSizeInfo().Size()}} will happen." safety = ScoreReq.Asil.B version = 1 mitigates = "" diff --git a/score/mw/com/dependability/safety_analysis/failure_modes.trlc b/score/mw/com/dependability/safety_analysis/failure_modes.trlc index b27fc01b64..e7f4e47b4b 100644 --- a/score/mw/com/dependability/safety_analysis/failure_modes.trlc +++ b/score/mw/com/dependability/safety_analysis/failure_modes.trlc @@ -721,7 +721,7 @@ section "LoLa" { version = 1 safety = ScoreReq.Asil.B rationale = "A manipulated size is tackled, by \"Size information in read-only memory\". The right location is ensured via \"Location of type-meta-information information for Generic Proxy\" The wrong set size, is covered by \"The type-meta-information shall be calculated based on the provided event/field type" - interface = "mw.com.GenericProxyEvent.GetSampleSize" + interface = "mw.com.GenericProxyEvent.GetDataTypeSizeInfo" } // ID: 31545538 @@ -733,7 +733,7 @@ section "LoLa" { safety = ScoreReq.Asil.B rationale = "Potential faults and measures are the same as [ISSUE:Failuremode TheSizeReturnedIsBiggerThenTheActualValue]" // potentialcause = "Same as [ISSUE:Failuremode TheSizeReturnedIsBiggerThenTheActualValue]" - interface = "mw.com.GenericProxyEvent.GetSampleSize" + interface = "mw.com.GenericProxyEvent.GetDataTypeSizeInfo" } // ID: 31545581 diff --git a/score/mw/com/dependability/safety_analysis/root_causes/proxy/BUILD b/score/mw/com/dependability/safety_analysis/root_causes/proxy/BUILD index 77a6f8c796..abcb7fab75 100644 --- a/score/mw/com/dependability/safety_analysis/root_causes/proxy/BUILD +++ b/score/mw/com/dependability/safety_analysis/root_causes/proxy/BUILD @@ -18,7 +18,7 @@ filegroup( "//score/mw/com/dependability/safety_analysis/root_causes/proxy/construction:construction_fta", "//score/mw/com/dependability/safety_analysis/root_causes/proxy/find_service:service_not_found_fta", "//score/mw/com/dependability/safety_analysis/root_causes/proxy/find_service:wrong_service_found_fta", - "//score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getsamplesize_from_generic_proxy_event:the_size_returned_is_bigger_then_the_actual_value_fta", + "//score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getdatatypedizeinfo_from_generic_proxy_event:the_size_returned_is_bigger_then_the_actual_value_fta", "//score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/getting_access_to_generic_proxy_events:map_containing_nonexistent_events_fta", "//score/mw/com/dependability/safety_analysis/root_causes/proxy/get_new_samples_on_an_event:callback_invoked_with_wrong_data_fta", "//score/mw/com/dependability/safety_analysis/root_causes/proxy/get_new_samples_on_an_event:callback_not_invoked_despite_samples_available_fta", diff --git a/score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getsamplesize_from_generic_proxy_event/BUILD b/score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getdatatypedizeinfo_from_generic_proxy_event/BUILD similarity index 100% rename from score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getsamplesize_from_generic_proxy_event/BUILD rename to score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getdatatypedizeinfo_from_generic_proxy_event/BUILD diff --git a/score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getsamplesize_from_generic_proxy_event/the_size_returned_is_bigger_then_actual_value_fta.puml b/score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getdatatypedizeinfo_from_generic_proxy_event/the_size_returned_is_bigger_then_actual_value_fta.puml similarity index 100% rename from score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getsamplesize_from_generic_proxy_event/the_size_returned_is_bigger_then_actual_value_fta.puml rename to score/mw/com/dependability/safety_analysis/root_causes/proxy/generic_proxy/generic_proxy_event/getdatatypedizeinfo_from_generic_proxy_event/the_size_returned_is_bigger_then_actual_value_fta.puml diff --git a/score/mw/com/design/skeleton_proxy/generic_proxy/generic_proxy_model.puml b/score/mw/com/design/skeleton_proxy/generic_proxy/generic_proxy_model.puml index dc1b62bfd2..dc92778a3b 100644 --- a/score/mw/com/design/skeleton_proxy/generic_proxy/generic_proxy_model.puml +++ b/score/mw/com/design/skeleton_proxy/generic_proxy/generic_proxy_model.puml @@ -142,7 +142,6 @@ abstract class "mw::com::impl::ProxyEventBase" #yellow { } class "mw::com::impl::GenericProxyEvent" #yellow { - +GetSampleSize() const : std::size_t +GetDataTypeSizeInfo() const : memory::DataTypeSizeInfo +HasSerializedFormat() const : bool +GetNewSamples(F&& receiver, size_t max_num_samples): Result @@ -151,7 +150,6 @@ class "mw::com::impl::GenericProxyEvent" #yellow { abstract class "GenericProxyEventBinding" #yellow { using Callback = score::cpp::callback) noexcept> .. - +GetSampleSize() const : std::size_t +GetDataTypeSizeInfo() const : memory::DataTypeSizeInfo +HasSerializedFormat() const : bool +{abstract} GetNewSamples(Callback&&, size_t max_num_samples) = 0: Result diff --git a/score/mw/com/impl/bindings/lola/generic_proxy_event.cpp b/score/mw/com/impl/bindings/lola/generic_proxy_event.cpp index f641e13208..c370a62d24 100644 --- a/score/mw/com/impl/bindings/lola/generic_proxy_event.cpp +++ b/score/mw/com/impl/bindings/lola/generic_proxy_event.cpp @@ -77,11 +77,6 @@ inline Result GenericProxyEvent::GetNewSamples(Callback&& receiver, return GetNewSamplesImpl(std::move(receiver), tracker); } -std::size_t GenericProxyEvent::GetSampleSize() const noexcept -{ - return meta_info_.data_type_info_.Size(); -} - memory::DataTypeSizeInfo GenericProxyEvent::GetDataTypeSizeInfo() const { return meta_info_.data_type_info_; diff --git a/score/mw/com/impl/bindings/lola/generic_proxy_event.h b/score/mw/com/impl/bindings/lola/generic_proxy_event.h index 54f645cbf2..1d35544455 100644 --- a/score/mw/com/impl/bindings/lola/generic_proxy_event.h +++ b/score/mw/com/impl/bindings/lola/generic_proxy_event.h @@ -63,7 +63,6 @@ class GenericProxyEvent final : public GenericProxyEventBinding SubscriptionState GetSubscriptionState() const noexcept override; Result GetNumNewSamplesAvailable() const override; Result GetNewSamples(Callback&& receiver, TrackerGuardFactory& tracker) override; - std::size_t GetSampleSize() const noexcept override; memory::DataTypeSizeInfo GetDataTypeSizeInfo() const override; bool HasSerializedFormat() const noexcept override; diff --git a/score/mw/com/impl/bindings/lola/generic_proxy_event_test.cpp b/score/mw/com/impl/bindings/lola/generic_proxy_event_test.cpp index beec2a18e6..cc31a9e160 100644 --- a/score/mw/com/impl/bindings/lola/generic_proxy_event_test.cpp +++ b/score/mw/com/impl/bindings/lola/generic_proxy_event_test.cpp @@ -60,42 +60,6 @@ TEST_F(LolaGenericProxyEventFixture, CanConstructAGenericProxyEvent) EXPECT_NE(generic_proxy_event_, nullptr); } -TEST_F(LolaGenericProxyEventFixture, GetSampleSize) -{ - RecordProperty("Verifies", "SCR-14035184"); - RecordProperty("Description", - "Checks that GetSampleSize will return the sample size of the underlying event data type."); - RecordProperty("TestType", "Requirements-based test"); - RecordProperty("Priority", "1"); - RecordProperty("DerivationTechnique", "Analysis of requirements"); - - // Given a valid GenericProxyEvent - WithAGenericProxyEvent(element_fq_id_, event_name_); - - // Expect, that asking about the Sample size, we get the sizeof the underlying event data type (which is - // std::uint32_t in case of LolaProxyEventResources) - EXPECT_EQ(generic_proxy_event_->GetSampleSize(), sizeof(SampleType)); -} - -TEST_F(LolaGenericProxyEventFixture, GetDataTypeSizeInfo) -{ - RecordProperty("lobster-tracing", "GenericProxyEventGetDataTypeSizeInfo"); - RecordProperty( - "Description", - "Checks that GetDataTypeSizeInfo will return the data type size info of the underlying event data type."); - RecordProperty("TestType", "Requirements-based test"); - RecordProperty("Priority", "1"); - RecordProperty("DerivationTechnique", "Analysis of requirements"); - - // Given a valid GenericProxyEvent - WithAGenericProxyEvent(element_fq_id_, event_name_); - - // Expect, that asking about the Sample size, we get the sizeof the underlying event data type (which is - // std::uint32_t in case of LolaProxyEventResources) - EXPECT_EQ(generic_proxy_event_->GetDataTypeSizeInfo().Alignment(), alignof(SampleType)); - EXPECT_EQ(generic_proxy_event_->GetDataTypeSizeInfo().Size(), sizeof(SampleType)); -} - TEST_F(LolaGenericProxyEventFixture, HasSerializedFormat) { RecordProperty("Verifies", "SCR-14035199"); diff --git a/score/mw/com/impl/bindings/mock_binding/generic_proxy_event.h b/score/mw/com/impl/bindings/mock_binding/generic_proxy_event.h index c7f8728cf2..67a32c37f8 100644 --- a/score/mw/com/impl/bindings/mock_binding/generic_proxy_event.h +++ b/score/mw/com/impl/bindings/mock_binding/generic_proxy_event.h @@ -48,7 +48,6 @@ class GenericProxyEvent : public GenericProxyEventBinding MOCK_METHOD(void, Unsubscribe, (), (noexcept, override)); MOCK_METHOD(Result, Subscribe, (std::size_t), (noexcept, override)); MOCK_METHOD(Result, GetNumNewSamplesAvailable, (), (const, noexcept, override)); - MOCK_METHOD(std::size_t, GetSampleSize, (), (const, noexcept, override)); MOCK_METHOD(memory::DataTypeSizeInfo, GetDataTypeSizeInfo, (), (const, noexcept, override)); MOCK_METHOD(bool, HasSerializedFormat, (), (const, noexcept, override)); MOCK_METHOD(Result, diff --git a/score/mw/com/impl/generic_proxy_event.cpp b/score/mw/com/impl/generic_proxy_event.cpp index a02c3875da..8666247d3e 100644 --- a/score/mw/com/impl/generic_proxy_event.cpp +++ b/score/mw/com/impl/generic_proxy_event.cpp @@ -37,14 +37,6 @@ GenericProxyEvent::GenericProxyEvent(const std::string_view event_name, { } -std::size_t GenericProxyEvent::GetSampleSize() const noexcept -{ - auto* const proxy_event_binding = dynamic_cast(binding_base_.get()); - SCORE_LANGUAGE_FUTURECPP_ASSERT_PRD_MESSAGE(proxy_event_binding != nullptr, - "Downcast to GenericProxyEventBinding failed!"); - return proxy_event_binding->GetSampleSize(); -} - memory::DataTypeSizeInfo GenericProxyEvent::GetDataTypeSizeInfo() const { auto* const proxy_event_binding = dynamic_cast(binding_base_.get()); diff --git a/score/mw/com/impl/generic_proxy_event.h b/score/mw/com/impl/generic_proxy_event.h index 8051536fe9..ab30fd8c8f 100644 --- a/score/mw/com/impl/generic_proxy_event.h +++ b/score/mw/com/impl/generic_proxy_event.h @@ -78,11 +78,6 @@ class GenericProxyEvent : public ProxyEventBase template Result GetNewSamples(F&& receiver, std::size_t max_num_samples) noexcept; - /// \brief return the (aligned) size in bytes of the underlying event sample data type. - /// \return size in bytes. - [[deprecated("Use GetDataTypeSizeInfo() for size and alignment information, issue #975")]] - std::size_t GetSampleSize() const noexcept; - /// \brief return the size and alignment information of the underlying event sample data type. memory::DataTypeSizeInfo GetDataTypeSizeInfo() const; diff --git a/score/mw/com/impl/generic_proxy_event_binding.h b/score/mw/com/impl/generic_proxy_event_binding.h index 26d450e20f..032b0e3f38 100644 --- a/score/mw/com/impl/generic_proxy_event_binding.h +++ b/score/mw/com/impl/generic_proxy_event_binding.h @@ -50,11 +50,6 @@ class GenericProxyEventBinding : public ProxyEventBindingBase /// \return Number of samples that were handed over to the callable. virtual Result GetNewSamples(Callback&& receiver, TrackerGuardFactory& tracker) = 0; - /// \brief return the (aligned) size in bytes of the underlying event sample data type. - /// \return size in bytes. - [[deprecated("Use GetDataTypeSizeInfo() for size and alignment information, issue #975")]] - virtual std::size_t GetSampleSize() const noexcept = 0; - /// \brief return the size and alignment information of the underlying event sample data type. virtual memory::DataTypeSizeInfo GetDataTypeSizeInfo() const = 0; diff --git a/score/mw/com/impl/generic_proxy_event_test.cpp b/score/mw/com/impl/generic_proxy_event_test.cpp index 17e059d5eb..9782a10c29 100644 --- a/score/mw/com/impl/generic_proxy_event_test.cpp +++ b/score/mw/com/impl/generic_proxy_event_test.cpp @@ -136,59 +136,6 @@ TEST(GenericProxyEventDeathTest, DieOnProxyDestructionWhileHoldingSamplePtrs) EXPECT_DEATH(proxy_event.reset(), ".*"); } -TEST(GenericProxyEventGetSampleSizeTest, GetSampleSizeDispatchesToBinding) -{ - RecordProperty("Verifies", "SCR-14035184"); - RecordProperty("Description", "Checks that GetSampleSize will return the sample size from the binding"); - RecordProperty("TestType", "Requirements-based test"); - RecordProperty("Priority", "1"); - RecordProperty("DerivationTechnique", "Analysis of requirements"); - - const std::size_t expected_sample_size{10U}; - - // Given a generic proxy event based on a mock binding - auto mock_proxy_event_ptr = std::make_unique>(); - auto& mock_proxy_event = *mock_proxy_event_ptr; - GenericProxyEvent proxy_event{kEventName, - std::unique_ptr{std::move(mock_proxy_event_ptr)}}; - - // Expect that GetSampleSize is called once on the binding - EXPECT_CALL(mock_proxy_event, GetSampleSize()).WillOnce(Return(expected_sample_size)); - - // When GetSampleSize is called on the proxy_event - const auto sample_size = proxy_event.GetSampleSize(); - - // Then the sample size will be the same value returned by the binding - EXPECT_EQ(sample_size, expected_sample_size); -} - -TEST(GenericProxyEventGetDataTypeSizeInfoTest, GetDataTypeSizeInfoDispatchesToBinding) -{ - RecordProperty("lobster-tracing", "GenericProxyEventGetDataTypeSizeInfo"); - RecordProperty("Description", - "Checks that GetDataTypeSizeInfo will return the data type size info from the binding"); - RecordProperty("TestType", "Requirements-based test"); - RecordProperty("Priority", "1"); - RecordProperty("DerivationTechnique", "Analysis of requirements"); - - const score::memory::DataTypeSizeInfo expected_data_type_size_info{12U, 4U}; - - // Given a generic proxy event based on a mock binding - auto mock_proxy_event_ptr = std::make_unique>(); - auto& mock_proxy_event = *mock_proxy_event_ptr; - GenericProxyEvent proxy_event{kEventName, - std::unique_ptr{std::move(mock_proxy_event_ptr)}}; - - // Expect that GetDataTypeSizeInfo is called once on the binding - EXPECT_CALL(mock_proxy_event, GetDataTypeSizeInfo()).WillOnce(Return(expected_data_type_size_info)); - - // When GetDataTypeSizeInfo is called on the proxy_event - const auto data_type_size_info = proxy_event.GetDataTypeSizeInfo(); - - // Then the data type size info will be the same value returned by the binding - EXPECT_EQ(data_type_size_info, expected_data_type_size_info); -} - TEST(GenericProxyEventHasSerializedFormatTest, HasSerializedFormatDispatchesToBinding) { RecordProperty("Verifies", "SCR-14035199");