Skip to content

Commit a9c0183

Browse files
add examples for codelinker
1 parent c5d8f24 commit a9c0183

File tree

1 file changed

+102
-53
lines changed

1 file changed

+102
-53
lines changed

process/process_areas/implementation/implementation_concept.rst

Lines changed: 102 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ both the requirements of ISO26262 Part-6 Chapter 8+9 and ASPICE SWE 3+4.
2626
Inputs
2727
******
2828

29-
#. ISO 26262 Part-6 Chapter 8+9
30-
#. ASPICE SWE 3+4
31-
#. Component Requirements :need:`wp__requirements_comp` and Architecture :need:`wp__component_arch`
32-
#. Software Development Plan :need:`gd_temp__software_development_plan`
29+
#. ISO 26262 Part-6 Chapter 8+9
30+
#. ASPICE SWE 3+4
31+
#. Component Requirements :need:`wp__requirements_comp` and Architecture :need:`wp__component_arch`
32+
#. Software Development Plan :need:`gd_temp__software_development_plan`
3333

3434
Outputs
3535
*******
@@ -44,9 +44,9 @@ Following the **Detailed Design Template** :need:`gd_temp__detailed_design`, we
4444
**design decisions** and **constraints** that guide the decomposition of the component into multiple
4545
units. These decisions should be made based on the following ideas:
4646

47-
- **Design principles**
48-
- **Design patterns**
49-
- **Testability strategies**
47+
- **Design principles**
48+
- **Design patterns**
49+
- **Testability strategies**
5050

5151
The goal is to ensure that the decomposition supports **reusability** , **maintainability**,
5252
**scalability**, **extensibility** and **ease of testing**.
@@ -63,10 +63,10 @@ derived from the decomposition of a component.
6363

6464
**Characteristics of a Unit**
6565

66-
- **Independent** – Can be tested in isolation.
67-
- **Granular** – Represents a small, well-defined part of the system.
68-
- **Relational** – Has associations with other units, defined using **UML 2.0 notations** such as
69-
aggregation, composition, and generalization.
66+
- **Independent** – Can be tested in isolation.
67+
- **Granular** – Represents a small, well-defined part of the system.
68+
- **Relational** – Has associations with other units, defined using **UML 2.0 notations** such as
69+
aggregation, composition, and generalization.
7070

7171
**Examples:**
7272
The definition of a unit depends on the used programming language. Examples for a unit are
@@ -75,20 +75,20 @@ This list is not complete or exclusive.
7575

7676
**Units in UML Diagrams**
7777

78-
- For **Rust development**, a **unit** is modeled using a **combination of `struct` and `trait`**,
79-
as Rust does not have traditional classes.
80-
78+
- **C++ development** Each **class** can be considered a **unit** in the design.
79+
- For **Rust development**, a **unit** is modeled using a **combination of `struct` and `trait`**,
80+
as Rust does not have traditional classes.
8181

8282
Static View
8383
```````````
8484
The **static view** represents the **units** and their relationships using **UML 2.0 notations**,
8585
such as **aggregation, composition, and generalization**. This is depicted through
8686
**UML structural diagrams**, including:
8787

88-
- **Class Diagrams** – Define **classes, attributes, methods, and relationships** (e.g., inheritance, associations, dependencies).
89-
Each **class** can be considered a **unit** in the design.
90-
- **Rust Development Approach** – Instead of traditional classes, **Rust uses `struct` and `trait`
91-
combinations** to represent **units** in UML diagrams.
88+
- **Class Diagrams** – Define **classes, attributes, methods, and relationships** (e.g., inheritance, associations, dependencies).
89+
Each **class** can be considered a **unit** in the design.
90+
- **Rust Development Approach** – Instead of traditional classes, **Rust uses `struct` and `trait`
91+
combinations** to represent **units** in UML diagrams.
9292

9393
This view focuses **only on units and their relationships**.
9494
Details such as **attributes and interfaces** are documented under the **Units within the Component section**
@@ -120,58 +120,107 @@ For each unit it will have a id and the interfaces are shown in the interface vi
120120
The description of unit and its attributes can be seen in the code documentation.
121121
For this we use the tracing to the documentation generated from the code comments.
122122

123-
We link the unit id to the comments in the code like -
123+
We link the unit id to the comments in the code like:
124+
125+
- Maintain your units in rst files and link them to the source code
126+
127+
Use `score_source_code_linker` from `docs-as-code` repo with
128+
`user docu <https://eclipse-score.github.io/docs-as-code/main/how-to/source_to_doc_links.html>`__.
129+
130+
In your rst file:
131+
132+
.. code-block:: rst
133+
134+
.. sw_unit:: cpp unit
135+
:id: sw_unit__<Component>__<title>
136+
137+
This implements the ....
138+
139+
In your cpp:
140+
141+
.. code-block:: cpp
142+
143+
# need-Id: sw_unit__<Component>__<title>
144+
class <class name> {
145+
public:
124146
125-
For cpp using doxygen style comments-
147+
};
126148
127-
.. code-block:: cpp
149+
- For cpp using doxygen style comments
128150

