You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: examples/template/README.md
+13-14
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,7 @@ Template objects enables developers to describe how ARXML elements should be cre
8
8
Think of it like recipes for ARXML elements.
9
9
Most importantly it allows us to describe the dependencies between elements. This helps greatly when working in large scale projects with multiple developers.
10
10
11
-
To assist with their creation, a template factory (see [factory.py](demo_system/factory.py)) needs to written by an experienced developer. New elements are then declared by calling on
12
-
the various factory methods. For example, a relatively complex data type can now be declared using a single line of Python code (see [datatype.py](demo_system/datatype.py)).
11
+
To assist with their creation, a template factory (see [factory.py](demo_system/factory.py)) needs to be written. New template objects are then declared by calling on the various factory methods. For example, a relatively complex data type can now be declared using a single line of Python code (see [datatype.py](demo_system/datatype.py)).
13
12
14
13
## Namespaces
15
14
@@ -21,33 +20,33 @@ In short, namespaces handles the creation of packages while templates handles th
21
20
22
21
### Applying templates
23
22
24
-
Templates are applied to a workspace using the `Workspace.apply` method.
23
+
Templates are applied in a workspace using the `Workspace.apply` method.
25
24
In general, applying template objects requires 4 steps.
26
25
27
-
1. Create an empty workspace object.
26
+
1. Create an empty workspace.
28
27
2. In the workspace, create one or more namespaces (a default is fine).
29
-
3. Call the Workspace.apply method with the template object as argument.
30
-
4. Save as ARXML
28
+
3. Call the `Workspace.apply` method with the template object as argument.
29
+
4. Save the workspace as ARXML
31
30
32
31
During step 3, Python AUTOSAR not only creates the element itself, it automatically creates all elements
33
32
that it depends on (data types, port interfaces, modes etc.).
34
33
35
-
In the two Python scripts in directory you will see examples how an entire ARXML project is generated from a single line of code:
34
+
In the two Python scripts found in this directory you will see examples how an entire ARXML project is generated from a single line of code:
36
35
37
36
```python
38
37
workspace.apply(component.CompositionComponent)
39
38
```
40
39
41
-
This line of code creates all ARXML elements that the CompositionComponent depends on such as:
40
+
This will create all ARXML elements that the compositin SWC depends on such as:
42
41
43
42
- Data types
44
43
- Port interfaces
45
44
- Constants
46
45
- Mode declarations
47
-
- SWCs
46
+
-inner (or child) SWCs
48
47
49
-
If you look closely in the examples you will notice that it handles the platform base types differently. Normally, unused elements are skipped but
50
-
this step forces the platform types to be created in the project even if they are unused/unreferenced. This is used as to not confuse the toolchain that will read the ARXML files later.
48
+
If you look closely in the examples you will notice that it handles the platform types differently. Normally, unused elements are skipped but
49
+
this special step forces them to be generated in the project even if they are unused/unreferenced. This is used as to not confuse the toolchain that will read the ARXML files later.
51
50
52
51
## Generation with config
53
52
@@ -58,12 +57,12 @@ For a full example, see [generate_xml_using_config.py](generate_xml_using_config
58
57
59
58
## Generation without config
60
59
61
-
It is possible to accomplish the same result without using a config file. It requires a bit more code setting up the workspace.
62
-
See [generate_xml_withouf_config.py](generate_xml_without_config.py) for a full example.
60
+
It's possible to accomplish the same result without using a config file. It requires a bit more code setting up the workspace.
61
+
See [generate_xml_without_config.py](generate_xml_without_config.py) for a full example of that.
63
62
64
63
## Advantages and disadvantages using template objects
65
64
66
-
It's recommended to use templates in medium to large projects that has multiple team members.
65
+
It's recommended to use template objects in medium to large projects that has multiple team members.
0 commit comments