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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
from abc import ABCMeta
|
|
3
|
+
from .general_structure import Identifiable
|
|
4
|
+
from .ar_ref import AutosarVariableRef, AutosarParameterRef, RefType
|
|
5
|
+
from .ar_object import ARBoolean, ARLiteral, ARObject
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RoleBasedDataAssignment(ARObject):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__()
|
|
11
|
+
|
|
12
|
+
self.role = None # type: ARLiteral
|
|
13
|
+
self.used_data_element = None # type: AutosarVariableRef
|
|
14
|
+
self.used_parameter_element = None # type: AutosarParameterRef
|
|
15
|
+
self.used_pim_ref = None # type: RefType
|
|
16
|
+
|
|
17
|
+
class ServiceNeeds(Identifiable, metaclass = ABCMeta):
|
|
18
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
19
|
+
if type(self) == ServiceNeeds:
|
|
20
|
+
raise NotImplementedError("ServiceNeeds is an abstract class.")
|
|
21
|
+
|
|
22
|
+
super().__init__(parent, short_name)
|
|
23
|
+
|
|
24
|
+
class NvBlockNeeds(ServiceNeeds):
|
|
25
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
26
|
+
super().__init__(parent, short_name)
|
|
27
|
+
|
|
28
|
+
self.calc_ram_block_crc = None # type: ARBoolean
|
|
29
|
+
self.check_static_block_id = None # type: ARBoolean
|
|
30
|
+
self.n_data_sets = None # type: int
|
|
31
|
+
self.n_rom_blocks = None # type: int
|
|
32
|
+
self.ram_block_status_control = None # type: str
|
|
33
|
+
self.readonly = None # type: ARBoolean
|
|
34
|
+
self.reliability = None # type: str
|
|
35
|
+
self.resistant_to_changed_sw = None # type: ARBoolean
|
|
36
|
+
self.restore_at_start = None # type: ARBoolean
|
|
37
|
+
self.select_block_for_first_init_all = None # type: ARBoolean
|
|
38
|
+
self.store_at_shutdown = None # type: ARBoolean
|
|
39
|
+
self.store_cyclic = None # type: ARBoolean
|
|
40
|
+
self.store_emergency = None # type: ARBoolean
|
|
41
|
+
self.store_immediate = None # type: ARBoolean
|
|
42
|
+
self.store_on_change = None # type: ARBoolean
|
|
43
|
+
self.use_auto_validation_at_shut_down = None # type: ARBoolean
|
|
44
|
+
self.use_crc_comp_mechanism = None # type: ARBoolean
|
|
45
|
+
self.write_only_once = None # type: ARBoolean
|
|
46
|
+
self.write_verification = None # type: ARBoolean
|
|
47
|
+
self.writing_frequency = None # type: ARBoolean
|
|
48
|
+
self.writing_priority = None # type: ARBoolean
|
armodel/models/sw_component.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
from typing import List, Dict
|
|
2
2
|
from abc import ABCMeta
|
|
3
|
+
|
|
4
|
+
from .service_mapping import RoleBasedPortAssignment
|
|
5
|
+
from .per_instance_memory import PerInstanceMemory
|
|
6
|
+
from .service_needs import NvBlockNeeds, RoleBasedDataAssignment, ServiceNeeds
|
|
7
|
+
from .ar_object import ARBoolean, ARLiteral
|
|
3
8
|
from .general_structure import ARElement, Identifiable, ARObject
|
|
4
|
-
from .ar_ref import AutosarVariableRef,
|
|
5
|
-
from .ar_ref import PortInCompositionTypeInstanceRef, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
|
|
9
|
+
from .ar_ref import AutosarParameterRef, AutosarVariableRef, InnerPortGroupInCompositionInstanceRef, ParameterInAtomicSWCTypeInstanceRef, POperationInAtomicSwcInstanceRef, ROperationInAtomicSwcInstanceRef, TRefType
|
|
10
|
+
from .ar_ref import RefType, PortInCompositionTypeInstanceRef, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
|
|
6
11
|
from .ar_ref import RVariableInAtomicSwcInstanceRef, RModeInAtomicSwcInstanceRef
|
|
7
12
|
from .port_prototype import RPortPrototype, PPortPrototype, PortPrototype
|
|
8
|
-
from .data_prototype import VariableDataPrototype
|
|
9
|
-
from .common_structure import ExecutableEntity, InternalBehavior
|
|
13
|
+
from .data_prototype import ParameterDataPrototype, VariableDataPrototype
|
|
14
|
+
from .common_structure import ExecutableEntity, InternalBehavior, ValueSpecification
|
|
10
15
|
|
|
11
16
|
class VariableAccess(Identifiable):
|
|
12
17
|
def __init__(self, parent: ARObject, short_name):
|
|
@@ -16,15 +21,23 @@ class VariableAccess(Identifiable):
|
|
|
16
21
|
self.parent = parent
|
|
17
22
|
self.local_variable_ref = None # type: RefType
|
|
18
23
|
|
|
19
|
-
class
|
|
24
|
+
class AbstractAccessPoint(Identifiable):
|
|
25
|
+
__metaclass__ = ABCMeta
|
|
26
|
+
|
|
20
27
|
def __init__(self, parent: ARObject, short_name: str):
|
|
28
|
+
if type(self) == AbstractAccessPoint:
|
|
29
|
+
raise NotImplementedError("ARObject is an abstract class.")
|
|
30
|
+
|
|
21
31
|
super().__init__(parent, short_name)
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
__metaclass__ = ABCMeta
|
|
33
|
+
self.return_value_provision = None
|
|
25
34
|
|
|
35
|
+
class ParameterAccess(AbstractAccessPoint):
|
|
26
36
|
def __init__(self, parent: ARObject, short_name: str):
|
|
27
|
-
super().__init__(parent, short_name)
|
|
37
|
+
super().__init__(parent, short_name)
|
|
38
|
+
|
|
39
|
+
self.accessed_parameter = None # type: AutosarParameterRef
|
|
40
|
+
self.sw_data_def_props = None #
|
|
28
41
|
|
|
29
42
|
class ServerCallPoint(AbstractAccessPoint):
|
|
30
43
|
__metaclass__ = ABCMeta
|
|
@@ -32,7 +45,7 @@ class ServerCallPoint(AbstractAccessPoint):
|
|
|
32
45
|
def __init__(self, parent: ARObject, short_name: str):
|
|
33
46
|
super().__init__(parent, short_name)
|
|
34
47
|
self.operation_iref = None # type: ROperationInAtomicSwcInstanceRef
|
|
35
|
-
self.timeout =
|
|
48
|
+
self.timeout = None # type: float
|
|
36
49
|
|
|
37
50
|
class SynchronousServerCallPoint(ServerCallPoint):
|
|
38
51
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -59,21 +72,21 @@ class InternalTriggeringPoint(AbstractAccessPoint):
|
|
|
59
72
|
class RunnableEntity(ExecutableEntity):
|
|
60
73
|
def __init__(self, parent: ARObject, short_name: str):
|
|
61
74
|
super().__init__(parent, short_name)
|
|
62
|
-
self.can_be_invoked_concurrently =
|
|
63
|
-
self.data_read_accesses = {} # Type: Dict[VariableAccess]
|
|
64
|
-
self.data_received_point_by_arguments = {} # Type: Dict[VariableAccess]
|
|
65
|
-
self.data_received_point_by_values = {} # Type: Dict[VariableAccess]
|
|
66
|
-
self.data_send_points = {} # Type: Dict[VariableAccess]
|
|
67
|
-
self.data_write_accesses = {} # Type: Dict[VariableAccess]
|
|
68
|
-
self.written_local_variables = {} # Type: Dict[VariableAccess]
|
|
69
|
-
self.read_local_variables = {} # Type: Dict[VariableAccess]
|
|
75
|
+
self.can_be_invoked_concurrently = None # Type: ARBoolean
|
|
76
|
+
self.data_read_accesses = {} # Type: Dict[str, VariableAccess]
|
|
77
|
+
self.data_received_point_by_arguments = {} # Type: Dict[str, VariableAccess]
|
|
78
|
+
self.data_received_point_by_values = {} # Type: Dict[str, VariableAccess]
|
|
79
|
+
self.data_send_points = {} # Type: Dict[str, VariableAccess]
|
|
80
|
+
self.data_write_accesses = {} # Type: Dict[str, VariableAccess]
|
|
81
|
+
self.written_local_variables = {} # Type: Dict[str, VariableAccess]
|
|
82
|
+
self.read_local_variables = {} # Type: Dict[str, VariableAccess]
|
|
70
83
|
self.external_triggering_points = {} # Type: Dict[InternalTriggeringPoint]
|
|
71
84
|
self.internal_triggering_points = {}
|
|
72
85
|
self.mode_access_points = {}
|
|
73
86
|
self.mode_switch_points = {}
|
|
74
|
-
self.parameter_accesses = {}
|
|
75
|
-
self.server_call_points = {} # Type: Dict[ServerCallPoint]
|
|
76
|
-
self.wait_points = {} # Type: Dict[WaitPoint]
|
|
87
|
+
self.parameter_accesses = {} # Type: Dict[str, ParameterAccess]
|
|
88
|
+
self.server_call_points = {} # Type: Dict[str, ServerCallPoint]
|
|
89
|
+
self.wait_points = {} # Type: Dict[str, WaitPoint]
|
|
77
90
|
self.symbol = ""
|
|
78
91
|
|
|
79
92
|
def _createVariableAccess(self, short_name, variable_accesses: Dict[str, VariableAccess]):
|
|
@@ -87,6 +100,12 @@ class RunnableEntity(ExecutableEntity):
|
|
|
87
100
|
|
|
88
101
|
def getDataReadAccesses(self) -> List[VariableAccess]:
|
|
89
102
|
return sorted(self.data_read_accesses.values(), key=lambda v: v.short_name)
|
|
103
|
+
|
|
104
|
+
def createDataWriteAccess(self, short_name: str) -> VariableAccess:
|
|
105
|
+
return self._createVariableAccess(short_name, self.data_write_accesses)
|
|
106
|
+
|
|
107
|
+
def getDataWriteAccesses(self) -> List[VariableAccess]:
|
|
108
|
+
return sorted(self.data_write_accesses.values(), key=lambda v: v.short_name)
|
|
90
109
|
|
|
91
110
|
def createDataReceivePointByArgument(self, short_name: str) -> VariableAccess:
|
|
92
111
|
return self._createVariableAccess(short_name, self.data_received_point_by_arguments)
|
|
@@ -118,6 +137,15 @@ class RunnableEntity(ExecutableEntity):
|
|
|
118
137
|
def getWrittenLocalVariables(self) -> List[VariableAccess]:
|
|
119
138
|
return sorted(self.written_local_variables.values(), key=lambda v: v.short_name)
|
|
120
139
|
|
|
140
|
+
def createParameterAccess(self, short_name: str) -> ParameterAccess:
|
|
141
|
+
if (short_name not in self.server_call_points):
|
|
142
|
+
parameter_access = ParameterAccess(self, short_name)
|
|
143
|
+
self.parameter_accesses[short_name] = parameter_access
|
|
144
|
+
return self.parameter_accesses[short_name]
|
|
145
|
+
|
|
146
|
+
def getParameterAccesses(self) -> List[ParameterAccess]:
|
|
147
|
+
return sorted(self.parameter_accesses.values(), key= lambda o: o.short_name)
|
|
148
|
+
|
|
121
149
|
def createSynchronousServerCallPoint(self, short_name: str) -> SynchronousServerCallPoint:
|
|
122
150
|
if (short_name not in self.server_call_points):
|
|
123
151
|
server_call_point = SynchronousServerCallPoint(self, short_name)
|
|
@@ -155,7 +183,15 @@ class AbstractEvent(Identifiable):
|
|
|
155
183
|
class RTEEvent(AbstractEvent):
|
|
156
184
|
def __init__(self, parent: ARObject, short_name: str):
|
|
157
185
|
super().__init__(parent, short_name)
|
|
158
|
-
|
|
186
|
+
|
|
187
|
+
self.start_on_event_ref = None # type: RefType
|
|
188
|
+
self.disabled_mode_irefs = [] # type: List[RModeInAtomicSwcInstanceRef]
|
|
189
|
+
|
|
190
|
+
def addDisabledModeIRef(self, iref: RModeInAtomicSwcInstanceRef):
|
|
191
|
+
self.disabled_mode_irefs.append(iref)
|
|
192
|
+
|
|
193
|
+
def getDisabledModeIRefs(self) -> List[RModeInAtomicSwcInstanceRef]:
|
|
194
|
+
return self.disabled_mode_irefs
|
|
159
195
|
|
|
160
196
|
class AsynchronousServerCallReturnsEvent(RTEEvent):
|
|
161
197
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -179,16 +215,22 @@ class SwcModeSwitchEvent(RTEEvent):
|
|
|
179
215
|
def __init__(self, parent: ARObject, short_name: str):
|
|
180
216
|
super().__init__(parent, short_name)
|
|
181
217
|
|
|
182
|
-
self._activation =
|
|
183
|
-
self.mode_irefs = []
|
|
218
|
+
self._activation = None # type: ARLiteral
|
|
219
|
+
self.mode_irefs = [] # type: List[RModeInAtomicSwcInstanceRef]
|
|
220
|
+
|
|
221
|
+
def addModeIRef(self, iref: RModeInAtomicSwcInstanceRef):
|
|
222
|
+
self.mode_irefs.append(iref)
|
|
223
|
+
|
|
224
|
+
def getModeIRefs(self) -> List[RModeInAtomicSwcInstanceRef]:
|
|
225
|
+
return self.mode_irefs
|
|
184
226
|
|
|
185
227
|
@property
|
|
186
|
-
def activation(self) ->
|
|
228
|
+
def activation(self) -> ARLiteral:
|
|
187
229
|
return self._activation
|
|
188
230
|
|
|
189
231
|
@activation.setter
|
|
190
|
-
def activation(self, value:
|
|
191
|
-
if value not in ("ON-ENTRY", "ON-EXIT", "ON-TRANSITION"):
|
|
232
|
+
def activation(self, value: ARLiteral):
|
|
233
|
+
if value.getValue() not in ("ON-ENTRY", "ON-EXIT", "ON-TRANSITION"):
|
|
192
234
|
raise ValueError("Invalid activation <%s> of SwcModeSwitchEvent <%s>" % (value, self.short_name))
|
|
193
235
|
self._activation = value
|
|
194
236
|
|
|
@@ -229,10 +271,93 @@ class InternalTriggerOccurredEvent(RTEEvent):
|
|
|
229
271
|
|
|
230
272
|
self.event_source_ref = None # type: RefType
|
|
231
273
|
|
|
274
|
+
class PortDefinedArgumentValue(ARObject):
|
|
275
|
+
def __init__(self):
|
|
276
|
+
super().__init__()
|
|
277
|
+
|
|
278
|
+
self.value = None # type: ValueSpecification
|
|
279
|
+
self.value_type = None # type: TRefType
|
|
280
|
+
|
|
281
|
+
class PortAPIOption(ARObject):
|
|
282
|
+
def __init__(self):
|
|
283
|
+
super().__init__()
|
|
284
|
+
|
|
285
|
+
self.enable_take_address = None # type: ARBoolean
|
|
286
|
+
self.indirect_api = None # type: ARBoolean
|
|
287
|
+
self.port_ref = None # type: RefType
|
|
288
|
+
self._port_arg_values = [] # type: List[PortDefinedArgumentValue]
|
|
289
|
+
|
|
290
|
+
def addPortArgValue(self, value:PortDefinedArgumentValue):
|
|
291
|
+
self._port_arg_values.append(value)
|
|
292
|
+
|
|
293
|
+
def getPortArgValues(self) -> List[PortDefinedArgumentValue]:
|
|
294
|
+
return self._port_arg_values
|
|
295
|
+
|
|
296
|
+
class ServiceDependency(Identifiable):
|
|
297
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
298
|
+
super().__init__(parent, short_name)
|
|
299
|
+
|
|
300
|
+
class SwcServiceDependency(ServiceDependency):
|
|
301
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
302
|
+
super().__init__(parent, short_name)
|
|
303
|
+
|
|
304
|
+
self._assigned_data = []
|
|
305
|
+
self._assigned_ports = []
|
|
306
|
+
|
|
307
|
+
def AddAssignedData(self, data: RoleBasedDataAssignment):
|
|
308
|
+
self._assigned_data.append(data)
|
|
309
|
+
|
|
310
|
+
def getAssignedData(self) -> List[RoleBasedDataAssignment]:
|
|
311
|
+
return self._assigned_data
|
|
312
|
+
|
|
313
|
+
def AddAssignedPort(self, data: RoleBasedPortAssignment):
|
|
314
|
+
self._assigned_ports.append(data)
|
|
315
|
+
|
|
316
|
+
def getAssignedPorts(self) -> List[RoleBasedPortAssignment]:
|
|
317
|
+
return self._assigned_ports
|
|
318
|
+
|
|
319
|
+
def createNvBlockNeeds(self, short_name: str) -> NvBlockNeeds:
|
|
320
|
+
if (short_name not in self.elements):
|
|
321
|
+
event = NvBlockNeeds(self, short_name)
|
|
322
|
+
self.elements[short_name] = event
|
|
323
|
+
return self.elements[short_name]
|
|
324
|
+
|
|
325
|
+
def getNvBlockNeeds(self) -> List[NvBlockNeeds]:
|
|
326
|
+
return sorted(filter(lambda c: isinstance(c, NvBlockNeeds), self.elements.values()), key=lambda e: e.short_name)
|
|
327
|
+
|
|
328
|
+
def getServiceNeeds(self) -> List[ServiceNeeds]:
|
|
329
|
+
return sorted(filter(lambda c: isinstance(c, ServiceNeeds), self.elements.values()), key=lambda e: e.short_name)
|
|
330
|
+
|
|
232
331
|
class SwcInternalBehavior(InternalBehavior):
|
|
233
332
|
def __init__(self, parent: ARObject, short_name: str):
|
|
234
333
|
super().__init__(parent, short_name)
|
|
235
334
|
|
|
335
|
+
self.handle_termination_and_restart = None # type: str
|
|
336
|
+
self.supports_multiple_instantiation = None # type: ARBoolean
|
|
337
|
+
self._explicit_inter_runnable_variables = [] # type: List[VariableDataPrototype]
|
|
338
|
+
self._implicit_inter_runnable_variables = [] # type: List[VariableDataPrototype]
|
|
339
|
+
self._per_instance_memories = [] # type: List[PerInstanceMemory]
|
|
340
|
+
self._per_instance_parameters = [] # type: List[ParameterDataPrototype]
|
|
341
|
+
self._port_api_options = [] # type: List[PortAPIOption]
|
|
342
|
+
|
|
343
|
+
def getExplicitInterRunnableVariables(self) -> List[VariableDataPrototype]:
|
|
344
|
+
return self._explicit_inter_runnable_variables
|
|
345
|
+
|
|
346
|
+
def getImplicitInterRunnableVariables(self) -> List[VariableDataPrototype]:
|
|
347
|
+
return self._implicit_inter_runnable_variables
|
|
348
|
+
|
|
349
|
+
def getPerInstanceMemories(self) -> List[PerInstanceMemory]:
|
|
350
|
+
return self._per_instance_memories
|
|
351
|
+
|
|
352
|
+
def getParameterDataPrototypes(self) -> List[ParameterDataPrototype]:
|
|
353
|
+
return self._per_instance_parameters
|
|
354
|
+
|
|
355
|
+
def addPortAPIOption(self, option: PortAPIOption):
|
|
356
|
+
self._port_api_options.append(option)
|
|
357
|
+
|
|
358
|
+
def getPortAPIOptions(self) -> List[PortAPIOption]:
|
|
359
|
+
return self._port_api_options
|
|
360
|
+
|
|
236
361
|
def createOperationInvokedEvent(self, short_name: str) -> OperationInvokedEvent:
|
|
237
362
|
if (short_name not in self.elements):
|
|
238
363
|
event = OperationInvokedEvent(self, short_name)
|
|
@@ -268,8 +393,14 @@ class SwcInternalBehavior(InternalBehavior):
|
|
|
268
393
|
event = InternalTriggerOccurredEvent(self, short_name)
|
|
269
394
|
self.elements[short_name] = event
|
|
270
395
|
return self.elements[short_name]
|
|
396
|
+
|
|
397
|
+
def createSwcServiceDependency(self, short_name: str) -> SwcServiceDependency:
|
|
398
|
+
if (short_name not in self.elements):
|
|
399
|
+
event = SwcServiceDependency(self, short_name)
|
|
400
|
+
self.elements[short_name] = event
|
|
401
|
+
return self.elements[short_name]
|
|
271
402
|
|
|
272
|
-
def
|
|
403
|
+
def getRteEvents(self) -> List[RTEEvent]:
|
|
273
404
|
return sorted(filter(lambda c: isinstance(c, RTEEvent), self.elements.values()), key=lambda e: e.short_name)
|
|
274
405
|
|
|
275
406
|
def getOperationInvokedEvents(self) -> List[OperationInvokedEvent]:
|
|
@@ -290,6 +421,9 @@ class SwcInternalBehavior(InternalBehavior):
|
|
|
290
421
|
def getInternalTriggerOccurredEvents(self) -> List[InternalTriggerOccurredEvent]:
|
|
291
422
|
return sorted(filter(lambda c: isinstance(c, InternalTriggerOccurredEvent), self.elements.values()), key= lambda e: e.short_name)
|
|
292
423
|
|
|
424
|
+
def getSwcServiceDependencies(self) -> List[SwcServiceDependency]:
|
|
425
|
+
return sorted(filter(lambda c: isinstance(c, SwcServiceDependency), self.elements.values()), key= lambda e: e.short_name)
|
|
426
|
+
|
|
293
427
|
def getEvent(self, short_name: str) -> RTEEvent:
|
|
294
428
|
if (not isinstance(self.elements[short_name], RTEEvent)):
|
|
295
429
|
raise ValueError("Invalid Event Type <%s> of <%s>" % type(self.elements[short_name]), short_name)
|
|
@@ -299,6 +433,28 @@ class SwcInternalBehavior(InternalBehavior):
|
|
|
299
433
|
if (short_name not in self.elements):
|
|
300
434
|
prototype = VariableDataPrototype(self, short_name)
|
|
301
435
|
self.elements[short_name] = prototype
|
|
436
|
+
self._explicit_inter_runnable_variables.append(prototype)
|
|
437
|
+
return self.elements[short_name]
|
|
438
|
+
|
|
439
|
+
def createImplicitInterRunnableVariable(self, short_name: str) -> VariableDataPrototype:
|
|
440
|
+
if (short_name not in self.elements):
|
|
441
|
+
prototype = VariableDataPrototype(self, short_name)
|
|
442
|
+
self.elements[short_name] = prototype
|
|
443
|
+
self._implicit_inter_runnable_variables.append(prototype)
|
|
444
|
+
return self.elements[short_name]
|
|
445
|
+
|
|
446
|
+
def createPerInstanceMemory(self, short_name: str) -> PerInstanceMemory:
|
|
447
|
+
if (short_name not in self.elements):
|
|
448
|
+
memory = PerInstanceMemory(self, short_name)
|
|
449
|
+
self.elements[short_name] = memory
|
|
450
|
+
self._per_instance_memories.append(memory)
|
|
451
|
+
return self.elements[short_name]
|
|
452
|
+
|
|
453
|
+
def createParameterDataPrototype(self, short_name: str) -> ParameterDataPrototype:
|
|
454
|
+
if (short_name not in self.elements):
|
|
455
|
+
prototype = ParameterDataPrototype(self, short_name)
|
|
456
|
+
self.elements[short_name] = prototype
|
|
457
|
+
self._per_instance_parameters.append(prototype)
|
|
302
458
|
return self.elements[short_name]
|
|
303
459
|
|
|
304
460
|
def getVariableDataPrototypes(self) -> List[VariableDataPrototype]:
|
|
@@ -315,6 +471,25 @@ class SwcInternalBehavior(InternalBehavior):
|
|
|
315
471
|
|
|
316
472
|
def getRunnableEntity(self, short_name) -> RunnableEntity:
|
|
317
473
|
return self.elements[short_name]
|
|
474
|
+
|
|
475
|
+
class PortGroup(Identifiable):
|
|
476
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
477
|
+
super().__init__(parent, short_name)
|
|
478
|
+
|
|
479
|
+
self._inner_group_iref = [] # type: List[InnerPortGroupInCompositionInstanceRef]
|
|
480
|
+
self._outer_port_ref = [] # type: List[RefType]
|
|
481
|
+
|
|
482
|
+
def addInnerGroupIRef(self, iref: InnerPortGroupInCompositionInstanceRef):
|
|
483
|
+
self._inner_group_iref.append(iref)
|
|
484
|
+
|
|
485
|
+
def getInnerGroupIRefs(self) -> List[InnerPortGroupInCompositionInstanceRef]:
|
|
486
|
+
return self._inner_group_iref
|
|
487
|
+
|
|
488
|
+
def addOuterPortRef(self, ref: RefType):
|
|
489
|
+
self._outer_port_ref.append(ref)
|
|
490
|
+
|
|
491
|
+
def getOuterPortRefs(self) -> List[RefType]:
|
|
492
|
+
return self._outer_port_ref
|
|
318
493
|
|
|
319
494
|
class SwComponentType(ARElement):
|
|
320
495
|
__metaclass__ = ABCMeta
|
|
@@ -322,33 +497,35 @@ class SwComponentType(ARElement):
|
|
|
322
497
|
def __init__(self, parent: ARObject, short_name: str):
|
|
323
498
|
super().__init__(parent, short_name)
|
|
324
499
|
|
|
325
|
-
self.ports = [] # List[PortPrototype]
|
|
326
|
-
|
|
327
500
|
def createPPortPrototype(self, short_name: str) -> PPortPrototype:
|
|
328
501
|
prototype = PPortPrototype(self, short_name)
|
|
329
|
-
self.ports.append(prototype)
|
|
330
502
|
if (short_name not in self.elements):
|
|
331
503
|
self.elements[short_name] = prototype
|
|
332
504
|
return self.elements[short_name]
|
|
333
505
|
|
|
334
506
|
def createRPortPrototype(self, short_name) -> RPortPrototype:
|
|
335
507
|
prototype = RPortPrototype(self, short_name)
|
|
336
|
-
self.ports.append(prototype)
|
|
337
508
|
if (short_name not in self.elements):
|
|
338
509
|
self.elements[short_name] = prototype
|
|
339
510
|
return self.elements[short_name]
|
|
511
|
+
|
|
512
|
+
def createPortGroup(self, short_name) -> PortGroup:
|
|
513
|
+
port_group = PortGroup(self, short_name)
|
|
514
|
+
if (short_name not in self.elements):
|
|
515
|
+
self.elements[short_name] = port_group
|
|
516
|
+
return self.elements[short_name]
|
|
340
517
|
|
|
341
518
|
def getPPortPrototypes(self) -> List[PPortPrototype]:
|
|
342
|
-
|
|
343
|
-
return list(sorted(filter(lambda c: isinstance(c, PPortPrototype), self.ports), key= lambda o: o.short_name))
|
|
519
|
+
return list(sorted(filter(lambda c: isinstance(c, PPortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
344
520
|
|
|
345
521
|
def getRPortPrototypes(self) -> List[RPortPrototype]:
|
|
346
|
-
|
|
347
|
-
|
|
522
|
+
return list(sorted(filter(lambda c: isinstance(c, RPortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
523
|
+
|
|
524
|
+
def getPortPrototypes(self) -> List[PortPrototype]:
|
|
525
|
+
return list(sorted(filter(lambda c: isinstance(c, PortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
348
526
|
|
|
349
|
-
def
|
|
350
|
-
|
|
351
|
-
return list(sorted(self.ports, key= lambda o: o.short_name))
|
|
527
|
+
def getPortGroups(self) -> List[PortGroup]:
|
|
528
|
+
return list(sorted(filter(lambda c: isinstance(c, PortGroup), self.elements.values()), key= lambda o: o.short_name))
|
|
352
529
|
|
|
353
530
|
class AtomicSwComponentType(SwComponentType):
|
|
354
531
|
__metaclass__ = ABCMeta
|
|
@@ -415,7 +592,7 @@ class DelegationSwConnector(SwConnector):
|
|
|
415
592
|
def __init__(self, parent: ARObject, short_name: str):
|
|
416
593
|
super().__init__(parent, short_name)
|
|
417
594
|
|
|
418
|
-
self.inner_port_iref = None # type:
|
|
595
|
+
self.inner_port_iref = None # type: PortInCompositionTypeInstanceRef
|
|
419
596
|
self.outer_port_ref = None # type: RefType
|
|
420
597
|
|
|
421
598
|
class PassThroughSwConnector(SwConnector):
|
|
@@ -439,6 +616,14 @@ class CompositionSwComponentType(SwComponentType):
|
|
|
439
616
|
self._data_type_mapping_refs = [] # type: List[RefType]
|
|
440
617
|
self.instantiation_rte_event_props = [] # type: List[InstantiationRTEEventProps]
|
|
441
618
|
|
|
619
|
+
def removeAllAssemblySwConnector(self):
|
|
620
|
+
for sw_connector in self.getAssemblySwConnectors():
|
|
621
|
+
self.elements.pop(sw_connector.short_name)
|
|
622
|
+
|
|
623
|
+
def removeAllDelegationSwConnector(self):
|
|
624
|
+
for sw_connector in self.getDelegationSwConnectors():
|
|
625
|
+
self.elements.pop(sw_connector.short_name)
|
|
626
|
+
|
|
442
627
|
def createAssemblySwConnector(self, short_name: str) -> AssemblySwConnector:
|
|
443
628
|
if (short_name not in self.elements):
|
|
444
629
|
connector = AssemblySwConnector(self, short_name)
|