armodel 1.4.0__py3-none-any.whl → 1.4.3__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/__init__.py +2 -1
- armodel/cli/arxml_dump_cli.py +8 -6
- armodel/cli/arxml_format_cli.py +72 -0
- armodel/cli/connector_update_cli.py +11 -4
- armodel/data_models/__init__.py +0 -0
- armodel/data_models/sw_connector.py +22 -0
- armodel/lib/data_analyzer.py +1 -1
- armodel/models/__init__.py +3 -2
- armodel/models/annotation.py +20 -0
- armodel/models/ar_object.py +163 -18
- armodel/models/ar_package.py +110 -14
- armodel/models/ar_ref.py +62 -6
- armodel/models/bsw_module_template.py +97 -26
- armodel/models/calibration.py +107 -4
- armodel/models/common_structure.py +112 -37
- armodel/models/communication.py +10 -1
- armodel/models/data_def_properties.py +16 -0
- armodel/models/data_dictionary.py +46 -9
- armodel/models/data_prototype.py +24 -5
- armodel/models/datatype.py +69 -20
- armodel/models/end_to_end_protection.py +67 -0
- armodel/models/general_structure.py +25 -15
- armodel/models/global_constraints.py +4 -4
- armodel/models/implementation.py +80 -32
- armodel/models/m2_msr.py +6 -4
- armodel/models/multilanguage_data.py +42 -0
- armodel/models/per_instance_memory.py +14 -0
- armodel/models/port_interface.py +27 -4
- armodel/models/port_prototype.py +37 -17
- armodel/models/record_layout.py +118 -0
- armodel/models/service_mapping.py +11 -0
- armodel/models/service_needs.py +48 -0
- armodel/models/sw_component.py +224 -39
- armodel/parser/abstract_arxml_parser.py +248 -0
- armodel/parser/arxml_parser.py +1280 -810
- armodel/parser/connector_xlsx_parser.py +190 -0
- armodel/parser/excel_parser.py +18 -0
- armodel/tests/test_armodel/models/test_ar_object.py +152 -0
- armodel/tests/test_armodel/models/test_ar_package.py +1 -1
- armodel/tests/test_armodel/models/test_common_structure.py +2 -2
- armodel/tests/test_armodel/models/test_data_dictionary.py +7 -7
- armodel/tests/test_armodel/models/test_data_prototype.py +2 -2
- armodel/tests/test_armodel/models/test_datatype.py +4 -4
- armodel/tests/test_armodel/models/test_general_structure.py +1 -1
- armodel/tests/test_armodel/models/test_implementation.py +26 -0
- armodel/tests/test_armodel/models/test_m2_msr.py +4 -4
- armodel/tests/test_armodel/parser/test_arxml_parser.py +15 -0
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +70 -46
- armodel/tests/test_armodel/parser/test_sw_components.py +93 -0
- armodel/writer/abstract_arxml_writer.py +123 -0
- armodel/writer/arxml_writer.py +1464 -350
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/METADATA +90 -3
- armodel-1.4.3.dist-info/RECORD +78 -0
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/WHEEL +1 -1
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/entry_points.txt +2 -0
- armodel-1.4.0.dist-info/RECORD +0 -60
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/LICENSE +0 -0
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/top_level.txt +0 -0
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
from abc import ABCMeta
|
|
4
4
|
from typing import List
|
|
5
5
|
|
|
6
|
+
from .ar_object import ARFloat, ARLiteral, ARNumerical
|
|
6
7
|
from .general_structure import ARObject, ARElement, Identifiable
|
|
7
8
|
from .data_dictionary import SwDataDefProps
|
|
8
|
-
from .ar_ref import RefType
|
|
9
|
+
from .ar_ref import RefType, TRefType
|
|
9
10
|
|
|
10
11
|
import re
|
|
11
12
|
|
|
@@ -96,7 +97,7 @@ class NumericalValueSpecification(ValueSpecification):
|
|
|
96
97
|
def __init__(self):
|
|
97
98
|
super().__init__()
|
|
98
99
|
|
|
99
|
-
self.value = None # type:
|
|
100
|
+
self.value = None # type: ARFloat
|
|
100
101
|
|
|
101
102
|
class ArrayValueSpecification(ValueSpecification):
|
|
102
103
|
def __init__(self):
|
|
@@ -133,10 +134,10 @@ class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
|
|
|
133
134
|
def __init__(self, parent, short_name: str):
|
|
134
135
|
super().__init__(parent, short_name)
|
|
135
136
|
|
|
136
|
-
self.
|
|
137
|
-
self.array_size_semantics = None
|
|
138
|
-
self.
|
|
139
|
-
self.sw_data_def_props = None
|
|
137
|
+
self.arraySize = None # type: int
|
|
138
|
+
self.array_size_semantics = None # type: str
|
|
139
|
+
self.isOptional = None # type: bool
|
|
140
|
+
self.sw_data_def_props = None # type: SwDataDefProps
|
|
140
141
|
|
|
141
142
|
def createImplementationDataTypeElement(self, short_name: str): # type: (...) -> ImplementationDataTypeElement
|
|
142
143
|
if (short_name not in self.elements):
|
|
@@ -144,7 +145,7 @@ class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
|
|
|
144
145
|
self.elements[short_name] = event
|
|
145
146
|
return self.elements[short_name]
|
|
146
147
|
|
|
147
|
-
def getImplementationDataTypeElements(self): # type:(...) -> List[ImplementationDataTypeElement]
|
|
148
|
+
def getImplementationDataTypeElements(self): # type:(...) -> List[ImplementationDataTypeElement]
|
|
148
149
|
return list(filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values()))
|
|
149
150
|
|
|
150
151
|
class ExclusiveArea(Identifiable):
|
|
@@ -157,13 +158,13 @@ class InternalBehavior(Identifiable, metaclass=ABCMeta):
|
|
|
157
158
|
raise NotImplementedError("InternalBehavior is an abstract class.")
|
|
158
159
|
super().__init__(parent, short_name)
|
|
159
160
|
|
|
160
|
-
self.
|
|
161
|
+
self._dataTypeMappingRefs = [] # type: List[RefType]
|
|
161
162
|
|
|
162
163
|
def addDataTypeMappingRef(self, ref: RefType):
|
|
163
|
-
self.
|
|
164
|
+
self._dataTypeMappingRefs.append(ref)
|
|
164
165
|
|
|
165
166
|
def getDataTypeMappingRefs(self) -> List[RefType]:
|
|
166
|
-
return self.
|
|
167
|
+
return self._dataTypeMappingRefs
|
|
167
168
|
|
|
168
169
|
def createExclusiveArea(self, short_name: str) -> ExclusiveArea:
|
|
169
170
|
if (short_name not in self.elements):
|
|
@@ -178,7 +179,14 @@ class ModeDeclaration(Identifiable):
|
|
|
178
179
|
def __init__(self, parent: ARObject, short_name: str):
|
|
179
180
|
super().__init__(parent, short_name)
|
|
180
181
|
|
|
181
|
-
self.value =
|
|
182
|
+
self.value = None # type: ARNumerical
|
|
183
|
+
|
|
184
|
+
def setValue(self, value):
|
|
185
|
+
self.value = value
|
|
186
|
+
return self
|
|
187
|
+
|
|
188
|
+
def getValue(self) -> ARNumerical:
|
|
189
|
+
return self.value
|
|
182
190
|
|
|
183
191
|
class ExecutableEntity(Identifiable, metaclass=ABCMeta):
|
|
184
192
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -186,20 +194,22 @@ class ExecutableEntity(Identifiable, metaclass=ABCMeta):
|
|
|
186
194
|
raise NotImplementedError("ExecutableEntity is an abstract class.")
|
|
187
195
|
super().__init__(parent, short_name)
|
|
188
196
|
|
|
189
|
-
self.activation_reason = None
|
|
190
|
-
self.minimum_start_interval =
|
|
191
|
-
self.reentrancy_level = None
|
|
192
|
-
self.
|
|
197
|
+
self.activation_reason = None # *
|
|
198
|
+
self.minimum_start_interval = None # type: ARFloat
|
|
199
|
+
self.reentrancy_level = None #
|
|
200
|
+
self._can_enter_exclusive_area_refs = [] # type: List[RefType]
|
|
193
201
|
|
|
194
202
|
@property
|
|
195
203
|
def minimum_start_interval_ms(self) -> int:
|
|
196
|
-
|
|
204
|
+
if self.minimum_start_interval is not None:
|
|
205
|
+
return int(self.minimum_start_interval.getValue() * 1000)
|
|
206
|
+
return None
|
|
197
207
|
|
|
198
208
|
def addCanEnterExclusiveAreaRef(self, ref: RefType):
|
|
199
|
-
self.
|
|
209
|
+
self._can_enter_exclusive_area_refs.append(ref)
|
|
200
210
|
|
|
201
211
|
def getCanEnterExclusiveAreaRefs(self):
|
|
202
|
-
return self.
|
|
212
|
+
return self._can_enter_exclusive_area_refs
|
|
203
213
|
|
|
204
214
|
class ModeDeclarationGroupPrototype(Identifiable):
|
|
205
215
|
"""
|
|
@@ -208,44 +218,55 @@ class ModeDeclarationGroupPrototype(Identifiable):
|
|
|
208
218
|
|
|
209
219
|
def __init__(self, parent: ARObject, short_name: str):
|
|
210
220
|
super().__init__(parent, short_name)
|
|
211
|
-
|
|
212
|
-
self.
|
|
221
|
+
|
|
222
|
+
self._swCalibrationAccess = None # type: str
|
|
223
|
+
self.typeTRef = None # type: TRefType
|
|
213
224
|
|
|
214
225
|
@property
|
|
215
226
|
def sw_calibration_access(self):
|
|
216
|
-
return self.
|
|
227
|
+
return self._swCalibrationAccess
|
|
217
228
|
|
|
218
229
|
@sw_calibration_access.setter
|
|
219
230
|
def sw_calibration_access(self, value):
|
|
220
231
|
if (value not in ("notAccessible", "readOnly", "readWrite")):
|
|
221
232
|
raise ValueError("Invalid SwCalibrationAccess <%s> of ModeDeclarationGroupPrototype <%s>" % (value, self.short_name))
|
|
222
|
-
self.
|
|
233
|
+
self._swCalibrationAccess = value
|
|
223
234
|
|
|
224
235
|
class MemorySection(Identifiable):
|
|
225
236
|
def __init__(self, parent: ARObject, short_name: str):
|
|
226
237
|
super().__init__(parent, short_name)
|
|
227
238
|
|
|
228
|
-
self._alignment = None
|
|
229
|
-
self.
|
|
239
|
+
self._alignment = None # type: ARLiteral
|
|
240
|
+
self.size = None
|
|
241
|
+
self._options = [] # type: List[ARLiteral]
|
|
242
|
+
self.swAddrMethodRef = None # type: RefType
|
|
243
|
+
self.symbol = None # type: ARLiteral
|
|
244
|
+
|
|
245
|
+
def addOption(self, option: ARLiteral):
|
|
246
|
+
self._options.append(option)
|
|
247
|
+
|
|
248
|
+
def getOptions(self) -> List[ARLiteral]:
|
|
249
|
+
return self._options
|
|
230
250
|
|
|
231
251
|
@property
|
|
232
|
-
def alignment(self) ->
|
|
252
|
+
def alignment(self) -> ARLiteral:
|
|
233
253
|
return self._alignment
|
|
234
254
|
|
|
235
255
|
@alignment.setter
|
|
236
|
-
def alignment(self, value:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
match = True
|
|
241
|
-
else:
|
|
242
|
-
m = re.match(r'^\d+', value)
|
|
243
|
-
if m:
|
|
256
|
+
def alignment(self, value: ARLiteral):
|
|
257
|
+
if value is not None:
|
|
258
|
+
match = False
|
|
259
|
+
if value.value in ("UNKNOWN", "UNSPECIFIED", "BOOLEAN", "PTR"):
|
|
244
260
|
self._alignment = value
|
|
245
261
|
match = True
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
262
|
+
else:
|
|
263
|
+
m = re.match(r'^\d+', value.value)
|
|
264
|
+
if m:
|
|
265
|
+
self._alignment = value
|
|
266
|
+
match = True
|
|
267
|
+
|
|
268
|
+
if not match:
|
|
269
|
+
raise ValueError("Invalid alignment <%s> of memory section <%s>" % (value, self.short_name))
|
|
249
270
|
|
|
250
271
|
|
|
251
272
|
class ResourceConsumption(Identifiable):
|
|
@@ -262,4 +283,58 @@ class ResourceConsumption(Identifiable):
|
|
|
262
283
|
return list(filter(lambda a : isinstance(a, MemorySection), self.elements.values()))
|
|
263
284
|
|
|
264
285
|
def getMemorySection(self, short_name: str) -> MemorySection:
|
|
265
|
-
return next(filter(lambda o: isinstance(o, MemorySection) and (o.short_name == short_name), self.elements.values()), None)
|
|
286
|
+
return next(filter(lambda o: isinstance(o, MemorySection) and (o.short_name == short_name), self.elements.values()), None)
|
|
287
|
+
|
|
288
|
+
class Trigger(Identifiable):
|
|
289
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
290
|
+
super().__init__(parent, short_name)
|
|
291
|
+
|
|
292
|
+
self.swImplPolicy = None # type: str
|
|
293
|
+
self.triggerPeriod = None # type: float
|
|
294
|
+
|
|
295
|
+
class ModeRequestTypeMap(ARObject):
|
|
296
|
+
def __init__(self):
|
|
297
|
+
super().__init__()
|
|
298
|
+
|
|
299
|
+
self.implementation_data_type_ref = None # type: RefType
|
|
300
|
+
self.mode_group_ref = None # type: RefType
|
|
301
|
+
|
|
302
|
+
class ModeDeclarationGroup(Identifiable):
|
|
303
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
304
|
+
super().__init__(parent, short_name)
|
|
305
|
+
|
|
306
|
+
self._initial_mode_ref = None # type: RefType
|
|
307
|
+
self._on_transition_value = None # type: ARNumerical
|
|
308
|
+
|
|
309
|
+
def createModeDeclaration(self, short_name: str) -> ModeDeclaration:
|
|
310
|
+
if (short_name not in self.elements):
|
|
311
|
+
spec = ModeDeclaration(self, short_name)
|
|
312
|
+
self.elements[short_name] = spec
|
|
313
|
+
return self.elements[short_name]
|
|
314
|
+
|
|
315
|
+
def getModeDeclarations(self) -> List[ModeDeclaration]:
|
|
316
|
+
return list(sorted(filter(lambda a: isinstance(a, ModeDeclaration), self.elements.values()), key= lambda o:o.short_name))
|
|
317
|
+
|
|
318
|
+
def setInitialModeRef(self, ref: RefType):
|
|
319
|
+
self._initial_mode_ref = ref
|
|
320
|
+
return self
|
|
321
|
+
|
|
322
|
+
def getInitialModeRef(self) -> RefType:
|
|
323
|
+
return self._initial_mode_ref
|
|
324
|
+
|
|
325
|
+
def setOnTransitionValue(self, value):
|
|
326
|
+
if isinstance(value, int):
|
|
327
|
+
value = ARNumerical()
|
|
328
|
+
value.setValue(value)
|
|
329
|
+
self._on_transition_value = value
|
|
330
|
+
return self
|
|
331
|
+
|
|
332
|
+
def getOnTransitionValue(self) -> ARNumerical:
|
|
333
|
+
return self._on_transition_value
|
|
334
|
+
|
|
335
|
+
class ModeDeclarationGroupPrototype(Identifiable):
|
|
336
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
337
|
+
super().__init__(parent, short_name)
|
|
338
|
+
|
|
339
|
+
self.swCalibrationAccess = None # type: str
|
|
340
|
+
self.type_tref = None # type: TRefType
|
armodel/models/communication.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
from .data_dictionary import SwDataDefProps
|
|
3
|
+
from .ar_ref import ApplicationCompositeElementInPortInterfaceInstanceRef
|
|
4
|
+
from .ar_object import ARObject
|
|
2
5
|
|
|
3
6
|
class TransmissionAcknowledgementRequest(ARObject):
|
|
4
7
|
def __init__(self):
|
|
@@ -6,3 +9,9 @@ class TransmissionAcknowledgementRequest(ARObject):
|
|
|
6
9
|
|
|
7
10
|
self.timeout = None # type: float
|
|
8
11
|
|
|
12
|
+
class CompositeNetworkRepresentation(ARObject):
|
|
13
|
+
def __init__(self):
|
|
14
|
+
super().__init__()
|
|
15
|
+
|
|
16
|
+
self.leaf_element_iref = None # type: ApplicationCompositeElementInPortInterfaceInstanceRef
|
|
17
|
+
self.network_representation = None # type: SwDataDefProps
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from .ar_object import ARFloat, ARLiteral, ARObject
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ValueList(ARObject):
|
|
6
|
+
def __init__(self):
|
|
7
|
+
super().__init__()
|
|
8
|
+
|
|
9
|
+
self.v = None # type: ARFloat
|
|
10
|
+
self._vf = [] # type: List[ARLiteral]
|
|
11
|
+
|
|
12
|
+
def addVf(self, vf: ARLiteral):
|
|
13
|
+
self._vf.append(vf)
|
|
14
|
+
|
|
15
|
+
def getVfs(self) -> List[ARLiteral]:
|
|
16
|
+
return sorted(self._vf)
|
|
@@ -1,17 +1,44 @@
|
|
|
1
|
-
from
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from .ar_object import ARFloat, ARLiteral
|
|
4
|
+
from .calibration import SwCalprmAxisSet
|
|
5
|
+
from .annotation import Annotation
|
|
6
|
+
from .general_structure import ARObject, Identifiable
|
|
2
7
|
from .ar_ref import RefType
|
|
3
8
|
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SwDataDefPropsConditional(ARObject):
|
|
12
|
+
def __init__(self):
|
|
13
|
+
super().__init__()
|
|
14
|
+
|
|
4
15
|
class SwDataDefProps(ARObject):
|
|
5
16
|
def __init__(self):
|
|
6
17
|
super().__init__()
|
|
7
18
|
|
|
8
|
-
self.
|
|
9
|
-
self.
|
|
10
|
-
self.
|
|
11
|
-
self.
|
|
12
|
-
self.
|
|
13
|
-
self.
|
|
14
|
-
self.
|
|
19
|
+
self._annotations = [] # type: List[Annotation]
|
|
20
|
+
self.baseTypeRef = None # type: RefType
|
|
21
|
+
self.compuMethodRef = None # type: RefType
|
|
22
|
+
self.dataConstrRef = None # type: RefType
|
|
23
|
+
self.implementationDataTypeRef = None # type: RefType
|
|
24
|
+
self.swImplPolicy = None # type: str
|
|
25
|
+
self.swCalibrationAccess = None # type: str
|
|
26
|
+
self.swCalprmAxisSet = None # type: SwCalprmAxisSet
|
|
27
|
+
self.sw_pointer_target_props = None # type: SwPointerTargetProps
|
|
28
|
+
self.swRecordLayoutRef = None # type: RefType
|
|
29
|
+
self.valueAxisDataTypeRef = None # type: RefType
|
|
30
|
+
self.unitRef = None # type: RefType
|
|
31
|
+
self.conditional = SwDataDefPropsConditional() # type: SwDataDefPropsConditional
|
|
32
|
+
|
|
33
|
+
def addAnnotation(self, annotation: Annotation):
|
|
34
|
+
self._annotations.append(annotation)
|
|
35
|
+
|
|
36
|
+
def getAnnotations(self) -> List[Annotation]:
|
|
37
|
+
return self._annotations
|
|
38
|
+
|
|
39
|
+
def setUnitRef(self, ref: RefType):
|
|
40
|
+
self.unitRef = ref
|
|
41
|
+
return self
|
|
15
42
|
|
|
16
43
|
class SwPointerTargetProps(ARObject):
|
|
17
44
|
def __init__(self):
|
|
@@ -19,4 +46,14 @@ class SwPointerTargetProps(ARObject):
|
|
|
19
46
|
|
|
20
47
|
self.function_pointer_signature = None # type: RefType
|
|
21
48
|
self.sw_data_def_props = None # type: SwDataDefProps
|
|
22
|
-
self.target_category =
|
|
49
|
+
self.target_category = None
|
|
50
|
+
|
|
51
|
+
class SwAddrMethod(Identifiable):
|
|
52
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
53
|
+
super().__init__(parent, short_name)
|
|
54
|
+
|
|
55
|
+
self.memoryAllocationKeywordPolicy = None # type: MemoryAllocationKeywordPolicyType
|
|
56
|
+
self.option = [] # type: str
|
|
57
|
+
self.sectionInitializationPolicy = None # type: SectionInitializationPolicyType
|
|
58
|
+
self.sectionType = None # type: MemorySectionType
|
|
59
|
+
|
armodel/models/data_prototype.py
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
|
-
|
|
3
|
-
from .
|
|
2
|
+
|
|
3
|
+
from .ar_object import ARNumerical
|
|
4
4
|
from .ar_ref import RefType
|
|
5
|
+
from .data_dictionary import SwDataDefProps
|
|
6
|
+
from .common_structure import ValueSpecification
|
|
7
|
+
from .general_structure import AtpFeature, ARObject
|
|
5
8
|
|
|
6
9
|
class AtpPrototype(AtpFeature, metaclass = ABCMeta):
|
|
7
10
|
def __init__(self, parent:ARObject, short_name: str):
|
|
@@ -25,25 +28,41 @@ class AutosarDataPrototype(DataPrototype, metaclass = ABCMeta):
|
|
|
25
28
|
raise NotImplementedError("AutosarDataPrototype is an abstract class.")
|
|
26
29
|
|
|
27
30
|
super().__init__(parent, short_name)
|
|
28
|
-
|
|
31
|
+
|
|
32
|
+
self.type_tref = None
|
|
29
33
|
|
|
30
34
|
class VariableDataPrototype(AutosarDataPrototype):
|
|
31
35
|
def __init__(self, parent:ARObject, short_name: str):
|
|
32
36
|
super().__init__(parent, short_name)
|
|
33
37
|
|
|
38
|
+
self.init_value = None # type: ValueSpecification
|
|
39
|
+
|
|
34
40
|
class ApplicationCompositeElementDataPrototype(DataPrototype, metaclass = ABCMeta):
|
|
35
41
|
def __init__(self, parent:ARObject, short_name: str):
|
|
36
42
|
if type(self) == ApplicationCompositeElementDataPrototype:
|
|
37
43
|
raise NotImplementedError("ApplicationCompositeElementDataPrototype is an abstract class.")
|
|
38
44
|
|
|
39
45
|
super().__init__(parent, short_name)
|
|
40
|
-
|
|
46
|
+
|
|
47
|
+
self.typeTRef = None # type: RefType
|
|
41
48
|
|
|
42
49
|
class ApplicationArrayElement(ApplicationCompositeElementDataPrototype):
|
|
43
50
|
def __init__(self, parent:ARObject, short_name: str):
|
|
44
51
|
super().__init__(parent, short_name)
|
|
45
52
|
|
|
53
|
+
self.arraySizeHandling = None # type: str
|
|
54
|
+
self.arraySizeSemantics = None # type: str
|
|
55
|
+
self.indexDataTypeRef = None # type: RefType
|
|
56
|
+
self.maxNumberOfElements = None # type: ARNumerical
|
|
57
|
+
|
|
46
58
|
class ApplicationRecordElement(ApplicationCompositeElementDataPrototype):
|
|
47
59
|
def __init__(self, parent:ARObject, short_name: str):
|
|
48
60
|
super().__init__(parent, short_name)
|
|
49
|
-
|
|
61
|
+
|
|
62
|
+
self.isOptional = None
|
|
63
|
+
|
|
64
|
+
class ParameterDataPrototype(AutosarDataPrototype):
|
|
65
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
66
|
+
super().__init__(parent, short_name)
|
|
67
|
+
|
|
68
|
+
self.init_value = None # type: ValueSpecification
|
armodel/models/datatype.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
|
+
from .ar_object import ARLiteral, ARNumerical
|
|
5
|
+
from .ar_ref import RefType
|
|
4
6
|
from .ar_package import Referrable
|
|
5
|
-
from .general_structure import ARElement, ARObject
|
|
6
|
-
from .data_prototype import ApplicationRecordElement
|
|
7
|
+
from .general_structure import ARElement, ARObject, Identifiable
|
|
8
|
+
from .data_prototype import ApplicationCompositeElementDataPrototype, ApplicationRecordElement
|
|
7
9
|
from .data_dictionary import SwDataDefProps
|
|
8
|
-
from .common_structure import ImplementationDataTypeElement
|
|
9
|
-
|
|
10
|
+
from .common_structure import ImplementationDataTypeElement, ModeRequestTypeMap
|
|
10
11
|
|
|
11
12
|
class ImplementationProps(Referrable, metaclass=ABCMeta):
|
|
12
13
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -29,9 +30,9 @@ class BaseTypeDirectDefinition(BaseTypeDefinition):
|
|
|
29
30
|
super().__init__()
|
|
30
31
|
|
|
31
32
|
self.base_type_encoding = None
|
|
32
|
-
self.base_type_size = None
|
|
33
|
-
self.
|
|
34
|
-
self.mem_alignment = None
|
|
33
|
+
self.base_type_size = None # type: ARNumerical
|
|
34
|
+
self.byteOrder = None # type: str
|
|
35
|
+
self.mem_alignment = None # type: ARNumerical
|
|
35
36
|
self.native_declaration = None
|
|
36
37
|
|
|
37
38
|
class BaseType(ARElement, metaclass=ABCMeta):
|
|
@@ -41,7 +42,7 @@ class BaseType(ARElement, metaclass=ABCMeta):
|
|
|
41
42
|
|
|
42
43
|
super().__init__(parent, short_name)
|
|
43
44
|
|
|
44
|
-
self.
|
|
45
|
+
self.baseTypeDefinition = BaseTypeDirectDefinition()
|
|
45
46
|
|
|
46
47
|
class SwBaseType(BaseType):
|
|
47
48
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -84,15 +85,45 @@ class ApplicationCompositeDataType(ApplicationDataType, metaclass=ABCMeta):
|
|
|
84
85
|
|
|
85
86
|
super().__init__(parent, short_name)
|
|
86
87
|
|
|
88
|
+
class ApplicationArrayElement(ApplicationCompositeElementDataPrototype):
|
|
89
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
90
|
+
super().__init__(parent, short_name)
|
|
91
|
+
|
|
92
|
+
self.arraySizeHandling = None # type: str
|
|
93
|
+
self.arraySizeSemantics = None # type: str
|
|
94
|
+
self.indexDataTypeRef = None # type: RefType
|
|
95
|
+
self.maxNumberOfElements = None # type: ARNumerical
|
|
96
|
+
|
|
97
|
+
def setArraySizeHandling(self, handling: str):
|
|
98
|
+
self.arraySizeHandling = handling
|
|
99
|
+
return self
|
|
100
|
+
|
|
101
|
+
def setArraySizeSemantics(self, semantics: str):
|
|
102
|
+
self.arraySizeSemantics = semantics
|
|
103
|
+
return self
|
|
104
|
+
|
|
105
|
+
def setIndexDataTypeRef(self, ref: RefType):
|
|
106
|
+
self.indexDataTypeRef = ref
|
|
107
|
+
return self
|
|
108
|
+
|
|
109
|
+
def setMaxNumberOfElements(self, number: ARNumerical):
|
|
110
|
+
self.maxNumberOfElements = number
|
|
111
|
+
return self
|
|
87
112
|
|
|
88
113
|
class ApplicationArrayDataType(ApplicationCompositeDataType):
|
|
89
114
|
def __init__(self, parent: ARObject, short_name: str):
|
|
90
115
|
super().__init__(parent, short_name)
|
|
91
116
|
|
|
92
|
-
self.dynamic_array_size_profile =
|
|
93
|
-
self.element = None
|
|
94
|
-
|
|
117
|
+
self.dynamic_array_size_profile = None # type: ARLiteral
|
|
118
|
+
self.element = None # type: ApplicationArrayElement
|
|
95
119
|
|
|
120
|
+
def createApplicationArrayElement(self, short_name: str) -> ApplicationArrayElement:
|
|
121
|
+
if (short_name not in self.elements):
|
|
122
|
+
array_element = ApplicationArrayElement(self, short_name)
|
|
123
|
+
self.elements[short_name] = array_element
|
|
124
|
+
self.element = self.elements[short_name]
|
|
125
|
+
return self.elements[short_name]
|
|
126
|
+
|
|
96
127
|
class ApplicationRecordDataType(ApplicationCompositeDataType):
|
|
97
128
|
def __init__(self, parent: ARObject, short_name: str):
|
|
98
129
|
super().__init__(parent, short_name)
|
|
@@ -126,9 +157,10 @@ class ImplementationDataType(AbstractImplementationDataType):
|
|
|
126
157
|
|
|
127
158
|
def __init__(self, parent: ARObject, short_name: str):
|
|
128
159
|
super().__init__(parent, short_name)
|
|
129
|
-
|
|
130
|
-
self.
|
|
131
|
-
self.
|
|
160
|
+
|
|
161
|
+
self.sub_elements = [] # type: List[str]
|
|
162
|
+
self.symbol_props = None # type: ARLiteral
|
|
163
|
+
self._type_emitter = None # type: ARLiteral
|
|
132
164
|
|
|
133
165
|
self._array_type = None # ImplementationDataType
|
|
134
166
|
|
|
@@ -152,21 +184,38 @@ class ImplementationDataType(AbstractImplementationDataType):
|
|
|
152
184
|
|
|
153
185
|
def setArrayElementType(self, type: str):
|
|
154
186
|
self._array_type = type
|
|
187
|
+
return self
|
|
188
|
+
|
|
189
|
+
def setTypeEmitter(self, emitter: str):
|
|
190
|
+
self._type_emitter = emitter
|
|
191
|
+
return self
|
|
192
|
+
|
|
193
|
+
def getTypeEmitter(self) -> str:
|
|
194
|
+
return self._type_emitter
|
|
155
195
|
|
|
156
196
|
|
|
157
197
|
class DataTypeMap(ARObject):
|
|
158
198
|
def __init__(self):
|
|
159
|
-
self.application_data_type_ref = None
|
|
160
|
-
self.implementation_data_type_ref = None
|
|
161
|
-
|
|
199
|
+
self.application_data_type_ref = None # type: RefType
|
|
200
|
+
self.implementation_data_type_ref = None # type: RefType
|
|
162
201
|
|
|
163
202
|
class DataTypeMappingSet(ARElement):
|
|
164
203
|
def __init__(self, parent: ARObject, short_name: str):
|
|
165
204
|
super().__init__(parent, short_name)
|
|
166
|
-
|
|
205
|
+
|
|
206
|
+
self._dataTypeMaps = [] # type: List[DataTypeMap]
|
|
207
|
+
self._modeRequestTypeMaps = [] # type: List[ModeRequestTypeMap]
|
|
167
208
|
|
|
168
209
|
def addDataTypeMap(self, type_map: DataTypeMap):
|
|
169
|
-
self.
|
|
210
|
+
self._dataTypeMaps.append(type_map)
|
|
170
211
|
|
|
171
212
|
def getDataTypeMaps(self) -> List[DataTypeMap]:
|
|
172
|
-
return self.
|
|
213
|
+
return self._dataTypeMaps
|
|
214
|
+
|
|
215
|
+
def addModeRequestTypeMap(self, map: ModeRequestTypeMap):
|
|
216
|
+
self._modeRequestTypeMaps.append(map)
|
|
217
|
+
|
|
218
|
+
def getModeRequestTypeMaps(self) -> List[ModeRequestTypeMap]:
|
|
219
|
+
return self._modeRequestTypeMaps
|
|
220
|
+
|
|
221
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from .ar_ref import VariableDataPrototypeInSystemInstanceRef
|
|
4
|
+
from .ar_object import ARNumerical, ARObject
|
|
5
|
+
from .general_structure import Identifiable
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EndToEndDescription(ARObject):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__()
|
|
11
|
+
|
|
12
|
+
self.category = None # type: str
|
|
13
|
+
self.counterOffset = None # type: int
|
|
14
|
+
self.crcOffset = None # type: int
|
|
15
|
+
self.dataIds = [] # type: List[ARNumerical]
|
|
16
|
+
self.dataIdMode = None # type: int
|
|
17
|
+
self.dataIdNibbleOffset = None # type: int
|
|
18
|
+
self.dataLength = None # type: int
|
|
19
|
+
self.maxDeltaCounterInit = None # type: int
|
|
20
|
+
self.maxNoNewOrRepeatedData = None # type: int
|
|
21
|
+
self.syncCounterInit = None # type: int
|
|
22
|
+
|
|
23
|
+
def addDataId(self, id: ARNumerical):
|
|
24
|
+
self.dataIds.append(id)
|
|
25
|
+
|
|
26
|
+
def getDataIds(self) -> List[ARNumerical]:
|
|
27
|
+
return sorted(self.dataIds, key = lambda a: a)
|
|
28
|
+
|
|
29
|
+
class EndToEndProtectionVariablePrototype(ARObject):
|
|
30
|
+
def __init__(self):
|
|
31
|
+
super().__init__()
|
|
32
|
+
|
|
33
|
+
self._receiverIRefs = [] # type: List[VariableDataPrototypeInSystemInstanceRef]
|
|
34
|
+
self.senderIRef = None # type: VariableDataPrototypeInSystemInstanceRef
|
|
35
|
+
self.shortLabel = None # type: str
|
|
36
|
+
|
|
37
|
+
def addReceiverIref(self, iref: VariableDataPrototypeInSystemInstanceRef):
|
|
38
|
+
self._receiverIRefs.append(iref)
|
|
39
|
+
|
|
40
|
+
def getReceiverIrefs(self) -> List[VariableDataPrototypeInSystemInstanceRef]:
|
|
41
|
+
return self._receiverIRefs
|
|
42
|
+
|
|
43
|
+
class EndToEndProtection(Identifiable):
|
|
44
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
45
|
+
super().__init__(parent, short_name)
|
|
46
|
+
|
|
47
|
+
self.endToEndProfile = None # type: EndToEndDescription
|
|
48
|
+
self.endToEndProtectionVariablePrototype = [] # type: List[EndToEndProtectionVariablePrototype]
|
|
49
|
+
|
|
50
|
+
def addEndToEndProtectionVariablePrototype(self, prototype: EndToEndProtectionVariablePrototype):
|
|
51
|
+
self.endToEndProtectionVariablePrototype.append(prototype)
|
|
52
|
+
|
|
53
|
+
def getEndToEndProtectionVariablePrototypes(self) -> List[EndToEndProtectionVariablePrototype]:
|
|
54
|
+
return self.endToEndProtectionVariablePrototype
|
|
55
|
+
|
|
56
|
+
class EndToEndProtectionSet(Identifiable):
|
|
57
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
58
|
+
super().__init__(parent, short_name)
|
|
59
|
+
|
|
60
|
+
def createEndToEndProtection(self, short_name: str) -> EndToEndProtection:
|
|
61
|
+
if (short_name not in self.elements):
|
|
62
|
+
protection = EndToEndProtection(self, short_name)
|
|
63
|
+
self.elements[short_name] = protection
|
|
64
|
+
return self.elements[short_name]
|
|
65
|
+
|
|
66
|
+
def getEndToEndProtections(self) -> List[EndToEndProtection]:
|
|
67
|
+
return sorted(filter(lambda c: isinstance(c, EndToEndProtection), self.elements.values()), key= lambda e: e.short_name)
|