Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions score/mw/com/api_surface.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -819,12 +819,6 @@
"kind": "method",
"signature": "GetReferenceToMoveable : typename ReferenceToMoveable<T>::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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion score/mw/com/dependability/safety_analysis/aou.trlc
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>}} 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<void>}} 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 = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>
Expand All @@ -151,7 +150,6 @@ class "mw::com::impl::GenericProxyEvent" #yellow {
abstract class "GenericProxyEventBinding" #yellow {
using Callback = score::cpp::callback<void(SamplePtr<void>) noexcept>
..
+GetSampleSize() const : std::size_t
+GetDataTypeSizeInfo() const : memory::DataTypeSizeInfo
+HasSerializedFormat() const : bool
+{abstract} GetNewSamples(Callback&&, size_t max_num_samples) = 0: Result<size_t>
Expand Down
5 changes: 0 additions & 5 deletions score/mw/com/impl/bindings/lola/generic_proxy_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ inline Result<std::size_t> 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_;
Expand Down
1 change: 0 additions & 1 deletion score/mw/com/impl/bindings/lola/generic_proxy_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class GenericProxyEvent final : public GenericProxyEventBinding
SubscriptionState GetSubscriptionState() const noexcept override;
Result<std::size_t> GetNumNewSamplesAvailable() const override;
Result<std::size_t> GetNewSamples(Callback&& receiver, TrackerGuardFactory& tracker) override;
std::size_t GetSampleSize() const noexcept override;
memory::DataTypeSizeInfo GetDataTypeSizeInfo() const override;
bool HasSerializedFormat() const noexcept override;

Expand Down
36 changes: 0 additions & 36 deletions score/mw/com/impl/bindings/lola/generic_proxy_event_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class GenericProxyEvent : public GenericProxyEventBinding
MOCK_METHOD(void, Unsubscribe, (), (noexcept, override));
MOCK_METHOD(Result<void>, Subscribe, (std::size_t), (noexcept, override));
MOCK_METHOD(Result<std::size_t>, 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<std::size_t>,
Expand Down
8 changes: 0 additions & 8 deletions score/mw/com/impl/generic_proxy_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<GenericProxyEventBinding*>(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<GenericProxyEventBinding*>(binding_base_.get());
Expand Down
5 changes: 0 additions & 5 deletions score/mw/com/impl/generic_proxy_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ class GenericProxyEvent : public ProxyEventBase
template <typename F>
Result<std::size_t> 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;

Expand Down
5 changes: 0 additions & 5 deletions score/mw/com/impl/generic_proxy_event_binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ class GenericProxyEventBinding : public ProxyEventBindingBase
/// \return Number of samples that were handed over to the callable.
virtual Result<std::size_t> 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;

Expand Down
53 changes: 0 additions & 53 deletions score/mw/com/impl/generic_proxy_event_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<StrictMock<mock_binding::GenericProxyEvent>>();
auto& mock_proxy_event = *mock_proxy_event_ptr;
GenericProxyEvent proxy_event{kEventName,
std::unique_ptr<GenericProxyEventBinding>{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<StrictMock<mock_binding::GenericProxyEvent>>();
auto& mock_proxy_event = *mock_proxy_event_ptr;
GenericProxyEvent proxy_event{kEventName,
std::unique_ptr<GenericProxyEventBinding>{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");
Expand Down
Loading