Skip to content

Commit 7c7bd2a

Browse files
committed
mw/com: migrate_umlet_to_plantuml__skeleton_proxy
Co-authored-by: Mihai Haraga <mihai.haraga@continental-corporation.com> Signed-off-by: Andreas Kaluza <andreas.kaluza@continental.com> Closes eclipse-score#50 Issue: SWP-208704 GIT_ORIGIN_SPP_REV_ID: fb6bfec0b9ef4a66150cfecb7bc96cd06b489923
1 parent ce55d8e commit 7c7bd2a

File tree

8 files changed

+890
-3481
lines changed

8 files changed

+890
-3481
lines changed

score/mw/com/design/skeleton_proxy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ binding. The mechanism to initialize the `pImpl` is conceptually the same as wit
9090
The following sequence shows the instantiation of a service class up to its service offering based on our `LoLa`
9191
(shared-mem) binding:
9292

93-
![Skeleton Creation and Offer Sequence](broken_link_k/swh/ddad_score/mw/com/design/skeleton_proxy/skeleton_create_offer_seq.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d)
93+
![SKELETON_CREATE_OFFER_SEQ](broken_link_k/swh/safe-posix-platform/score/mw/com/design/skeleton_proxy/skeleton_create_offer_seq.puml")
9494

9595
#### Binding independent level Registration of skeleton events/fields at their parent skeleton
9696

score/mw/com/design/skeleton_proxy/generic_proxy/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Details about the concept of generic proxies can be found
1919
## LoLa supported feature set for Generic Proxies
2020

2121
Since `LoLa`s support for fields is restricted to only the event-functionality of fields, we will in a 1st step **only**
22-
implement event specific functionality for the `Generic Proxy`.
22+
implement event specific functionality for the `Generic Proxy`.
2323

2424
This comprises the following items:
25-
* `GenericProxy` class: We will provide a class `GenericProxy`, but opposed to the concept (linked above) **not** in
25+
* `GenericProxy` class: We will provide a class `GenericProxy`, but opposed to the concept (linked above) **not** in
2626
the `ara::com`, but in the `mw::com` namespace.
2727
* This `GenericProxy` class will (in relation to the concept) **only** provide a public method `GetEvents()`, which
2828
returns a `GenericProxy::EventMap` (which is a stripped down `std::map`)
@@ -101,7 +101,7 @@ specification) class (see [Sys-Req-13525992](broken_link_c/issue/13525992)), der
101101
`impl::ProxyBase` (like `DummyProxy` example) and contains one member `events_`, which is a map of
102102
`impl::GenericProxyEvent` in the form of `mw::com::EventMap`.
103103

