Skip to content

Commit 9386334

Browse files
kalu-ancastler
authored andcommitted
mw/com: migrate_umlet_to_plantuml__runtime
Closes #47 Issue: SWP-208704 GIT_ORIGIN_SPP_REV_ID: 9589a1ec09795702b678ca4d078571865579e2c7
1 parent 3f86459 commit 9386334

File tree

5 files changed

+129
-623
lines changed

5 files changed

+129
-623
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ creation/instantiation of binding specific runtimes is done by `impl::Runtime` w
2424

2525
The class diagram of this design is as follows:
2626

27-
<img src="broken_link_k/swh/ddad_score/mw/com/design/runtime/structural_view.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d" />
27+
<img src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/eclipse-score/communication/refs/heads/main/score/mw/com/design/runtime/runtime_structural_view.puml">
2828

2929
Since `impl::IRuntimeBinding` is only a **_very coarse grained_** interface and binding specific runtimes will have each
3030
very specific methods/types, the binding specific code, which needs to access its specific binding runtime needs to do
3131
a "downcast", when it gets a `IRuntimeBinding` instance from the binding independent `impl::Runtime`. The sequence is
3232
shown in the following sequence diagram:
3333

34-
<img src="broken_link_k/swh/ddad_score/mw/com/design/runtime/sequence_view.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d" />
34+
<img src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/eclipse-score/communication/refs/heads/main/score/mw/com/design/runtime/runtime_sequence_view.puml">
3535