129-
/**
130-
* @rst
131-
* .. sw_unit:: cpp unit
132-
* :id: sw_unit__<Component>__<title>
133-
*
134-
* This implements the ....
135-
* @endrst
136-
*/
151+
.. code-block:: cpp
137152
138-
for rust -
153+
/**
154+
* @rst
155+
* .. sw_unit:: cpp unit
156+
* :id: sw_unit__<Component>__<title>
157+
*
158+
* This implements the ....
159+
* @endrst
160+
*/
139161
140-
.. code-block:: rust
162+
- for rust
141163

142-
//! .. sw_unit:: rust unit
143-
//! :id: sw_unit__<Component>__<title>
144-
//!
145-
//! This implements the ....
164+
.. code-block:: rust
165+
166+
//! .. sw_unit:: rust unit
167+
//! :id: sw_unit__<Component>__<title>
168+
//!
169+
//! This implements the ....
146170
147171
148172
Interface View
149173
``````````````
150174
For every unit, the Interface View should display the interfaces provided by that unit.
151175
For each unit and its corresponding interfaces, an implementation and documentation must
152-
be created. Since keeping both in sync can be challenging, it is recommended to generate
153-
the documentation from the implementation using appropriate tools.
176+
be created.
154177

155178
The following section provides templates for defining needs within the source code:
156179

157-
For cpp using doxygen comments-
180+
- Maintain your units in rst files and link them to the source code
181+
182+
Use `score_source_code_linker` from `docs-as-code` repo with
183+
`user docu <https://eclipse-score.github.io/docs-as-code/main/how-to/source_to_doc_links.html>`__.
184+
185+
In your rst file:
186+
187+
.. code-block:: rst
188+
189+
.. sw_unit_int:: <here InterfaceDemo - change it>
190+
:id: sw_unit_int__<Component>__<title>
191+
192+
This implements the ....
193+
194+
In your cpp:
195+
196+
.. code-block:: cpp
197+
198+
# need-Id: sw_unit__<Component>__<title>
199+
class InterfaceDemo
200+
{
201+
public:
202+
virtual ~InterfaceDemo() {}
203+
virtual void OverrideMe() = 0;
204+
};
205+
206+
- For cpp using doxygen comments
158207

159-
.. code-block:: cpp
208+
.. code-block:: cpp
160209
161-
/**
162-
* @rst
163-
* .. sw_unit_int:: cpp unit
164-
* :id: sw_unit_int__<Component>__<title>
165-
*
166-
* This implements the ....
167-
* @endrst
168-
*/
210+
/**
211+
* @rst
212+
* .. sw_unit_int:: cpp unit
213+
* :id: sw_unit_int__<Component>__<title>
214+
*
215+
* This implements the ....
216+
* @endrst
217+
*/
169218
170-
For rust -
219+
- For rust
171220

172-
.. code-block:: rust
221+
.. code-block:: rust
173222
174-
//! .. sw_unit_int:: rust unit
175-
//! :id: sw_unit_int__<Component>__<title>
176-
//!
177-
//! This implements the ....
223+
//! .. sw_unit_int:: rust unit
224+
//! :id: sw_unit_int__<Component>__<title>
225+
//!
226+
//! This implements the ....

0 commit comments

Comments
 (0)