104-
![Generic Proxy Extension](broken_link_k/swh/ddad_score/mw/com/design/skeleton_proxy/generic_proxy/generic_proxy_model.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d)
104+
![GENERIC_PROXY_MODEL](broken_link_k/swh/safe-posix-platform/score/mw/com/design/skeleton_proxy/generic_proxy/generic_proxy_model.puml")
105105

106106
Classes drawn with yellow background are extensions of the class diagram to support `GenericProxy` functionality beside
107107
"normal" proxies.
@@ -114,7 +114,7 @@ Both derive from `impl::ProxyEventBase`, which contains all the `SampleType` agn
114114
implementations a proxy-event needs to have.
115115
The method `GetNewSamples()` is `SampleType` specific (via its callback argument, which depends on the `SampleType`).
116116
Therefore, it isn't contained in `impl::ProxyEventBase` but specifically implemented in `impl::GenericProxyEvent` and
117-
`impl::ProxyEvent>SampleType>`.
117+
`impl::ProxyEvent>SampleType>`.
118118

119119
We have a similar setup on the binding side: `impl::GenericProxyEventBinding` has been introduced beside
120120
`impl::ProxyEventBinding>SampleType>` as abstract classes/interface definitions for "normal", respectively generic
@@ -135,4 +135,3 @@ Even if this hadn't been problematic (in terms of potential diamond pattern), we
135135
it due to the `ASIL-B` nature of our code base and the general avoidance pattern of multi-inheritance.
136136
To make sure, that the dispatch to `lola::ProxyEventCommon` is free from any overhead, we should take into account
137137
making all the methods of `lola::ProxyEventCommon` inline.
138-
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
@startuml generic_proxy_model
2+
title "Generic Proxy Extension"
3+
4+
class "score::mw::com::impl::HandleType" {
5+
-indentifier_: InstanceIdentifier
6+
+operator==(const HandleType& other): bool
7+
+operator<(const HandleType& other): bool
8+
+GetInstanceId(): InstanceIdentifier&
9+
+GetServiceInstanceDeployment(): ServiceInstanceDeployment&
10+
}
11+
12+
class "ProxyBindingFactory" {
13+
+{static} Create(HandleType handle): std::unique_ptr<ProxyBinding>
14+
+{static} CreateGeneric(HandleType handle, ServiceElementMap<GenericProxyEvent>& events): std::unique_ptr<ProxyBinding>
15+
+{static} FindService(InstanceIdentifier) : std::optional<HandleType>
16+
}
17+
18+
abstract class "score::mw::com::impl::ProxyBase" {
19+
-proxy_binding_ : std::unique_ptr<ProxyBinding>
20+
-handle_ : HandleType
21+
+{static} FindService(InstanceSpecifier): ServiceHandleContainer<HandleType>
22+
+{static} Preconstruct(const HandleType&): Result<ConstructionToken>
23+
+GetHandle() : const HandleType&
24+
..
25+
<u>Notes:</u>
26+
ProxyBase is not copyable but moveable
27+
}
28+
29+
abstract class "ProxyBinding" {
30+
+{abstract} IsEventProvided() = 0: bool
31+
}
32+
33+
class "mw::com::impl::GenericProxy" #yellow {
34+
using HandleType = ProxyBase::HandleType
35+
using EventMap = ServiceElementMap<GenericProxyEvent>
36+
..
37+
+GenericProxy(ConstructionToken&&)
38+
+GenericProxy(HandleType)
39+
+events_ : EventMap
40+
}
41+
42+
class "lola::Proxy" {
43+
+{static} Create(const LolaServiceInstanceDeployment& shm_binding, const LolaServiceTypeDeployment& service_deployment, QualityType quality_type) : Result<Proxy>
44+
+{static} Create(const LolaServiceInstanceDeployment& shm_binding, const LolaServiceTypeDeployment& service_deployment, QualityType quality_type, ServiceElementMap<GenericProxyEvent>&) : Result<Proxy>
45+
+Proxy(Proxy&&)
46+
+GetServiceHandles(instance_identifier : InstanceIdentifier) : score::Result<std::vector<HandleType>>
47+
+GetEventDataControl(element_fq_id : const ElementFqId) : EventDataControl*
48+
+GetRawDataStorage(element_fq_id : const ElementFqId) : void*
49+
+GetEventMetaInfo(element_fq_id : const ElementFqId) : const EventMetaInfo&
50+
+GetQualityType() : QualityType
51+
+GetSourcePid() : pid_t
52+
+{abstract} IsEventProvided(): bool
53+
}
54+
55+
class "mw::com::impl::ProxyEvent<SampleType>" {
56+
+ template <typename F> GetNewSamples(F&& receiver, size_t max_num_samples): Result<size_t>
57+
}
58+
59+
abstract class "ProxyEventBindingBase" {
60+
+{abstract} Subscribe(size_t maxSampleCount) = 0: void
61+
+{abstract} GetSubscriptionState() = 0: SubscriptionState
62+
+{abstract} Unsubscribe() = 0: void
63+
+{abstract} SetReceiveHandler(EventReceiveHandler handler) = 0: void
64+
+{abstract} UnsetReceiveHandler() = 0: void
65+
+{abstract} GetNumNewSamplesAvailable() = 0: Result<std::size_t>
66+
}
67+
68+
abstract class "ProxyEventBinding<SampleType>" {
69+
using Callback = score::cpp::callback<void(SamplePtr<SampleType>) noexcept>
70+
..
71+
+{abstract} GetNewSamples(Callback&&, TrackerGuardFactory&) = 0: Result<size_t>
72+
}
73+
74+
class "SampleReferenceTracker" {
75+
+SampleReferenceTracker()
76+
+SampleReferenceTracker(size_t max_num_samples)
77+
+GetNumAvailableSamples(): size_t
78+
+Allocate(size_t count) : TrackerGuardFactory
79+
+Reset(size_t new_max_count) : void
80+
+IsUsed() : bool
81+
}
82+
83+
class "lola::ProxyEvent<SampleType>" {
84+
+ProxyEvent(lola::Proxy& parent)
85+
+GetNewSamples(ProxyEventBinding::Callback&&, TrackerGuardFactory&): Result<size_t>
86+
-common_dispatch_ : lola::ProxyEventCommon
87+
..
88+
<u>Notes:</u>
89+
Dispatches all calls to functions in ProxyEventBindingBase interface to ProxyEventCommon
90+
}
91+
92+
class "ProxyEventBindingFactory" {
93+
+{static} template <typename SampleType> Create(ProxyBase& parent, std::string_view event_name): std::unique_ptr<ProxyEventBinding<SampleType>>
94+
+{static} <b>CreateGeneric(ProxyBase& parent, std::string_view event_name): std::unique_ptr<GenericProxyEventBinding></b>
95+
}
96+
97+
class "lola::SubscriptionStateMachine" {
98+
..
99+
<u>Notes:</u>
100+
State machine that manages subscriptions to a ProxyEvent.
101+
Details about the state machine can be found in
102+
proxy_event_state_machine.puml.
103+
}
104+
105+
class "ProxyBaseView" {
106+
+ProxyBaseView(proxy_base : ProxyBase&)
107+
+GetImpl() : ProxyBinding&
108+
}
109+
110+
class "lola::SlotCollector" {
111+
using SlotIndexVector = std::vector<EventDataControl::SlotIndexType>;
112+
..
113+
-event_data_control_: EventDataControl&
114+
-SlotCollector(EventDataControl&, const std::size_t max_slots)
115+
+GetNumNewSamplesAvailable(): size_t
116+
+GetNewSamplesSlotIndices(size_t max_count): pair<SlotIndexVector::const_reverse_iterator, SlotIndexVector::const_reverse_iterator>
117+
<u>Notes:</u>
118+
SlotCollector is not copyable.
119+
}
120+
121+
class "DummyProxy" <<generated>> {
122+
using HandleType = ProxyBase::HandleType
123+
..
124+
+DummyProxy(ConstructionToken&&)
125+
+DummyProxy(HandleType)
126+
+DummyEvent : events::DummyEvent
127+
}
128+
129+
abstract class "mw::com::impl::ProxyEventBase" #yellow {
130+
+ProxyEventBase(ProxyEventBindingBase&)
131+
+Subscribe(size_t max_sample_count): void
132+
+GetSubscriptionState() : SubscriptionState
133+
+Unsubscribe(): void
134+
+GetFreeSampleCount(): Result<size_t>
135+
+GetNumNewSamplesAvailable(): Result<std::size_t>
136+
+SetReceiveHandler(EventReceiveHandler handler) : void
137+
+UnsetReceiveHandler() : void
138+
}
139+
140+
class "mw::com::impl::GenericProxyEvent" #yellow {
141+
+GetSampleSize() const : std::size_t
142+
+HasSerializedFormat() const : bool
143+
+GetNewSamples(F&& receiver, size_t max_num_samples): Result<size_t>
144+
}
145+
146+
abstract class "GenericProxyEventBinding" #yellow {
147+
using Callback = score::cpp::callback<void(SamplePtr<void>) noexcept>
148+
..
149+
+GetSampleSize() const : std::size_t
150+
+HasSerializedFormat() const : bool
151+
+{abstract} GetNewSamples(Callback&&, size_t max_num_samples) = 0: Result<size_t>
152+
}
153+
154+
class "lola::ProxyEventCommon" #yellow {
155+
-element_fq_id_: ElementFqId
156+
-parent_: lola::Proxy&
157+
-subscription_event_state_machine_: std::shared_ptr<SubscriptionStateMachine>
158+
-slot_collector_: score::cpp::optional<SlotCollector>
159+
+ProxyEventCommon(lola::Proxy& parent, ElementFqId)
160+
+Subscribe(size_t max_sample_count): void
161+
+Unsubscribe(): void
162+
+GetSubscriptionState() : SubscriptionState
163+
+SetReceiveHandler(EventReceiveHandler handler) : void
164+
+UnsetReceiveHandler(EventReceiveHandler handler) : void
165+
+GetEventSourcePid() : pid_t
166+
+GetElementFQId() : ElementFqId
167+
+GetNumNewSamplesAvailable(): Result<std::size_t>
168+
+GetNewSamplesSlotIndices(size_t max_count): pair<SlotIndexVector::const_reverse_iterator, SlotIndexVector::const_reverse_iterator>
169+
..
170+
<u>Notes:</u>
171+
lola::ProxyEventCommon is not moveable or copyable.
172+
SlotCollector is instantiated by the SubscriptionStateMachine when it enters the
173+
Subscribed state. It is cleared if it subsequently leaves the Subscribed state.
174+
}
175+
176+
class "lola::GenericProxyEvent" #yellow {
177+
+GenericProxyEvent(lola::Proxy& parent)
178+
+GetNewSamples(GenericProxyEventBinding::Callback&&, TrackerGuardFactory&): Result<size_t>
179+
-common_dispatch_ : lola::ProxyEventCommon
180+
}
181+
182+
class "ServiceElementMap" {
183+
using key_type = score::cpp::stringview
184+
using mapped_type = GenericProxyEvent
185+
using value_type = std::pair<const key_type, mapped_type>
186+
using const_iterator = LegacyBidirectionalIterator to const value_type
187+
..
188+
+cbegin() : const_iterator
189+
+cend() : const_iterator
190+
+find() : const_iterator
191+
+size() : std::size_t
192+
+empty() : bool
193+
}
194+
195+
' Relationships
196+
"score::mw::com::impl::HandleType" <.. "score::mw::com::impl::ProxyBase" : uses
197+
198+
"score::mw::com::impl::ProxyBase" *--> "ProxyBinding"
199+
"score::mw::com::impl::ProxyBase" <|-- "DummyProxy"
200+
"score::mw::com::impl::ProxyBase" <|-- "mw::com::impl::GenericProxy"
201+
"mw::com::impl::GenericProxy" *-- "ServiceElementMap"
202+
"ProxyBindingFactory" ..> "ProxyBinding" : creates
203+
"ProxyBinding" <|-- "lola::Proxy"
204+
"lola::ProxyEventCommon" o-- "1" "lola::Proxy"
205+
"ProxyBindingFactory" <.. "mw::com::impl::GenericProxy" : uses
206+
"ProxyBindingFactory" <.. "DummyProxy" : uses
207+
"DummyProxy" *--> "mw::com::impl::ProxyEvent<SampleType>" : "0..n"
208+
"mw::com::impl::GenericProxy" *--> "mw::com::impl::GenericProxyEvent" : "0..n"
209+
"mw::com::impl::ProxyEventBase" *-- "SampleReferenceTracker"
210+
"mw::com::impl::ProxyEventBase" <|-- "mw::com::impl::ProxyEvent<SampleType>"
211+
"mw::com::impl::ProxyEventBase" <|-- "mw::com::impl::GenericProxyEvent"
212+
"SampleReferenceTracker" <.. "lola::ProxyEvent<SampleType>" : uses
213+
"SampleReferenceTracker" <.. "lola::GenericProxyEvent" : uses
214+
"GenericProxyEventBinding" --* "mw::com::impl::GenericProxyEvent" : "1"
215+
"ProxyEventBindingFactory" *-- "ProxyBaseView"
216+
"ProxyEventBindingFactory" ..> "ProxyEventBinding<SampleType>" : creates
217+
"mw::com::impl::ProxyEvent<SampleType>" ..> "ProxyEventBindingFactory" : uses
218+
"ProxyEventBinding<SampleType>" --* "mw::com::impl::ProxyEvent<SampleType>" : "1"
219+
220+
"GenericProxyEventBinding" <|-- "lola::GenericProxyEvent"
221+
222+
"ProxyEventBindingBase" <|-- "ProxyEventBinding<SampleType>"
223+
"ProxyEventBindingBase" <|-- "GenericProxyEventBinding"
224+
"ProxyEventBinding<SampleType>" <|-- "lola::ProxyEvent<SampleType>"
225+
226+
"lola::ProxyEvent<SampleType>" *-- "lola::ProxyEventCommon" : common_dispatch_
227+
"lola::GenericProxyEvent" *-- "lola::ProxyEventCommon" : common_dispatch_
228+
229+
"lola::SubscriptionStateMachine" --* "lola::ProxyEventCommon"
230+
231+
"lola::ProxyEventCommon" *-- "lola::SlotCollector" : slot_collector_
232+
233+
@enduml

0 commit comments

Comments
 (0)