3636
## Static dependencies
3737
Binding specific runtimes might use infrastructure in the form of static instances. E.g. the `lola::Runtime` uses
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@startuml runtime_sequence_view
2+
title "Sequence View Runtime"
3+
hide footbox
4+
5+
participant "<u>:impl::lola::<some class></u>" as lolaClass
6+
participant "<u>static:impl::Runtime</u>" as staticRuntime
7+
participant "singleton_instance:impl::Runtime" as runtimeInstance
8+
participant "<u>:impl::RuntimeBindingFactory</u>\n<<plumbing>>" as bindingFactory
9+
participant "<u>static:impl::lola::Runtime</u>" as staticLolaRuntime
10+
participant "<u>:impl::lola::Runtime</u>" as lolaRuntime
11+
12+
activate staticRuntime
13+
staticRuntime -> runtimeInstance : create(Configuration&)
14+
activate runtimeInstance
15+
16+
runtimeInstance -> bindingFactory : CreateBindingRuntimes(Configuration&)
17+
activate bindingFactory
18+
19+
bindingFactory -> bindingFactory : check via config, which binding runtimes to create
20+
21+
bindingFactory -> staticLolaRuntime : InitializeStaticDependencies()
22+
activate staticLolaRuntime
23+
staticLolaRuntime --> bindingFactory : return : void
24+
deactivate staticLolaRuntime
25+
26+
bindingFactory -> lolaRuntime : create(Configuration&)
27+
bindingFactory --> runtimeInstance : return : std::pair<>("loLa", std::unique_ptr<lola::Runtime>)
28+
deactivate bindingFactory
29+
30+
runtimeInstance --> staticRuntime : return : impl::Runtime instance
31+
deactivate runtimeInstance
32+
deactivate staticRuntime
33+
34+
activate lolaClass
35+
lolaClass -> staticRuntime : GetBindingRuntime(BindingType::LoLa)
36+
activate staticRuntime
37+
staticRuntime --> lolaClass : return : impl::IRuntimeBinding*
38+
deactivate staticRuntime
39+
40+
lolaClass -> lolaClass : dynamic_cast<impl::lola::Runtime*>(impl::IRuntimeBinding*)
41+
42+
lolaClass -> lolaRuntime : GetLoLaMessaging()
43+
activate lolaRuntime
44+
lolaRuntime --> lolaClass : return : impl::lola::IMessagePassingService&
45+
deactivate lolaRuntime
46+
deactivate lolaClass
47+
48+
@enduml
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
@startuml runtime_structural_view
2+
title "Structural View Runtime"
3+
4+
interface "mw::com::impl::IRuntime" as IRuntime {
5+
+{abstract} resolve(const InstanceSpecifier&) : std::vector<InstanceIdentifier>
6+
+{abstract} getBindingRuntime(BindingType binding) : IRuntimeBinding*
7+
}
8+
9+
enum BindingType {
10+
LoLa = 0
11+
Fake = 1
12+
}
13+
14+
class "mw::com::impl::Runtime" as Runtime {
15+
-runtime_bindings_ : std::unordered_map<BindingType, std::unique_ptr<IRuntimeBinding>>
16+
+{static} Initialize() : void
17+
+{static} Initialize(int argc, score::StringLiteral argv) : void
18+
+{static} Initialize(std::string const&) : void
19+
+{static} getInstance() : Runtime&
20+
+Runtime(Configuration&& config)
21+
+resolve(const InstanceSpecifier&) : std::vector<InstanceIdentifier>
22+
+getBindingRuntime(BindingType binding) : IRuntimeBinding*
23+
..
24+
<u>Notes:</u>
25+
Runtime is not copyable.
26+
}
27+
28+
class "mw::com::impl::RuntimeMock" as RuntimeMock {
29+
+resolve(const InstanceSpecifier&): std::vector<InstanceIdentifier>
30+
+GetBindingRuntime(BindingType binding): IRuntimeBinding*
31+
..
32+
Mock for unit-testing/mocking of Runtime func.
33+
}
34+
35+
interface "mw::com::impl::IRuntimeBinding" as IRuntimeBinding {
36+
+{abstract} GetBindingType() : BindingType
37+
+{abstract} GetServiceDiscoveryClient() : IServiceDiscoveryClient&
38+
+{abstract} GetTracingRuntime() : tracing::ITracingRuntimeBinding*
39+
}
40+
41+
class "mw::com::impl::RuntimeBindingFactory" as RuntimeBindingFactory << plumbing >> {
42+
+{static} CreateBindingRuntimes(configuration : Configuration&) : std::unordered_map<score::mw::com::impl::BindingType, std::unique_ptr<score::mw::com::impl::IRuntimeBinding>>
43+
}
44+
45+
interface "mw::com::impl::lola::IRuntime" as LolaIRuntime {
46+
+{abstract} HasAsilBSupport() : bool
47+
+{abstract} GetLolaMessaging() : lola::IMessagePassingService&
48+
+{abstract} GetShmSizeCalculationMode() : ShmSizeCalculationMode
49+
+{abstract} GetRollbackSynchronization() : RollbackSynchronization&
50+
+{abstract} GetPid() : pid_t
51+
+{abstract} GetUid() : uid_t
52+
}
53+
54+
class "mw::com::impl::lola:Runtime" as LolaRuntime {
55+
-lola_message_passing_control_ : lola::MessagePassingControl
56+
-lola_messaging_ : lola::MessagePassingFacade
57+
+GetLolaMessaging() : lola::IMessagePassingService&
58+
+HasAsilBSupport() : bool
59+
+GetMessagePassingCfg(const QualityType asil_level) : MessagePassingFacade::AsilSpecificCfg
60+
+GetRollbackSynchronization() : RollbackSynchronization&
61+
}
62+
63+
class "mw::com::impl::lola:RuntimeMock" as LolaRuntimeMock {
64+
+GetLolaMessaging() : lola::IMessagePassingService&
65+
+HasAsilBSupport() : bool
66+
}
67+
68+
IRuntime <|-- Runtime
69+
IRuntime <|-- RuntimeMock
70+
Runtime "1" *--> "0..n" IRuntimeBinding
71+
72+
IRuntimeBinding <|-- LolaIRuntime
73+
LolaIRuntime <|-- LolaRuntime
74+
LolaIRuntime <|-- LolaRuntimeMock
75+
76+
RuntimeBindingFactory ..> LolaRuntime : creates
77+
Runtime ..> RuntimeBindingFactory : uses
78+
79+
@enduml

0 commit comments

Comments
 (0)