diff --git a/examples/template/README.md b/examples/template/README.md index 31062e2..904cc9e 100644 --- a/examples/template/README.md +++ b/examples/template/README.md @@ -8,8 +8,7 @@ Template objects enables developers to describe how ARXML elements should be cre Think of it like recipes for ARXML elements. Most importantly it allows us to describe the dependencies between elements. This helps greatly when working in large scale projects with multiple developers. -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 -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)). +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)). ## Namespaces @@ -21,33 +20,33 @@ In short, namespaces handles the creation of packages while templates handles th ### Applying templates -Templates are applied to a workspace using the `Workspace.apply` method. +Templates are applied in a workspace using the `Workspace.apply` method. In general, applying template objects requires 4 steps. -1. Create an empty workspace object. +1. Create an empty workspace. 2. In the workspace, create one or more namespaces (a default is fine). -3. Call the Workspace.apply method with the template object as argument. -4. Save as ARXML +3. Call the `Workspace.apply` method with the template object as argument. +4. Save the workspace as ARXML During step 3, Python AUTOSAR not only creates the element itself, it automatically creates all elements that it depends on (data types, port interfaces, modes etc.). -In the two Python scripts in directory you will see examples how an entire ARXML project is generated from a single line of code: +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: ```python workspace.apply(component.CompositionComponent) ``` -This line of code creates all ARXML elements that the CompositionComponent depends on such as: +This will create all ARXML elements that the compositin SWC depends on such as: - Data types - Port interfaces - Constants - Mode declarations -- SWCs +- inner (or child) SWCs -If you look closely in the examples you will notice that it handles the platform base types differently. Normally, unused elements are skipped but -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. +If you look closely in the examples you will notice that it handles the platform types differently. Normally, unused elements are skipped but +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. ## Generation with config @@ -58,12 +57,12 @@ For a full example, see [generate_xml_using_config.py](generate_xml_using_config ## Generation without config -It is possible to accomplish the same result without using a config file. It requires a bit more code setting up the workspace. -See [generate_xml_withouf_config.py](generate_xml_without_config.py) for a full example. +It's possible to accomplish the same result without using a config file. It requires a bit more code setting up the workspace. +See [generate_xml_without_config.py](generate_xml_without_config.py) for a full example of that. ## Advantages and disadvantages using template objects -It's recommended to use templates in medium to large projects that has multiple team members. +It's recommended to use template objects in medium to large projects that has multiple team members. Advantages: diff --git a/examples/template/demo_system/README.md b/examples/template/demo_system/README.md index 390c1aa..2bc512c 100644 --- a/examples/template/demo_system/README.md +++ b/examples/template/demo_system/README.md @@ -5,20 +5,20 @@ This folder contains an example which demonstrates how the template mechanism is ## Software layers This example uses 3 layers. At the bottom we have the Python AUTOSAR XML API (This git repo). -The Factory layer enables an easy way to create commonly used elements such as data types and port-interfaces. +The [Factory](factory.py) layer enables an easy way to create commonly used elements such as data types and port-interfaces. It acts like an abstraction layer, hiding most of the low-level details seen in the Python AUTOSAR XML API. -| Template elements | -| Factory | -| Python AUTODSAR | +1. Template element layer +2. Factory layer +3. Python AUTOSAR XML layer ## components -The file components.py contains 3 example SWCs: +The file [components.py](components.py) contains 3 example SWCs: - ReceiverComponent (ApplicationSoftwareComponentType) - TimerComponent (ApplicationSoftwareComponentType) - CompositionComponent (CompositionSwComponentType) -The composition "CompositionComponent" contains the two application SWCs and create some connectors between them. +The composition "CompositionComponent" wraps the two application SWCs and create some connectors between them. The component TimerComponent provides a timer API (Client-server-interface) that the ReceiverComponent uses.