armodel 1.5.0__py3-none-any.whl → 1.6.1__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 +13 -13
- armodel/cli/memory_section_cli.py +76 -0
- armodel/cli/system_signal_cli.py +74 -0
- armodel/data_models/sw_connector.py +3 -3
- armodel/lib/__init__.py +2 -1
- armodel/lib/system_signal.py +37 -0
- armodel/models/__init__.py +9 -4
- armodel/models/annotation.py +27 -3
- armodel/models/ar_object.py +18 -6
- armodel/models/ar_package.py +271 -127
- armodel/models/ar_ref.py +11 -166
- armodel/models/bsw_module_template.py +37 -14
- armodel/models/common_structure.py +91 -174
- armodel/models/communication.py +2 -2
- armodel/models/data_prototype.py +41 -6
- armodel/models/datatype.py +16 -74
- armodel/models/end_to_end_protection.py +1 -1
- armodel/models/fibex/can_communication.py +119 -3
- armodel/models/fibex/fibex_4_can/__init__.py +0 -0
- armodel/models/fibex/fibex_4_lin/__init__.py +0 -0
- armodel/models/fibex/fibex_4_multiplatform.py +81 -88
- armodel/models/fibex/fibex_core/__init__.py +0 -0
- armodel/models/fibex/fibex_core/core_communication.py +627 -0
- armodel/models/fibex/fibex_core/core_topology.py +180 -0
- armodel/models/fibex/lin_communication.py +24 -3
- armodel/models/general_structure.py +110 -11
- armodel/models/internal_behavior.py +1 -1
- armodel/models/m2/__init__.py +0 -0
- armodel/models/m2/autosar_templates/__init__.py +0 -0
- armodel/models/m2/autosar_templates/common_structure/__init__.py +188 -0
- armodel/models/m2/autosar_templates/common_structure/constants.py +0 -0
- armodel/models/m2/autosar_templates/common_structure/implementation.py +21 -0
- armodel/models/m2/autosar_templates/common_structure/implementation_data_types.py +148 -0
- armodel/models/m2/autosar_templates/ecuc_description_template.py +269 -0
- 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/sw_component_template/__init__.py +0 -0
- armodel/models/m2/autosar_templates/sw_component_template/communication.py +360 -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 +181 -0
- 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/port_interface.py +236 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/__init__.py +203 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/access_count.py +13 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/data_elements.py +46 -0
- 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 +38 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +27 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/trigger.py +10 -0
- armodel/models/m2/autosar_templates/system_template/__init__.py +321 -0
- armodel/models/m2/autosar_templates/system_template/data_mapping.py +88 -0
- armodel/models/m2/autosar_templates/system_template/instance_refs.py +48 -0
- armodel/models/m2/autosar_templates/system_template/network_management.py +554 -0
- armodel/models/m2/autosar_templates/system_template/transport_protocols.py +7 -0
- armodel/models/m2/msr/__init__.py +0 -0
- armodel/models/m2/msr/asam_hdo/__init__.py +0 -0
- armodel/models/m2/msr/asam_hdo/units.py +105 -0
- armodel/models/m2/msr/data_dictionary/__init__.py +0 -0
- armodel/models/m2/msr/data_dictionary/auxillary_objects.py +42 -0
- armodel/models/m2/msr/data_dictionary/data_def_properties.py +295 -0
- armodel/models/m2/msr/documentation/__init__.py +0 -0
- armodel/models/m2/msr/documentation/block_elements.py +18 -0
- armodel/models/m2_msr.py +1 -0
- armodel/models/multilanguage_data.py +15 -0
- armodel/models/per_instance_memory.py +34 -6
- armodel/models/port_prototype.py +2 -253
- armodel/models/service_needs.py +3 -1
- armodel/models/sw_component.py +19 -358
- armodel/parser/__init__.py +2 -1
- armodel/parser/abstract_arxml_parser.py +10 -1
- armodel/parser/arxml_parser.py +912 -229
- armodel/parser/file_parser.py +43 -0
- armodel/tests/test_armodel/models/test_ar_package.py +6 -3
- armodel/tests/test_armodel/models/test_ar_ref.py +18 -16
- armodel/tests/test_armodel/models/test_bsw_module_template.py +5 -5
- armodel/tests/test_armodel/models/test_common_structure.py +8 -7
- armodel/tests/test_armodel/models/test_data_dictionary.py +5 -5
- armodel/tests/test_armodel/models/test_data_prototype.py +2 -2
- armodel/tests/test_armodel/models/test_datatype.py +9 -9
- armodel/tests/test_armodel/models/test_port_interface.py +2 -2
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +3 -3
- armodel/tests/test_armodel/parser/test_sw_components.py +3 -3
- armodel/writer/abstract_arxml_writer.py +5 -1
- armodel/writer/arxml_writer.py +870 -224
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/METADATA +28 -1
- armodel-1.6.1.dist-info/RECORD +140 -0
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/entry_points.txt +3 -1
- armodel-1.5.0.dist-info/RECORD +0 -91
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/LICENSE +0 -0
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/WHEEL +0 -0
- {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/top_level.txt +0 -0
armodel/models/sw_component.py
CHANGED
|
@@ -1,220 +1,20 @@
|
|
|
1
|
-
from typing import List
|
|
1
|
+
from typing import List
|
|
2
2
|
from abc import ABCMeta
|
|
3
3
|
|
|
4
|
-
from .
|
|
5
|
-
|
|
4
|
+
from .m2.autosar_templates.sw_component_template.components import SwComponentType
|
|
5
|
+
from .m2.autosar_templates.sw_component_template.composition.instance_refs import POperationInAtomicSwcInstanceRef
|
|
6
|
+
from .m2.autosar_templates.sw_component_template.components.instance_refs import RModeInAtomicSwcInstanceRef, RVariableInAtomicSwcInstanceRef
|
|
7
|
+
from .m2.autosar_templates.sw_component_template.swc_internal_behavior import RunnableEntity
|
|
6
8
|
from .internal_behavior import IncludedDataTypeSet, InternalBehavior
|
|
7
9
|
from .service_mapping import RoleBasedPortAssignment
|
|
8
10
|
from .per_instance_memory import PerInstanceMemory
|
|
9
11
|
from .service_needs import NvBlockNeeds, RoleBasedDataAssignment, ServiceNeeds
|
|
10
12
|
from .ar_object import ARBoolean, ARLiteral
|
|
11
|
-
from .general_structure import
|
|
12
|
-
from .ar_ref import
|
|
13
|
-
from .ar_ref import RefType
|
|
14
|
-
from .
|
|
15
|
-
from .
|
|
16
|
-
from .data_prototype import ParameterDataPrototype, VariableDataPrototype
|
|
17
|
-
from .common_structure import ExecutableEntity, ValueSpecification
|
|
18
|
-
|
|
19
|
-
class VariableAccess(Identifiable):
|
|
20
|
-
def __init__(self, parent: ARObject, short_name):
|
|
21
|
-
super().__init__(parent, short_name)
|
|
22
|
-
self.accessed_variable_ref = AutosarVariableRef()
|
|
23
|
-
self.accessed_variable_ref.parent = self
|
|
24
|
-
self._parent = parent
|
|
25
|
-
self.local_variable_ref = None # type: RefType
|
|
26
|
-
|
|
27
|
-
class AbstractAccessPoint(Identifiable):
|
|
28
|
-
__metaclass__ = ABCMeta
|
|
29
|
-
|
|
30
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
31
|
-
if type(self) == AbstractAccessPoint:
|
|
32
|
-
raise NotImplementedError("ARObject is an abstract class.")
|
|
33
|
-
|
|
34
|
-
super().__init__(parent, short_name)
|
|
35
|
-
|
|
36
|
-
self.return_value_provision = None
|
|
37
|
-
|
|
38
|
-
class ParameterAccess(AbstractAccessPoint):
|
|
39
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
40
|
-
super().__init__(parent, short_name)
|
|
41
|
-
|
|
42
|
-
self.accessed_parameter = None # type: AutosarParameterRef
|
|
43
|
-
self.sw_data_def_props = None #
|
|
44
|
-
|
|
45
|
-
class ServerCallPoint(AbstractAccessPoint):
|
|
46
|
-
__metaclass__ = ABCMeta
|
|
47
|
-
|
|
48
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
49
|
-
super().__init__(parent, short_name)
|
|
50
|
-
self.operation_iref = None # type: ROperationInAtomicSwcInstanceRef
|
|
51
|
-
self.timeout = None # type: float
|
|
52
|
-
|
|
53
|
-
class SynchronousServerCallPoint(ServerCallPoint):
|
|
54
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
55
|
-
super().__init__(parent, short_name)
|
|
56
|
-
|
|
57
|
-
self.called_from_within_exclusive_area_ref = None # type: RefType
|
|
58
|
-
|
|
59
|
-
class ModeAccessPoint(ARObject):
|
|
60
|
-
def __init__(self):
|
|
61
|
-
super().__init__()
|
|
62
|
-
|
|
63
|
-
self.ident = None # type: ModeAccessPointIdent
|
|
64
|
-
self.mode_group_iref = None # type: RModeGroupInAtomicSWCInstanceRef
|
|
65
|
-
|
|
66
|
-
@property
|
|
67
|
-
def modeGroupIRef(self) -> RModeGroupInAtomicSWCInstanceRef:
|
|
68
|
-
return self.mode_group_iref
|
|
69
|
-
|
|
70
|
-
@modeGroupIRef.setter
|
|
71
|
-
def modeGroupIRef(self, value: RModeGroupInAtomicSWCInstanceRef):
|
|
72
|
-
self.mode_group_iref = value
|
|
73
|
-
|
|
74
|
-
class AsynchronousServerCallPoint(ServerCallPoint):
|
|
75
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
76
|
-
super().__init__(parent, short_name)
|
|
77
|
-
|
|
78
|
-
class AsynchronousServerCallResultPoint(ServerCallPoint):
|
|
79
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
80
|
-
super().__init__(parent, short_name)
|
|
81
|
-
|
|
82
|
-
self.asynchronous_server_call_point_ref = None # type: RefType
|
|
83
|
-
|
|
84
|
-
@property
|
|
85
|
-
def asynchronousServerCallPointRef(self) -> RefType:
|
|
86
|
-
return self.asynchronous_server_call_point_ref
|
|
87
|
-
|
|
88
|
-
@asynchronousServerCallPointRef.setter
|
|
89
|
-
def asynchronousServerCallPointRef(self, value: RefType):
|
|
90
|
-
self.asynchronous_server_call_point_ref = value
|
|
91
|
-
|
|
92
|
-
class InternalTriggeringPoint(AbstractAccessPoint):
|
|
93
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
94
|
-
super().__init__(parent, short_name)
|
|
95
|
-
|
|
96
|
-
self.sw_impl_policy = None
|
|
97
|
-
|
|
98
|
-
class RunnableEntity(ExecutableEntity):
|
|
99
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
100
|
-
super().__init__(parent, short_name)
|
|
101
|
-
self.can_be_invoked_concurrently = None # type: ARBoolean
|
|
102
|
-
self.data_read_accesses = {} # type: Dict[str, VariableAccess]
|
|
103
|
-
self.data_received_point_by_arguments = {} # type: Dict[str, VariableAccess]
|
|
104
|
-
self.data_received_point_by_values = {} # type: Dict[str, VariableAccess]
|
|
105
|
-
self.data_send_points = {} # type: Dict[str, VariableAccess]
|
|
106
|
-
self.data_write_accesses = {} # type: Dict[str, VariableAccess]
|
|
107
|
-
self.written_local_variables = {} # type: Dict[str, VariableAccess]
|
|
108
|
-
self.read_local_variables = {} # type: Dict[str, VariableAccess]
|
|
109
|
-
self.external_triggering_points = {} # type: Dict[InternalTriggeringPoint]
|
|
110
|
-
self.internal_triggering_points = {}
|
|
111
|
-
self.mode_access_points = [] # type: List[ModeAccessPoint]
|
|
112
|
-
self.mode_switch_points = {}
|
|
113
|
-
self.parameter_accesses = {} # type: Dict[str, ParameterAccess]
|
|
114
|
-
self.server_call_points = {} # type: Dict[str, ServerCallPoint]
|
|
115
|
-
self.wait_points = {} # type: Dict[str, WaitPoint]
|
|
116
|
-
self.symbol = ""
|
|
117
|
-
|
|
118
|
-
@property
|
|
119
|
-
def canBeInvokedConcurrently(self) -> ARBoolean:
|
|
120
|
-
return self.can_be_invoked_concurrently
|
|
121
|
-
|
|
122
|
-
@canBeInvokedConcurrently.setter
|
|
123
|
-
def canBeInvokedConcurrently(self, value: ARBoolean):
|
|
124
|
-
self.can_be_invoked_concurrently = value
|
|
125
|
-
|
|
126
|
-
def _createVariableAccess(self, short_name, variable_accesses: Dict[str, VariableAccess]):
|
|
127
|
-
if (short_name not in variable_accesses):
|
|
128
|
-
variable_access = VariableAccess(self, short_name)
|
|
129
|
-
variable_accesses[short_name] = variable_access
|
|
130
|
-
return variable_accesses[short_name]
|
|
131
|
-
|
|
132
|
-
def createDataReadAccess(self, short_name: str) -> VariableAccess:
|
|
133
|
-
return self._createVariableAccess(short_name, self.data_read_accesses)
|
|
134
|
-
|
|
135
|
-
def getDataReadAccesses(self) -> List[VariableAccess]:
|
|
136
|
-
return sorted(self.data_read_accesses.values(), key=lambda v: v.short_name)
|
|
137
|
-
|
|
138
|
-
def createDataWriteAccess(self, short_name: str) -> VariableAccess:
|
|
139
|
-
return self._createVariableAccess(short_name, self.data_write_accesses)
|
|
140
|
-
|
|
141
|
-
def getDataWriteAccesses(self) -> List[VariableAccess]:
|
|
142
|
-
return sorted(self.data_write_accesses.values(), key=lambda v: v.short_name)
|
|
143
|
-
|
|
144
|
-
def createDataReceivePointByArgument(self, short_name: str) -> VariableAccess:
|
|
145
|
-
return self._createVariableAccess(short_name, self.data_received_point_by_arguments)
|
|
146
|
-
|
|
147
|
-
def getDataReceivePointByArguments(self) -> List[VariableAccess]:
|
|
148
|
-
return sorted(self.data_received_point_by_arguments.values(), key=lambda v: v.short_name)
|
|
149
|
-
|
|
150
|
-
def createDataReceivePointByValue(self, short_name: str) -> VariableAccess:
|
|
151
|
-
return self._createVariableAccess(short_name, self.data_received_point_by_values)
|
|
152
|
-
|
|
153
|
-
def getDataReceivePointByValues(self) -> List[VariableAccess]:
|
|
154
|
-
return sorted(self.data_received_point_by_values.values(), key=lambda v: v.short_name)
|
|
155
|
-
|
|
156
|
-
def createDataSendPoint(self, short_name: str) -> VariableAccess:
|
|
157
|
-
return self._createVariableAccess(short_name, self.data_send_points)
|
|
158
|
-
|
|
159
|
-
def getDataSendPoints(self) -> List[VariableAccess]:
|
|
160
|
-
return sorted(self.data_send_points.values(), key=lambda v: v.short_name)
|
|
161
|
-
|
|
162
|
-
def createReadLocalVariable(self, short_name: str) -> VariableAccess:
|
|
163
|
-
return self._createVariableAccess(short_name, self.read_local_variables)
|
|
164
|
-
|
|
165
|
-
def getReadLocalVariables(self) -> List[VariableAccess]:
|
|
166
|
-
return sorted(self.read_local_variables.values(), key=lambda v: v.short_name)
|
|
167
|
-
|
|
168
|
-
def createWrittenLocalVariable(self, short_name: str) -> VariableAccess:
|
|
169
|
-
return self._createVariableAccess(short_name, self.written_local_variables)
|
|
170
|
-
|
|
171
|
-
def getWrittenLocalVariables(self) -> List[VariableAccess]:
|
|
172
|
-
return sorted(self.written_local_variables.values(), key=lambda v: v.short_name)
|
|
173
|
-
|
|
174
|
-
def createParameterAccess(self, short_name: str) -> ParameterAccess:
|
|
175
|
-
if (short_name not in self.server_call_points):
|
|
176
|
-
parameter_access = ParameterAccess(self, short_name)
|
|
177
|
-
self.parameter_accesses[short_name] = parameter_access
|
|
178
|
-
return self.parameter_accesses[short_name]
|
|
179
|
-
|
|
180
|
-
def getParameterAccesses(self) -> List[ParameterAccess]:
|
|
181
|
-
return sorted(self.parameter_accesses.values(), key= lambda o: o.short_name)
|
|
182
|
-
|
|
183
|
-
def createSynchronousServerCallPoint(self, short_name: str) -> SynchronousServerCallPoint:
|
|
184
|
-
if (short_name not in self.server_call_points):
|
|
185
|
-
server_call_point = SynchronousServerCallPoint(self, short_name)
|
|
186
|
-
self.server_call_points[short_name] = server_call_point
|
|
187
|
-
return self.server_call_points[short_name]
|
|
188
|
-
|
|
189
|
-
def createAsynchronousServerCallPoint(self, short_name: str) -> AsynchronousServerCallPoint:
|
|
190
|
-
if (short_name not in self.server_call_points):
|
|
191
|
-
server_call_point = AsynchronousServerCallPoint(self, short_name)
|
|
192
|
-
self.server_call_points[short_name] = server_call_point
|
|
193
|
-
return self.server_call_points[short_name]
|
|
194
|
-
|
|
195
|
-
def getSynchronousServerCallPoint(self) -> List[ServerCallPoint]:
|
|
196
|
-
return filter(lambda o: isinstance(o, SynchronousServerCallPoint), self.getServerCallPoints())
|
|
197
|
-
|
|
198
|
-
def getAsynchronousServerCallPoint(self) -> List[ServerCallPoint]:
|
|
199
|
-
return filter(lambda o: isinstance(o, AsynchronousServerCallPoint), self.getServerCallPoints())
|
|
200
|
-
|
|
201
|
-
def getServerCallPoints(self) -> List[ServerCallPoint]:
|
|
202
|
-
return sorted(self.server_call_points.values(), key=lambda v: v.short_name)
|
|
203
|
-
|
|
204
|
-
def createInternalTriggeringPoint(self, short_name: str) -> InternalTriggeringPoint:
|
|
205
|
-
if (short_name not in self.elements):
|
|
206
|
-
point = InternalTriggeringPoint(self, short_name)
|
|
207
|
-
self.elements[point.short_name] = point
|
|
208
|
-
return self.elements[point.short_name]
|
|
209
|
-
|
|
210
|
-
def getInternalTriggeringPoints(self) -> List[InternalTriggeringPoint]:
|
|
211
|
-
return filter(lambda o: isinstance(o, InternalTriggeringPoint), self.elements)
|
|
212
|
-
|
|
213
|
-
def addModeAccessPoint(self, point: ModeAccessPoint):
|
|
214
|
-
self.mode_access_points.append(point)
|
|
215
|
-
|
|
216
|
-
def getModeAccessPoints(self) -> List[ModeAccessPoint]:
|
|
217
|
-
return self.mode_access_points
|
|
13
|
+
from .general_structure import Identifiable, ARObject
|
|
14
|
+
from .ar_ref import TRefType
|
|
15
|
+
from .ar_ref import RefType
|
|
16
|
+
from .m2.autosar_templates.sw_component_template.data_type.data_prototypes import ParameterDataPrototype, VariableDataPrototype
|
|
17
|
+
from .m2.autosar_templates.common_structure import ValueSpecification
|
|
218
18
|
|
|
219
19
|
class AbstractEvent(Identifiable):
|
|
220
20
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -224,8 +24,8 @@ class RTEEvent(AbstractEvent):
|
|
|
224
24
|
def __init__(self, parent: ARObject, short_name: str):
|
|
225
25
|
super().__init__(parent, short_name)
|
|
226
26
|
|
|
227
|
-
self.start_on_event_ref = None
|
|
228
|
-
self.disabled_mode_irefs = []
|
|
27
|
+
self.start_on_event_ref = None # type: RefType
|
|
28
|
+
self.disabled_mode_irefs = [] # type: List[RModeInAtomicSwcInstanceRef]
|
|
229
29
|
|
|
230
30
|
def addDisabledModeIRef(self, iref: RModeInAtomicSwcInstanceRef):
|
|
231
31
|
self.disabled_mode_irefs.append(iref)
|
|
@@ -249,15 +49,14 @@ class DataReceivedEvent(RTEEvent):
|
|
|
249
49
|
def __init__(self, parent: ARObject, short_name: str):
|
|
250
50
|
super().__init__(parent, short_name)
|
|
251
51
|
|
|
252
|
-
self.
|
|
52
|
+
self.dataIRef = None # type: RVariableInAtomicSwcInstanceRef
|
|
253
53
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
self.data_iref = value
|
|
54
|
+
def getDataIRef(self):
|
|
55
|
+
return self.dataIRef
|
|
56
|
+
|
|
57
|
+
def setDataIRef(self, value):
|
|
58
|
+
self.dataIRef = value
|
|
59
|
+
return self
|
|
261
60
|
|
|
262
61
|
class SwcModeSwitchEvent(RTEEvent):
|
|
263
62
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -535,60 +334,7 @@ class SwcInternalBehavior(InternalBehavior):
|
|
|
535
334
|
def getRunnableEntity(self, short_name) -> RunnableEntity:
|
|
536
335
|
return self.elements[short_name]
|
|
537
336
|
|
|
538
|
-
class PortGroup(Identifiable):
|
|
539
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
540
|
-
super().__init__(parent, short_name)
|
|
541
|
-
|
|
542
|
-
self._inner_group_iref = [] # type: List[InnerPortGroupInCompositionInstanceRef]
|
|
543
|
-
self._outer_port_ref = [] # type: List[RefType]
|
|
544
|
-
|
|
545
|
-
def addInnerGroupIRef(self, iref: InnerPortGroupInCompositionInstanceRef):
|
|
546
|
-
self._inner_group_iref.append(iref)
|
|
547
|
-
|
|
548
|
-
def getInnerGroupIRefs(self) -> List[InnerPortGroupInCompositionInstanceRef]:
|
|
549
|
-
return self._inner_group_iref
|
|
550
|
-
|
|
551
|
-
def addOuterPortRef(self, ref: RefType):
|
|
552
|
-
self._outer_port_ref.append(ref)
|
|
553
337
|
|
|
554
|
-
def getOuterPortRefs(self) -> List[RefType]:
|
|
555
|
-
return self._outer_port_ref
|
|
556
|
-
|
|
557
|
-
class SwComponentType(ARElement):
|
|
558
|
-
__metaclass__ = ABCMeta
|
|
559
|
-
|
|
560
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
561
|
-
super().__init__(parent, short_name)
|
|
562
|
-
|
|
563
|
-
def createPPortPrototype(self, short_name: str) -> PPortPrototype:
|
|
564
|
-
prototype = PPortPrototype(self, short_name)
|
|
565
|
-
if (short_name not in self.elements):
|
|
566
|
-
self.elements[short_name] = prototype
|
|
567
|
-
return self.elements[short_name]
|
|
568
|
-
|
|
569
|
-
def createRPortPrototype(self, short_name) -> RPortPrototype:
|
|
570
|
-
prototype = RPortPrototype(self, short_name)
|
|
571
|
-
if (short_name not in self.elements):
|
|
572
|
-
self.elements[short_name] = prototype
|
|
573
|
-
return self.elements[short_name]
|
|
574
|
-
|
|
575
|
-
def createPortGroup(self, short_name) -> PortGroup:
|
|
576
|
-
port_group = PortGroup(self, short_name)
|
|
577
|
-
if (short_name not in self.elements):
|
|
578
|
-
self.elements[short_name] = port_group
|
|
579
|
-
return self.elements[short_name]
|
|
580
|
-
|
|
581
|
-
def getPPortPrototypes(self) -> List[PPortPrototype]:
|
|
582
|
-
return list(sorted(filter(lambda c: isinstance(c, PPortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
583
|
-
|
|
584
|
-
def getRPortPrototypes(self) -> List[RPortPrototype]:
|
|
585
|
-
return list(sorted(filter(lambda c: isinstance(c, RPortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
586
|
-
|
|
587
|
-
def getPortPrototypes(self) -> List[PortPrototype]:
|
|
588
|
-
return list(sorted(filter(lambda c: isinstance(c, PortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
589
|
-
|
|
590
|
-
def getPortGroups(self) -> List[PortGroup]:
|
|
591
|
-
return list(sorted(filter(lambda c: isinstance(c, PortGroup), self.elements.values()), key= lambda o: o.short_name))
|
|
592
338
|
|
|
593
339
|
class AtomicSwComponentType(SwComponentType):
|
|
594
340
|
__metaclass__ = ABCMeta
|
|
@@ -636,89 +382,4 @@ class ServiceSwComponentType(AtomicSwComponentType):
|
|
|
636
382
|
def __init__(self, parent: ARObject, short_name: str):
|
|
637
383
|
super().__init__(parent, short_name)
|
|
638
384
|
|
|
639
|
-
class SwConnector(Identifiable):
|
|
640
|
-
__metaclass__ = ABCMeta
|
|
641
|
-
|
|
642
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
643
|
-
super().__init__(parent, short_name)
|
|
644
|
-
|
|
645
|
-
self.mapping_ref = None # type: RefType
|
|
646
|
-
|
|
647
|
-
class AssemblySwConnector(SwConnector):
|
|
648
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
649
|
-
super().__init__(parent, short_name)
|
|
650
|
-
|
|
651
|
-
self.provider_iref = None # type: PPortInCompositionInstanceRef
|
|
652
|
-
self.requester_iref = None # type: RPortInCompositionInstanceRef
|
|
653
|
-
|
|
654
|
-
class DelegationSwConnector(SwConnector):
|
|
655
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
656
|
-
super().__init__(parent, short_name)
|
|
657
|
-
|
|
658
|
-
self.inner_port_iref = None # type: PortInCompositionTypeInstanceRef
|
|
659
|
-
self.outer_port_ref = None # type: RefType
|
|
660
|
-
|
|
661
|
-
class PassThroughSwConnector(SwConnector):
|
|
662
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
663
|
-
super().__init__(parent, short_name)
|
|
664
|
-
|
|
665
|
-
self.provided_outer_port_ref = None # type: RefType
|
|
666
|
-
self.required_outer_port_ref = None # type: RefType
|
|
667
|
-
|
|
668
|
-
class SwComponentPrototype(Identifiable):
|
|
669
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
670
|
-
super().__init__(parent, short_name)
|
|
671
|
-
|
|
672
|
-
self.type_tref = RefType()
|
|
673
|
-
|
|
674
|
-
class CompositionSwComponentType(SwComponentType):
|
|
675
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
676
|
-
super().__init__(parent, short_name)
|
|
677
|
-
|
|
678
|
-
self.constant_value_mapping_refs = [] # type: List[RefType]
|
|
679
|
-
self._data_type_mapping_refs = [] # type: List[RefType]
|
|
680
|
-
self.instantiation_rte_event_props = [] # type: List[InstantiationRTEEventProps]
|
|
681
|
-
|
|
682
|
-
def removeAllAssemblySwConnector(self):
|
|
683
|
-
for sw_connector in self.getAssemblySwConnectors():
|
|
684
|
-
self.elements.pop(sw_connector.short_name)
|
|
685
|
-
|
|
686
|
-
def removeAllDelegationSwConnector(self):
|
|
687
|
-
for sw_connector in self.getDelegationSwConnectors():
|
|
688
|
-
self.elements.pop(sw_connector.short_name)
|
|
689
|
-
|
|
690
|
-
def createAssemblySwConnector(self, short_name: str) -> AssemblySwConnector:
|
|
691
|
-
if (short_name not in self.elements):
|
|
692
|
-
connector = AssemblySwConnector(self, short_name)
|
|
693
|
-
self.elements[short_name] = connector
|
|
694
|
-
return self.elements[short_name]
|
|
695
|
-
|
|
696
|
-
def createDelegationSwConnector(self, short_name: str) -> DelegationSwConnector:
|
|
697
|
-
if short_name not in self.elements:
|
|
698
|
-
connector = DelegationSwConnector(self, short_name)
|
|
699
|
-
self.elements[short_name] = connector
|
|
700
|
-
return self.elements[short_name]
|
|
701
|
-
|
|
702
|
-
def getAssemblySwConnectors(self) -> List[AssemblySwConnector]:
|
|
703
|
-
return list(sorted(filter(lambda e: isinstance(e, AssemblySwConnector), self.elements.values()), key = lambda c: c.short_name))
|
|
704
|
-
|
|
705
|
-
def getDelegationSwConnectors(self) -> List[DelegationSwConnector]:
|
|
706
|
-
return list(sorted(filter(lambda e: isinstance(e, DelegationSwConnector), self.elements.values()), key = lambda c: c.short_name))
|
|
707
|
-
|
|
708
|
-
def getSwConnectors(self) -> List[SwConnector]:
|
|
709
|
-
return list(sorted(filter(lambda e: isinstance(e, SwConnector), self.elements.values()), key = lambda c: c.short_name))
|
|
710
|
-
|
|
711
|
-
def createSwComponentPrototype(self, short_name: str) -> SwComponentPrototype:
|
|
712
|
-
if (short_name not in self.elements):
|
|
713
|
-
connector = SwComponentPrototype(self, short_name)
|
|
714
|
-
self.elements[short_name] = connector
|
|
715
|
-
return self.elements[short_name]
|
|
716
|
-
|
|
717
|
-
def getSwComponentPrototypes(self) -> List[SwComponentPrototype]:
|
|
718
|
-
return list(filter(lambda e: isinstance(e, SwComponentPrototype), self.elements.values()))
|
|
719
|
-
|
|
720
|
-
def addDataTypeMapping(self, data_type_mapping_ref: RefType):
|
|
721
|
-
self._data_type_mapping_refs.append(data_type_mapping_ref)
|
|
722
385
|
|
|
723
|
-
def getDataTypeMappings(self) -> List[RefType]:
|
|
724
|
-
return self._data_type_mapping_refs
|
armodel/parser/__init__.py
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
from .arxml_parser import ARXMLParser
|
|
1
|
+
from .arxml_parser import ARXMLParser
|
|
2
|
+
from .file_parser import FileListParser
|
|
@@ -45,6 +45,9 @@ class AbstractARXMLParser:
|
|
|
45
45
|
else:
|
|
46
46
|
raise ValueError(error_msg)
|
|
47
47
|
|
|
48
|
+
def _raiseWarning(self, error_msg):
|
|
49
|
+
self.logger.warning(error_msg)
|
|
50
|
+
|
|
48
51
|
def getPureTagName(self, tag):
|
|
49
52
|
return re.sub(r'\{[\w:\/.]+\}(\w+)', r'\1', tag)
|
|
50
53
|
|
|
@@ -105,7 +108,7 @@ class AbstractARXMLParser:
|
|
|
105
108
|
def getChildElementOptionalFloatValue(self, element: ET.Element, key: str) -> ARFloat:
|
|
106
109
|
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
107
110
|
float_value = None
|
|
108
|
-
if (child_element is not None):
|
|
111
|
+
if (child_element is not None) and (child_element.text is not None):
|
|
109
112
|
float_value = ARFloat()
|
|
110
113
|
float_value.setValue(child_element.text)
|
|
111
114
|
return float_value
|
|
@@ -234,6 +237,12 @@ class AbstractARXMLParser:
|
|
|
234
237
|
|
|
235
238
|
self.logger.debug("schemaLocation %s" % document.schema_location)
|
|
236
239
|
|
|
240
|
+
def getShortName(self, element: ET.Element) -> str:
|
|
241
|
+
child_element = self.find(element, "SHORT-NAME")
|
|
242
|
+
if child_element is None:
|
|
243
|
+
raise ValueError("Short Name is required")
|
|
244
|
+
return child_element.text
|
|
245
|
+
|
|
237
246
|
def convert_find_key(self, key: str) -> str:
|
|
238
247
|
keys = key.split("/")
|
|
239
248
|
for idx, item in enumerate(keys):
|