armodel 1.6.0__py3-none-any.whl → 1.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- armodel/cli/arxml_dump_cli.py +25 -22
- armodel/cli/arxml_format_cli.py +1 -4
- armodel/cli/connector_update_cli.py +1 -1
- armodel/cli/swc_list_cli.py +1 -1
- armodel/data_models/sw_connector.py +3 -3
- armodel/lib/sw_component.py +3 -1
- armodel/lib/system_signal.py +3 -1
- armodel/models/__init__.py +5 -3
- armodel/models/ar_object.py +1 -1
- armodel/models/ar_package.py +185 -151
- armodel/models/ar_ref.py +0 -202
- armodel/models/common_structure.py +3 -71
- armodel/models/communication.py +1 -1
- armodel/models/datatype.py +7 -72
- armodel/models/end_to_end_protection.py +1 -1
- armodel/models/general_structure.py +10 -4
- armodel/models/internal_behavior.py +1 -1
- armodel/models/m2/autosar_templates/autosar_top_level_structure.py +120 -0
- armodel/models/m2/autosar_templates/common_structure/implementation.py +21 -0
- armodel/models/m2/autosar_templates/common_structure/implementation_data_types.py +154 -0
- armodel/models/m2/autosar_templates/ecuc_description_template.py +2 -1
- armodel/models/m2/autosar_templates/generic_structure/__init__.py +0 -0
- armodel/models/m2/autosar_templates/generic_structure/abstract_structure.py +69 -0
- armodel/models/m2/autosar_templates/generic_structure/ar_package.py +528 -0
- armodel/models/m2/autosar_templates/sw_component_template/communication.py +44 -0
- armodel/models/m2/autosar_templates/sw_component_template/components/__init__.py +246 -0
- armodel/models/m2/autosar_templates/sw_component_template/components/instance_refs.py +33 -1
- armodel/models/m2/autosar_templates/sw_component_template/composition/__init__.py +154 -0
- armodel/models/m2/autosar_templates/sw_component_template/composition/instance_refs.py +157 -0
- armodel/models/m2/autosar_templates/sw_component_template/data_type/__init__.py +0 -0
- armodel/models/m2/autosar_templates/sw_component_template/data_type/data_prototypes.py +104 -0
- armodel/models/m2/autosar_templates/sw_component_template/port_interface/__init__.py +243 -0
- armodel/models/m2/autosar_templates/sw_component_template/port_interface/instance_refs.py +39 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/data_elements.py +3 -11
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/instance_refs_usage.py +169 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/mode_declaration_group.py +1 -2
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +5 -4
- armodel/models/m2/autosar_templates/system_template/instance_refs.py +48 -0
- armodel/models/m2_msr.py +1 -0
- armodel/models/port_prototype.py +1 -90
- armodel/models/service_needs.py +3 -1
- armodel/models/sw_component.py +6 -143
- armodel/parser/__init__.py +2 -1
- armodel/parser/abstract_arxml_parser.py +1 -1
- armodel/parser/arxml_parser.py +157 -80
- armodel/parser/connector_xlsx_parser.py +3 -1
- armodel/parser/file_parser.py +43 -0
- armodel/report/connector_xls_report.py +2 -1
- armodel/tests/test_armodel/models/test_ar_package.py +6 -3
- armodel/tests/test_armodel/models/test_ar_ref.py +15 -13
- armodel/tests/test_armodel/models/test_common_structure.py +6 -5
- armodel/tests/test_armodel/models/test_data_prototype.py +1 -1
- armodel/tests/test_armodel/models/test_datatype.py +9 -9
- armodel/tests/test_armodel/models/test_general_structure.py +1 -1
- armodel/tests/test_armodel/models/test_implementation.py +1 -1
- armodel/tests/test_armodel/models/test_port_interface.py +2 -2
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +3 -1
- armodel/tests/test_armodel/parser/test_sw_components.py +2 -2
- armodel/writer/abstract_arxml_writer.py +5 -1
- armodel/writer/arxml_writer.py +70 -60
- {armodel-1.6.0.dist-info → armodel-1.6.2.dist-info}/METADATA +5 -1
- {armodel-1.6.0.dist-info → armodel-1.6.2.dist-info}/RECORD +66 -51
- {armodel-1.6.0.dist-info → armodel-1.6.2.dist-info}/LICENSE +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.2.dist-info}/WHEEL +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.2.dist-info}/entry_points.txt +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.2.dist-info}/top_level.txt +0 -0
armodel/models/ar_ref.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from abc import ABCMeta
|
|
2
|
-
from typing import List
|
|
3
1
|
from .ar_object import ARObject
|
|
4
2
|
|
|
5
3
|
class RefType(ARObject):
|
|
@@ -25,203 +23,3 @@ class TRefType(RefType):
|
|
|
25
23
|
def __init__(self):
|
|
26
24
|
super().__init__()
|
|
27
25
|
|
|
28
|
-
class AnyInstanceRef(ARObject):
|
|
29
|
-
def __init__(self):
|
|
30
|
-
super().__init__()
|
|
31
|
-
|
|
32
|
-
self.baseRef = None # type: RefType
|
|
33
|
-
self.contextElementRef = None # type: RefType
|
|
34
|
-
self.targetRef = None # type: RefType
|
|
35
|
-
|
|
36
|
-
def getBaseRef(self) -> RefType:
|
|
37
|
-
return self.baseRef
|
|
38
|
-
|
|
39
|
-
def setBaseRef(self, value: RefType):
|
|
40
|
-
self.baseRef = value
|
|
41
|
-
return self
|
|
42
|
-
|
|
43
|
-
def getContextElementRef(self) -> RefType:
|
|
44
|
-
return self.contextElementRef
|
|
45
|
-
|
|
46
|
-
def setContextElementRef(self, value: RefType):
|
|
47
|
-
self.contextElementRef = value
|
|
48
|
-
return self
|
|
49
|
-
|
|
50
|
-
def getTargetRef(self) -> RefType:
|
|
51
|
-
return self.targetRef
|
|
52
|
-
|
|
53
|
-
def setTargetRef(self, value:RefType):
|
|
54
|
-
self.targetRef = value
|
|
55
|
-
return self
|
|
56
|
-
|
|
57
|
-
class AutosarVariableRef(ARObject):
|
|
58
|
-
def __init__(self):
|
|
59
|
-
super().__init__()
|
|
60
|
-
|
|
61
|
-
self.autosarVariableIRef = None # type: VariableInAtomicSWCTypeInstanceRef
|
|
62
|
-
self.autosarVariableInImplDatatype = None # type: ArVariableInImplementationDataInstanceRef
|
|
63
|
-
self.localVariableRef = None
|
|
64
|
-
|
|
65
|
-
def getAutosarVariableIRef(self):
|
|
66
|
-
return self.autosarVariableIRef
|
|
67
|
-
|
|
68
|
-
def setAutosarVariableIRef(self, value):
|
|
69
|
-
self.autosarVariableIRef = value
|
|
70
|
-
return self
|
|
71
|
-
|
|
72
|
-
def getAutosarVariableInImplDatatype(self):
|
|
73
|
-
return self.autosarVariableInImplDatatype
|
|
74
|
-
|
|
75
|
-
def setAutosarVariableInImplDatatype(self, value):
|
|
76
|
-
self.autosarVariableInImplDatatype = value
|
|
77
|
-
return self
|
|
78
|
-
|
|
79
|
-
def getLocalVariableRef(self):
|
|
80
|
-
return self.localVariableRef
|
|
81
|
-
|
|
82
|
-
def setLocalVariableRef(self, value):
|
|
83
|
-
self.localVariableRef = value
|
|
84
|
-
return self
|
|
85
|
-
|
|
86
|
-
class AutosarParameterRef(ARObject):
|
|
87
|
-
def __init__(self):
|
|
88
|
-
super().__init__()
|
|
89
|
-
|
|
90
|
-
self.autosar_parameter_iref = None # type: ParameterInAtomicSWCTypeInstanceRef
|
|
91
|
-
self.local_parameter_ref = None # type: RefType
|
|
92
|
-
|
|
93
|
-
class AtpInstanceRef(ARObject, metaclass=ABCMeta):
|
|
94
|
-
def __init__(self):
|
|
95
|
-
if type(self) == AtpInstanceRef:
|
|
96
|
-
raise NotImplementedError("AtpInstanceRef is an abstract class.")
|
|
97
|
-
|
|
98
|
-
super().__init__()
|
|
99
|
-
class VariableInAtomicSWCTypeInstanceRef(AtpInstanceRef):
|
|
100
|
-
def __init__(self):
|
|
101
|
-
super().__init__()
|
|
102
|
-
|
|
103
|
-
self.baseRef = None # type: RefType
|
|
104
|
-
self.contextDataPrototypeRefs = [] # type: List[RefType]
|
|
105
|
-
self.portPrototypeRef = None # type: RefType
|
|
106
|
-
self.rootVariableDataPrototypeRef = None # type: RefType
|
|
107
|
-
self.targetDataPrototypeRef = None # type: RefType
|
|
108
|
-
|
|
109
|
-
def getBaseRef(self):
|
|
110
|
-
return self.baseRef
|
|
111
|
-
|
|
112
|
-
def setBaseRef(self, value):
|
|
113
|
-
self.baseRef = value
|
|
114
|
-
return self
|
|
115
|
-
|
|
116
|
-
def getContextDataPrototypeRefs(self):
|
|
117
|
-
return self.contextDataPrototypeRefs
|
|
118
|
-
|
|
119
|
-
def addContextDataPrototypeRef(self, value):
|
|
120
|
-
self.contextDataPrototypeRefs.append(value)
|
|
121
|
-
return self
|
|
122
|
-
|
|
123
|
-
def getPortPrototypeRef(self):
|
|
124
|
-
return self.portPrototypeRef
|
|
125
|
-
|
|
126
|
-
def setPortPrototypeRef(self, value):
|
|
127
|
-
self.portPrototypeRef = value
|
|
128
|
-
return self
|
|
129
|
-
|
|
130
|
-
def getRootVariableDataPrototypeRef(self):
|
|
131
|
-
return self.rootVariableDataPrototypeRef
|
|
132
|
-
|
|
133
|
-
def setRootVariableDataPrototypeRef(self, value):
|
|
134
|
-
self.rootVariableDataPrototypeRef = value
|
|
135
|
-
return self
|
|
136
|
-
|
|
137
|
-
def getTargetDataPrototypeRef(self):
|
|
138
|
-
return self.targetDataPrototypeRef
|
|
139
|
-
|
|
140
|
-
def setTargetDataPrototypeRef(self, value):
|
|
141
|
-
self.targetDataPrototypeRef = value
|
|
142
|
-
return self
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
class PortInCompositionTypeInstanceRef(AtpInstanceRef, metaclass=ABCMeta):
|
|
146
|
-
def __init__(self):
|
|
147
|
-
if type(self) == PortInCompositionTypeInstanceRef:
|
|
148
|
-
raise NotImplementedError("PortInCompositionTypeInstanceRef is an abstract class.")
|
|
149
|
-
super().__init__()
|
|
150
|
-
|
|
151
|
-
self.abstract_context_component_ref = None # type: RefType
|
|
152
|
-
self.base_ref = None # type: RefType
|
|
153
|
-
self.target_port_ref = None # type: RefType
|
|
154
|
-
|
|
155
|
-
class PPortInCompositionInstanceRef(PortInCompositionTypeInstanceRef):
|
|
156
|
-
def __init__(self):
|
|
157
|
-
super().__init__()
|
|
158
|
-
self.context_component_ref = None # type: RefType
|
|
159
|
-
self.target_p_port_ref = None # type: RefType
|
|
160
|
-
|
|
161
|
-
class RPortInCompositionInstanceRef(PortInCompositionTypeInstanceRef):
|
|
162
|
-
def __init__(self):
|
|
163
|
-
super().__init__()
|
|
164
|
-
self.context_component_ref = None # type: RefType
|
|
165
|
-
self.target_r_port_ref = None # type: RefType
|
|
166
|
-
|
|
167
|
-
class ArVariableInImplementationDataInstanceRef(AtpInstanceRef):
|
|
168
|
-
def __init__(self):
|
|
169
|
-
super().__init__()
|
|
170
|
-
self.port_prototype_ref = None # type: RefType
|
|
171
|
-
self.target_data_prototype_ref = None # type: RefType
|
|
172
|
-
|
|
173
|
-
class OperationInAtomicSwcInstanceRef(AtpInstanceRef, metaclass=ABCMeta):
|
|
174
|
-
def __init__(self):
|
|
175
|
-
if type(self) == OperationInAtomicSwcInstanceRef:
|
|
176
|
-
raise NotImplementedError("OperationInAtomicSwcInstanceRef is an abstract class.")
|
|
177
|
-
super().__init__()
|
|
178
|
-
|
|
179
|
-
class POperationInAtomicSwcInstanceRef(OperationInAtomicSwcInstanceRef):
|
|
180
|
-
def __init__(self):
|
|
181
|
-
super().__init__()
|
|
182
|
-
self.context_p_port_ref = None # type: RefType
|
|
183
|
-
self.target_provided_operation_ref = None # type: RefType
|
|
184
|
-
|
|
185
|
-
class ROperationInAtomicSwcInstanceRef(OperationInAtomicSwcInstanceRef):
|
|
186
|
-
def __init__(self):
|
|
187
|
-
super().__init__()
|
|
188
|
-
self.context_r_port_ref = None # type: RefType
|
|
189
|
-
self.target_required_operation_ref = None # type: RefType
|
|
190
|
-
|
|
191
|
-
class ParameterInAtomicSWCTypeInstanceRef(AtpInstanceRef):
|
|
192
|
-
def __init__(self):
|
|
193
|
-
super().__init__()
|
|
194
|
-
|
|
195
|
-
self.base_ref = None # type: RefType
|
|
196
|
-
self.context_data_prototype_ref = None # type: RefType
|
|
197
|
-
self.port_prototype_ref = None # type: RefType
|
|
198
|
-
self.root_parameter_data_prototype_ref = None # type: RefType
|
|
199
|
-
self.target_data_prototype_ref = None # type: RefType
|
|
200
|
-
|
|
201
|
-
class ApplicationCompositeElementInPortInterfaceInstanceRef(AtpInstanceRef):
|
|
202
|
-
def __init__(self):
|
|
203
|
-
super().__init__()
|
|
204
|
-
|
|
205
|
-
self.base_ref = None # type: RefType
|
|
206
|
-
self.context_data_prototype_ref = None # type: RefType
|
|
207
|
-
self.root_data_prototype_ref = None # type: RefType
|
|
208
|
-
self.target_data_prototype_ref = None # type: RefType
|
|
209
|
-
|
|
210
|
-
class InnerPortGroupInCompositionInstanceRef(AtpInstanceRef):
|
|
211
|
-
def __init__(self):
|
|
212
|
-
super().__init__()
|
|
213
|
-
|
|
214
|
-
self.baseRef = None # type: RefType
|
|
215
|
-
self.contextRef = None # type: RefType
|
|
216
|
-
self.targetRef = None # type: RefType
|
|
217
|
-
|
|
218
|
-
class VariableDataPrototypeInSystemInstanceRef(AtpInstanceRef):
|
|
219
|
-
def __init__(self):
|
|
220
|
-
super().__init__()
|
|
221
|
-
|
|
222
|
-
self.base_ref = None # type: RefType
|
|
223
|
-
self.context_component_refs = [] # type: List[RefType]
|
|
224
|
-
self.context_composition_ref = None # type: RefType
|
|
225
|
-
self.context_port_ref = None # type: RefType
|
|
226
|
-
self.target_data_prototype_ref = None # type: RefType
|
|
227
|
-
|
|
@@ -10,74 +10,6 @@ from .ar_ref import RefType, TRefType
|
|
|
10
10
|
|
|
11
11
|
import re
|
|
12
12
|
|
|
13
|
-
class AbstractImplementationDataTypeElement(Identifiable):
|
|
14
|
-
def __init__(self, parent, short_name: str):
|
|
15
|
-
super().__init__(parent, short_name)
|
|
16
|
-
|
|
17
|
-
class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
|
|
18
|
-
ARRAY_SIZE_SEMANTICS_FIXED_SIZE = "FIXED-SIZE"
|
|
19
|
-
ARRAY_SIZE_SEMANTICS_VARIABLE_SIZE = "VARIABLE_SIZE"
|
|
20
|
-
|
|
21
|
-
def __init__(self, parent, short_name: str):
|
|
22
|
-
super().__init__(parent, short_name)
|
|
23
|
-
|
|
24
|
-
self.arrayImplPolicy = None # type: ARLiteral
|
|
25
|
-
self.arraySize = None # type: ARNumerical
|
|
26
|
-
self.arraySizeHandling = None # type: ARLiteral
|
|
27
|
-
self.arraySizeSemantics = None # type: ARLiteral
|
|
28
|
-
self.isOptional = None # type: ARBoolean
|
|
29
|
-
self.swDataDefProps = None # type: SwDataDefProps
|
|
30
|
-
|
|
31
|
-
def getArrayImplPolicy(self):
|
|
32
|
-
return self.arrayImplPolicy
|
|
33
|
-
|
|
34
|
-
def setArrayImplPolicy(self, value):
|
|
35
|
-
self.arrayImplPolicy = value
|
|
36
|
-
return self
|
|
37
|
-
|
|
38
|
-
def getArraySize(self):
|
|
39
|
-
return self.arraySize
|
|
40
|
-
|
|
41
|
-
def setArraySize(self, value):
|
|
42
|
-
self.arraySize = value
|
|
43
|
-
return self
|
|
44
|
-
|
|
45
|
-
def getArraySizeHandling(self):
|
|
46
|
-
return self.arraySizeHandling
|
|
47
|
-
|
|
48
|
-
def setArraySizeHandling(self, value):
|
|
49
|
-
self.arraySizeHandling = value
|
|
50
|
-
return self
|
|
51
|
-
|
|
52
|
-
def getArraySizeSemantics(self):
|
|
53
|
-
return self.arraySizeSemantics
|
|
54
|
-
|
|
55
|
-
def setArraySizeSemantics(self, value):
|
|
56
|
-
self.arraySizeSemantics = value
|
|
57
|
-
return self
|
|
58
|
-
|
|
59
|
-
def getIsOptional(self):
|
|
60
|
-
return self.isOptional
|
|
61
|
-
|
|
62
|
-
def setIsOptional(self, value):
|
|
63
|
-
self.isOptional = value
|
|
64
|
-
return self
|
|
65
|
-
|
|
66
|
-
def getSwDataDefProps(self):
|
|
67
|
-
return self.swDataDefProps
|
|
68
|
-
|
|
69
|
-
def setSwDataDefProps(self, value):
|
|
70
|
-
self.swDataDefProps = value
|
|
71
|
-
return self
|
|
72
|
-
|
|
73
|
-
def createImplementationDataTypeElement(self, short_name: str): # type: (...) -> ImplementationDataTypeElement
|
|
74
|
-
if (short_name not in self.elements):
|
|
75
|
-
event = ImplementationDataTypeElement(self, short_name)
|
|
76
|
-
self.elements[short_name] = event
|
|
77
|
-
return self.elements[short_name]
|
|
78
|
-
|
|
79
|
-
def getImplementationDataTypeElements(self): # type:(...) -> List[ImplementationDataTypeElement]
|
|
80
|
-
return list(filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values()))
|
|
81
13
|
|
|
82
14
|
class ExclusiveArea(Identifiable):
|
|
83
15
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -249,9 +181,9 @@ class MemorySection(Identifiable):
|
|
|
249
181
|
|
|
250
182
|
@alignment.setter
|
|
251
183
|
def alignment(self, value: ARLiteral):
|
|
252
|
-
if value is not None:
|
|
184
|
+
if value is not None and value.getValue() != "":
|
|
253
185
|
match = False
|
|
254
|
-
if value.
|
|
186
|
+
if value.getValue() in ("UNKNOWN", "UNSPECIFIED", "BOOLEAN", "PTR"):
|
|
255
187
|
self._alignment = value
|
|
256
188
|
match = True
|
|
257
189
|
else:
|
|
@@ -261,7 +193,7 @@ class MemorySection(Identifiable):
|
|
|
261
193
|
match = True
|
|
262
194
|
|
|
263
195
|
if not match:
|
|
264
|
-
raise ValueError("Invalid alignment <%s> of memory section <%s>" % (value, self.
|
|
196
|
+
raise ValueError("Invalid alignment <%s> of memory section <%s>" % (value, self.getShortName()))
|
|
265
197
|
|
|
266
198
|
def addOption(self, option: ARLiteral):
|
|
267
199
|
self.options.append(option)
|
armodel/models/communication.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
+
from .m2.autosar_templates.sw_component_template.port_interface.instance_refs import ApplicationCompositeElementInPortInterfaceInstanceRef
|
|
2
3
|
from .m2.msr.data_dictionary.data_def_properties import SwDataDefProps
|
|
3
|
-
from .ar_ref import ApplicationCompositeElementInPortInterfaceInstanceRef
|
|
4
4
|
from .ar_object import ARObject
|
|
5
5
|
|
|
6
6
|
class TransmissionAcknowledgementRequest(ARObject):
|
armodel/models/datatype.py
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
|
+
from .m2.msr.data_dictionary.data_def_properties import SwDataDefProps
|
|
4
5
|
from .ar_object import ARLiteral, ARNumerical
|
|
5
6
|
from .ar_ref import RefType
|
|
6
|
-
from .ar_package import Referrable
|
|
7
7
|
from .general_structure import ARElement, ARObject
|
|
8
|
-
from .
|
|
9
|
-
from .common_structure import
|
|
10
|
-
|
|
11
|
-
class ImplementationProps(Referrable, metaclass=ABCMeta):
|
|
12
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
13
|
-
if type(self) == ImplementationProps:
|
|
14
|
-
raise NotImplementedError("ImplementationProps is an abstract class.")
|
|
15
|
-
|
|
16
|
-
super().__init__(parent, short_name)
|
|
17
|
-
self.symbol = ""
|
|
18
|
-
|
|
19
|
-
class SymbolProps(ImplementationProps):
|
|
20
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
21
|
-
super().__init__(parent, short_name)
|
|
8
|
+
from .m2.autosar_templates.sw_component_template.data_type.data_prototypes import ApplicationCompositeElementDataPrototype, ApplicationRecordElement
|
|
9
|
+
from .common_structure import ModeRequestTypeMap
|
|
22
10
|
|
|
23
11
|
class BaseTypeDefinition(ARObject):
|
|
24
12
|
def __init__(self):
|
|
@@ -29,9 +17,9 @@ class BaseTypeDirectDefinition(BaseTypeDefinition):
|
|
|
29
17
|
super().__init__()
|
|
30
18
|
|
|
31
19
|
self.base_type_encoding = None
|
|
32
|
-
self.base_type_size = None
|
|
33
|
-
self.byteOrder = None
|
|
34
|
-
self.mem_alignment = None
|
|
20
|
+
self.base_type_size = None # type: ARNumerical
|
|
21
|
+
self.byteOrder = None # type: str
|
|
22
|
+
self.mem_alignment = None # type: ARNumerical
|
|
35
23
|
self.native_declaration = None
|
|
36
24
|
|
|
37
25
|
class BaseType(ARElement, metaclass=ABCMeta):
|
|
@@ -146,62 +134,9 @@ class ApplicationRecordDataType(ApplicationCompositeDataType):
|
|
|
146
134
|
def getApplicationRecordElements(self) -> List[ApplicationRecordElement]:
|
|
147
135
|
return self.record_elements
|
|
148
136
|
|
|
149
|
-
class AbstractImplementationDataType(AutosarDataType, metaclass=ABCMeta):
|
|
150
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
151
|
-
if type(self) == AbstractImplementationDataType:
|
|
152
|
-
raise NotImplementedError("AbstractImplementationDataType is an abstract class.")
|
|
153
|
-
|
|
154
|
-
super().__init__(parent, short_name)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
class ImplementationDataType(AbstractImplementationDataType):
|
|
158
|
-
CATEGORY_TYPE_REFERENCE = "TYPE_REFERENCE"
|
|
159
|
-
CATEGORY_TYPE_VALUE = "VALUE"
|
|
160
|
-
CATEGORY_TYPE_STRUCTURE = "STRUCTURE"
|
|
161
|
-
CATEGORY_DATA_REFERENCE = "DATA_REFERENCE"
|
|
162
|
-
CATEGORY_ARRAY = "ARRAY"
|
|
163
|
-
|
|
164
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
165
|
-
super().__init__(parent, short_name)
|
|
166
|
-
|
|
167
|
-
self.sub_elements = [] # type: List[str]
|
|
168
|
-
self.symbol_props = None # type: ARLiteral
|
|
169
|
-
self._type_emitter = None # type: ARLiteral
|
|
170
|
-
|
|
171
|
-
self._array_type = None # ImplementationDataType
|
|
172
|
-
|
|
173
|
-
#type: ImplementationDataTypeElement
|
|
174
|
-
def createImplementationDataTypeElement(self, short_name: str):
|
|
175
|
-
self.sub_elements.append(short_name)
|
|
176
|
-
if (short_name not in self.elements):
|
|
177
|
-
event = ImplementationDataTypeElement(self, short_name)
|
|
178
|
-
self.elements[short_name] = event
|
|
179
|
-
return self.elements[short_name]
|
|
180
|
-
|
|
181
|
-
def getImplementationDataTypeElements(self) -> List[ImplementationDataTypeElement]:
|
|
182
|
-
elements = []
|
|
183
|
-
for sub_element in self.sub_elements:
|
|
184
|
-
elements.append(self.elements[sub_element])
|
|
185
|
-
return elements
|
|
186
|
-
# return filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values())
|
|
187
|
-
|
|
188
|
-
def getArrayElementType(self) -> str:
|
|
189
|
-
return self._array_type
|
|
190
|
-
|
|
191
|
-
def setArrayElementType(self, type: str):
|
|
192
|
-
self._array_type = type
|
|
193
|
-
return self
|
|
194
|
-
|
|
195
|
-
def setTypeEmitter(self, emitter: str):
|
|
196
|
-
self._type_emitter = emitter
|
|
197
|
-
return self
|
|
198
|
-
|
|
199
|
-
def getTypeEmitter(self) -> str:
|
|
200
|
-
return self._type_emitter
|
|
201
|
-
|
|
202
|
-
|
|
203
137
|
class DataTypeMap(ARObject):
|
|
204
138
|
def __init__(self):
|
|
139
|
+
|
|
205
140
|
self.application_data_type_ref = None # type: RefType
|
|
206
141
|
self.implementation_data_type_ref = None # type: RefType
|
|
207
142
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import List
|
|
2
2
|
|
|
3
|
-
from .
|
|
3
|
+
from .m2.autosar_templates.system_template.instance_refs import VariableDataPrototypeInSystemInstanceRef
|
|
4
4
|
from .ar_object import ARNumerical, ARObject
|
|
5
5
|
from .general_structure import Identifiable
|
|
6
6
|
|
|
@@ -4,7 +4,7 @@ from typing import List
|
|
|
4
4
|
from .annotation import Annotation
|
|
5
5
|
from .ar_ref import RefType
|
|
6
6
|
from .multilanguage_data import MultiLanguageOverviewParagraph, MultilanguageLongName
|
|
7
|
-
from .ar_object import ARObject
|
|
7
|
+
from .ar_object import ARObject, ARLiteral
|
|
8
8
|
|
|
9
9
|
class Sd(ARObject):
|
|
10
10
|
def __init__(self):
|
|
@@ -108,7 +108,10 @@ class Referrable(ARObject, metaclass=ABCMeta):
|
|
|
108
108
|
@property
|
|
109
109
|
def full_name(self) -> str:
|
|
110
110
|
return self._parent.full_name + "/" + self.short_name
|
|
111
|
-
|
|
111
|
+
|
|
112
|
+
def getFullName(self) -> str:
|
|
113
|
+
return self.full_name
|
|
114
|
+
|
|
112
115
|
class MultilanguageReferrable(Referrable, metaclass = ABCMeta):
|
|
113
116
|
def __init__(self, parent: ARObject, short_name: str):
|
|
114
117
|
if type(self) == MultilanguageReferrable:
|
|
@@ -142,6 +145,9 @@ class CollectableElement(ARObject, metaclass = ABCMeta):
|
|
|
142
145
|
|
|
143
146
|
def getElements(self):
|
|
144
147
|
return self.elements.values()
|
|
148
|
+
|
|
149
|
+
def addElement(self, element: Referrable):
|
|
150
|
+
self.elements[element.getShortName()] = element
|
|
145
151
|
|
|
146
152
|
def getElement(self, short_name: str) -> Referrable:
|
|
147
153
|
if (short_name not in self.elements):
|
|
@@ -157,7 +163,7 @@ class Identifiable(MultilanguageReferrable, CollectableElement, metaclass=ABCMet
|
|
|
157
163
|
|
|
158
164
|
self.annotations = [] # type: List[Annotation]
|
|
159
165
|
self.adminData = None # type: AdminData
|
|
160
|
-
self.category = None
|
|
166
|
+
self.category = None # type: ARLiteral
|
|
161
167
|
self.desc = None # type: MultiLanguageOverviewParagraph
|
|
162
168
|
|
|
163
169
|
def getAdminData(self):
|
|
@@ -213,7 +219,7 @@ class Describable(ARObject, metaclass=ABCMeta):
|
|
|
213
219
|
return self._category
|
|
214
220
|
|
|
215
221
|
@category.setter
|
|
216
|
-
def category(self, value):
|
|
222
|
+
def category(self, value: ARLiteral):
|
|
217
223
|
self._category = value
|
|
218
224
|
|
|
219
225
|
class AtpFeature(Identifiable, metaclass=ABCMeta):
|
|
@@ -4,7 +4,7 @@ from typing import List
|
|
|
4
4
|
from .ar_object import ARLiteral, ARObject
|
|
5
5
|
from .ar_ref import RefType
|
|
6
6
|
from .common_structure import ExclusiveArea
|
|
7
|
-
from .
|
|
7
|
+
from .m2.autosar_templates.sw_component_template.data_type.data_prototypes import ParameterDataPrototype
|
|
8
8
|
from .general_structure import Identifiable
|
|
9
9
|
|
|
10
10
|
class IncludedDataTypeSet(ARObject):
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from typing import Dict, List
|
|
2
|
+
|
|
3
|
+
from .generic_structure.ar_package import ARPackage
|
|
4
|
+
from .common_structure.implementation_data_types import ImplementationDataType
|
|
5
|
+
|
|
6
|
+
from ...general_structure import Referrable, CollectableElement
|
|
7
|
+
|
|
8
|
+
from ...datatype import ApplicationDataType, DataTypeMap, SwBaseType
|
|
9
|
+
|
|
10
|
+
class AbstractAUTOSAR(CollectableElement):
|
|
11
|
+
def __init__(self):
|
|
12
|
+
super().__init__()
|
|
13
|
+
|
|
14
|
+
CollectableElement.__init__(self)
|
|
15
|
+
|
|
16
|
+
self.schema_location = ""
|
|
17
|
+
self._appl_impl_type_maps = {}
|
|
18
|
+
self._impl_appl_type_maps = {}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
self._ar_packages = {} # type: Dict[str, ARPackage]
|
|
22
|
+
self.short_name_mappings = {} # type: Dict[str, str]
|
|
23
|
+
|
|
24
|
+
def reload(self):
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def full_name(self):
|
|
29
|
+
return ""
|
|
30
|
+
|
|
31
|
+
def clear(self):
|
|
32
|
+
self._ar_packages = {}
|
|
33
|
+
self.elements = {}
|
|
34
|
+
|
|
35
|
+
def getElement(self, short_name: str) -> Referrable:
|
|
36
|
+
if (short_name in self._ar_packages):
|
|
37
|
+
return self._ar_packages[short_name]
|
|
38
|
+
return CollectableElement.getElement(self, short_name)
|
|
39
|
+
|
|
40
|
+
def getARPackages(self) -> List[ARPackage]:
|
|
41
|
+
#return list(filter(lambda e: isinstance(e, ARPackage), self.elements.values()))
|
|
42
|
+
return list(sorted(self._ar_packages.values(), key= lambda a: a.short_name))
|
|
43
|
+
|
|
44
|
+
def createARPackage(self, short_name: str) -> ARPackage:
|
|
45
|
+
if (short_name not in self._ar_packages):
|
|
46
|
+
ar_package = ARPackage(self, short_name)
|
|
47
|
+
self._ar_packages[short_name] = ar_package
|
|
48
|
+
return self._ar_packages[short_name]
|
|
49
|
+
|
|
50
|
+
def find(self, referred_name: str) -> Referrable:
|
|
51
|
+
short_name_list = referred_name.split("/")
|
|
52
|
+
element = AUTOSAR.getInstance()
|
|
53
|
+
for short_name in short_name_list:
|
|
54
|
+
if (short_name == ""):
|
|
55
|
+
continue
|
|
56
|
+
element = element.getElement(short_name)
|
|
57
|
+
if (element == None):
|
|
58
|
+
return element
|
|
59
|
+
# raise ValueError("The %s of reference <%s> does not exist." % (short_name, referred_name))
|
|
60
|
+
return element
|
|
61
|
+
|
|
62
|
+
def findByShortName(self, short_name: str) -> Referrable:
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
def getDataType(self, data_type: ImplementationDataType) -> ImplementationDataType:
|
|
66
|
+
if (isinstance(data_type, ImplementationDataType) or isinstance(data_type, SwBaseType)):
|
|
67
|
+
if (data_type.category == ImplementationDataType.CATEGORY_TYPE_REFERENCE):
|
|
68
|
+
referred_type = self.find(data_type.swDataDefProps.implementationDataTypeRef.value)
|
|
69
|
+
return self.getDataType(referred_type)
|
|
70
|
+
if (data_type.category == ImplementationDataType.CATEGORY_DATA_REFERENCE):
|
|
71
|
+
if (data_type.swDataDefProps.swPointerTargetProps.target_category == "VALUE"):
|
|
72
|
+
referred_type = self.find(data_type.swDataDefProps.swPointerTargetProps.sw_data_def_props.baseTypeRef.value)
|
|
73
|
+
return self.getDataType(referred_type)
|
|
74
|
+
return data_type
|
|
75
|
+
else:
|
|
76
|
+
raise ValueError("%s is not ImplementationDataType." % data_type)
|
|
77
|
+
|
|
78
|
+
def addDataTypeMap(self, data_type_map: DataTypeMap):
|
|
79
|
+
if (data_type_map.application_data_type_ref is None) or (data_type_map.implementation_data_type_ref is None):
|
|
80
|
+
return
|
|
81
|
+
self._appl_impl_type_maps[data_type_map.application_data_type_ref.value] = data_type_map.implementation_data_type_ref.value
|
|
82
|
+
self._impl_appl_type_maps[data_type_map.implementation_data_type_ref.value] = data_type_map.application_data_type_ref.value
|
|
83
|
+
|
|
84
|
+
def convertToImplementationDataType(self, appl_data_type: str) -> ImplementationDataType:
|
|
85
|
+
if (appl_data_type not in self._appl_impl_type_maps.keys()):
|
|
86
|
+
raise IndexError("Invalid application data type <%s>" % appl_data_type)
|
|
87
|
+
|
|
88
|
+
return self.find(self._appl_impl_type_maps[appl_data_type])
|
|
89
|
+
|
|
90
|
+
def convertToApplicationDataType(self, impl_data_type: str) -> ApplicationDataType:
|
|
91
|
+
if (impl_data_type not in self._impl_appl_type_maps.keys()):
|
|
92
|
+
raise IndexError("Invalid Implementation data type <%s>" % impl_data_type)
|
|
93
|
+
|
|
94
|
+
return self.find(self._impl_appl_type_maps[impl_data_type])
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class AUTOSAR (AbstractAUTOSAR):
|
|
98
|
+
__instance = None
|
|
99
|
+
|
|
100
|
+
@staticmethod
|
|
101
|
+
def getInstance():
|
|
102
|
+
if (AUTOSAR.__instance == None):
|
|
103
|
+
AUTOSAR()
|
|
104
|
+
return AUTOSAR.__instance
|
|
105
|
+
|
|
106
|
+
def new(self):
|
|
107
|
+
self.clear()
|
|
108
|
+
|
|
109
|
+
def __init__(self):
|
|
110
|
+
if (AUTOSAR.__instance != None):
|
|
111
|
+
raise Exception("The AUTOSAR is singleton!")
|
|
112
|
+
|
|
113
|
+
AUTOSAR.__instance = self
|
|
114
|
+
|
|
115
|
+
super().__init__()
|
|
116
|
+
|
|
117
|
+
class AUTOSARDoc(AbstractAUTOSAR):
|
|
118
|
+
def __init__(self):
|
|
119
|
+
super().__init__()
|
|
120
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from abc import ABCMeta
|
|
2
|
+
|
|
3
|
+
from ....ar_object import ARLiteral, ARObject
|
|
4
|
+
from ....general_structure import Referrable
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ImplementationProps(Referrable, metaclass = ABCMeta):
|
|
8
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
9
|
+
if type(self) == ImplementationProps:
|
|
10
|
+
raise NotImplementedError("ImplementationProps is an abstract class.")
|
|
11
|
+
|
|
12
|
+
super().__init__(parent, short_name)
|
|
13
|
+
|
|
14
|
+
self.symbol = None # type: ARLiteral
|
|
15
|
+
|
|
16
|
+
def getSymbol(self):
|
|
17
|
+
return self.symbol
|
|
18
|
+
|
|
19
|
+
def setSymbol(self, value):
|
|
20
|
+
self.symbol = value
|
|
21
|
+
return self
|