armodel 1.6.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/data_models/sw_connector.py +3 -3
- armodel/models/__init__.py +4 -2
- 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 +5 -69
- 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/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 +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/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/arxml_parser.py +124 -58
- armodel/parser/file_parser.py +43 -0
- armodel/tests/test_armodel/models/test_ar_package.py +5 -2
- 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 +8 -8
- armodel/tests/test_armodel/models/test_port_interface.py +1 -1
- armodel/tests/test_armodel/parser/test_sw_components.py +1 -1
- armodel/writer/abstract_arxml_writer.py +5 -1
- armodel/writer/arxml_writer.py +68 -58
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/METADATA +5 -1
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/RECORD +52 -39
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/LICENSE +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/WHEEL +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/entry_points.txt +0 -0
- {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from .....ar_object import ARObject
|
|
4
|
+
from .....ar_ref import RefType
|
|
5
|
+
from ...generic_structure.abstract_structure import AtpInstanceRef
|
|
6
|
+
|
|
7
|
+
class ArVariableInImplementationDataInstanceRef(AtpInstanceRef):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super().__init__()
|
|
10
|
+
|
|
11
|
+
self.contextDataPrototypeRefs = [] # type: List[RefType]
|
|
12
|
+
self.portPrototypeRef = None # type: RefType
|
|
13
|
+
self.rootVariableDataPrototypeRef = None # type: RefType
|
|
14
|
+
self.targetDataPrototypeRef = None # type: RefType
|
|
15
|
+
|
|
16
|
+
def getContextDataPrototypeRefs(self):
|
|
17
|
+
return self.contextDataPrototypeRefs
|
|
18
|
+
|
|
19
|
+
def setContextDataPrototypeRefs(self, value):
|
|
20
|
+
self.contextDataPrototypeRefs = value
|
|
21
|
+
return self
|
|
22
|
+
|
|
23
|
+
def getPortPrototypeRef(self):
|
|
24
|
+
return self.portPrototypeRef
|
|
25
|
+
|
|
26
|
+
def setPortPrototypeRef(self, value):
|
|
27
|
+
self.portPrototypeRef = value
|
|
28
|
+
return self
|
|
29
|
+
|
|
30
|
+
def getRootVariableDataPrototypeRef(self):
|
|
31
|
+
return self.rootVariableDataPrototypeRef
|
|
32
|
+
|
|
33
|
+
def setRootVariableDataPrototypeRef(self, value):
|
|
34
|
+
self.rootVariableDataPrototypeRef = value
|
|
35
|
+
return self
|
|
36
|
+
|
|
37
|
+
def getTargetDataPrototypeRef(self):
|
|
38
|
+
return self.targetDataPrototypeRef
|
|
39
|
+
|
|
40
|
+
def setTargetDataPrototypeRef(self, value):
|
|
41
|
+
self.targetDataPrototypeRef = value
|
|
42
|
+
return self
|
|
43
|
+
|
|
44
|
+
class VariableInAtomicSWCTypeInstanceRef(AtpInstanceRef):
|
|
45
|
+
def __init__(self):
|
|
46
|
+
super().__init__()
|
|
47
|
+
|
|
48
|
+
self.baseRef = None # type: RefType
|
|
49
|
+
self.contextDataPrototypeRefs = [] # type: List[RefType]
|
|
50
|
+
self.portPrototypeRef = None # type: RefType
|
|
51
|
+
self.rootVariableDataPrototypeRef = None # type: RefType
|
|
52
|
+
self.targetDataPrototypeRef = None # type: RefType
|
|
53
|
+
|
|
54
|
+
def getBaseRef(self):
|
|
55
|
+
return self.baseRef
|
|
56
|
+
|
|
57
|
+
def setBaseRef(self, value):
|
|
58
|
+
self.baseRef = value
|
|
59
|
+
return self
|
|
60
|
+
|
|
61
|
+
def getContextDataPrototypeRefs(self):
|
|
62
|
+
return self.contextDataPrototypeRefs
|
|
63
|
+
|
|
64
|
+
def addContextDataPrototypeRef(self, value):
|
|
65
|
+
self.contextDataPrototypeRefs.append(value)
|
|
66
|
+
return self
|
|
67
|
+
|
|
68
|
+
def getPortPrototypeRef(self):
|
|
69
|
+
return self.portPrototypeRef
|
|
70
|
+
|
|
71
|
+
def setPortPrototypeRef(self, value):
|
|
72
|
+
self.portPrototypeRef = value
|
|
73
|
+
return self
|
|
74
|
+
|
|
75
|
+
def getRootVariableDataPrototypeRef(self):
|
|
76
|
+
return self.rootVariableDataPrototypeRef
|
|
77
|
+
|
|
78
|
+
def setRootVariableDataPrototypeRef(self, value):
|
|
79
|
+
self.rootVariableDataPrototypeRef = value
|
|
80
|
+
return self
|
|
81
|
+
|
|
82
|
+
def getTargetDataPrototypeRef(self):
|
|
83
|
+
return self.targetDataPrototypeRef
|
|
84
|
+
|
|
85
|
+
def setTargetDataPrototypeRef(self, value):
|
|
86
|
+
self.targetDataPrototypeRef = value
|
|
87
|
+
return self
|
|
88
|
+
|
|
89
|
+
class AutosarVariableRef(ARObject):
|
|
90
|
+
def __init__(self):
|
|
91
|
+
super().__init__()
|
|
92
|
+
|
|
93
|
+
self.autosarVariableIRef = None # type: VariableInAtomicSWCTypeInstanceRef
|
|
94
|
+
self.autosarVariableInImplDatatype = None # type: ArVariableInImplementationDataInstanceRef
|
|
95
|
+
self.localVariableRef = None
|
|
96
|
+
|
|
97
|
+
def getAutosarVariableIRef(self):
|
|
98
|
+
return self.autosarVariableIRef
|
|
99
|
+
|
|
100
|
+
def setAutosarVariableIRef(self, value):
|
|
101
|
+
self.autosarVariableIRef = value
|
|
102
|
+
return self
|
|
103
|
+
|
|
104
|
+
def getAutosarVariableInImplDatatype(self):
|
|
105
|
+
return self.autosarVariableInImplDatatype
|
|
106
|
+
|
|
107
|
+
def setAutosarVariableInImplDatatype(self, value):
|
|
108
|
+
self.autosarVariableInImplDatatype = value
|
|
109
|
+
return self
|
|
110
|
+
|
|
111
|
+
def getLocalVariableRef(self):
|
|
112
|
+
return self.localVariableRef
|
|
113
|
+
|
|
114
|
+
def setLocalVariableRef(self, value):
|
|
115
|
+
self.localVariableRef = value
|
|
116
|
+
return self
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class ParameterInAtomicSWCTypeInstanceRef(AtpInstanceRef):
|
|
120
|
+
def __init__(self):
|
|
121
|
+
super().__init__()
|
|
122
|
+
|
|
123
|
+
self.baseRef = None # type: RefType
|
|
124
|
+
self.contextDataPrototypeRef = None # type: RefType
|
|
125
|
+
self.portPrototypeRef = None # type: RefType
|
|
126
|
+
self.rootParameterDataPrototypeRef = None # type: RefType
|
|
127
|
+
self.targetDataPrototypeRef = None # type: RefType
|
|
128
|
+
|
|
129
|
+
def getBaseRef(self):
|
|
130
|
+
return self.baseRef
|
|
131
|
+
|
|
132
|
+
def setBaseRef(self, value):
|
|
133
|
+
self.baseRef = value
|
|
134
|
+
return self
|
|
135
|
+
|
|
136
|
+
def getContextDataPrototypeRef(self):
|
|
137
|
+
return self.contextDataPrototypeRef
|
|
138
|
+
|
|
139
|
+
def setContextDataPrototypeRef(self, value):
|
|
140
|
+
self.contextDataPrototypeRef = value
|
|
141
|
+
return self
|
|
142
|
+
|
|
143
|
+
def getPortPrototypeRef(self):
|
|
144
|
+
return self.portPrototypeRef
|
|
145
|
+
|
|
146
|
+
def setPortPrototypeRef(self, value):
|
|
147
|
+
self.portPrototypeRef = value
|
|
148
|
+
return self
|
|
149
|
+
|
|
150
|
+
def getRootParameterDataPrototypeRef(self):
|
|
151
|
+
return self.rootParameterDataPrototypeRef
|
|
152
|
+
|
|
153
|
+
def setRootParameterDataPrototypeRef(self, value):
|
|
154
|
+
self.rootParameterDataPrototypeRef = value
|
|
155
|
+
return self
|
|
156
|
+
|
|
157
|
+
def getTargetDataPrototypeRef(self):
|
|
158
|
+
return self.targetDataPrototypeRef
|
|
159
|
+
|
|
160
|
+
def setTargetDataPrototypeRef(self, value):
|
|
161
|
+
self.targetDataPrototypeRef = value
|
|
162
|
+
return self
|
|
163
|
+
|
|
164
|
+
class AutosarParameterRef(ARObject):
|
|
165
|
+
def __init__(self):
|
|
166
|
+
super().__init__()
|
|
167
|
+
|
|
168
|
+
self.autosar_parameter_iref = None # type: ParameterInAtomicSWCTypeInstanceRef
|
|
169
|
+
self.local_parameter_ref = None # type: RefType
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
from .access_count import AbstractAccessPoint
|
|
2
|
-
from
|
|
2
|
+
from ..components.instance_refs import PModeGroupInAtomicSwcInstanceRef, RModeGroupInAtomicSWCInstanceRef
|
|
3
3
|
from .....rpt_scenario import ModeAccessPointIdent
|
|
4
4
|
from .....ar_object import ARObject
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
class ModeAccessPoint(ARObject):
|
|
8
7
|
def __init__(self):
|
|
9
8
|
super().__init__()
|
armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
|
-
from .....ar_ref import ROperationInAtomicSwcInstanceRef
|
|
3
|
-
from .access_count import AbstractAccessPoint
|
|
4
2
|
from .....ar_object import ARObject
|
|
3
|
+
from ..composition.instance_refs import ROperationInAtomicSwcInstanceRef
|
|
4
|
+
from .access_count import AbstractAccessPoint
|
|
5
|
+
|
|
5
6
|
|
|
6
7
|
class ServerCallPoint(AbstractAccessPoint, metaclass = ABCMeta):
|
|
7
8
|
|
|
8
9
|
def __init__(self, parent: ARObject, short_name: str):
|
|
9
10
|
super().__init__(parent, short_name)
|
|
10
11
|
|
|
11
|
-
self.operationIRef = None
|
|
12
|
-
self.timeout = None
|
|
12
|
+
self.operationIRef = None # type: ROperationInAtomicSwcInstanceRef
|
|
13
|
+
self.timeout = None # type: float
|
|
13
14
|
|
|
14
15
|
def getOperationIRef(self):
|
|
15
16
|
return self.operationIRef
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from ....ar_ref import RefType
|
|
3
|
+
from ..generic_structure.abstract_structure import AtpInstanceRef
|
|
4
|
+
|
|
5
|
+
class VariableDataPrototypeInSystemInstanceRef(AtpInstanceRef):
|
|
6
|
+
def __init__(self):
|
|
7
|
+
super().__init__()
|
|
8
|
+
|
|
9
|
+
self.baseRef = None # type: RefType
|
|
10
|
+
self.contextComponentRefs = [] # type: List[RefType]
|
|
11
|
+
self.contextCompositionRef = None # type: RefType
|
|
12
|
+
self.contextPortRef = None # type: RefType
|
|
13
|
+
self.targetDataPrototypeRef = None # type: RefType
|
|
14
|
+
|
|
15
|
+
def getBaseRef(self):
|
|
16
|
+
return self.baseRef
|
|
17
|
+
|
|
18
|
+
def setBaseRef(self, value):
|
|
19
|
+
self.baseRef = value
|
|
20
|
+
return self
|
|
21
|
+
|
|
22
|
+
def getContextComponentRefs(self):
|
|
23
|
+
return self.contextComponentRefs
|
|
24
|
+
|
|
25
|
+
def addContextComponentRef(self, value):
|
|
26
|
+
self.contextComponentRefs.append(value)
|
|
27
|
+
return self
|
|
28
|
+
|
|
29
|
+
def getContextCompositionRef(self):
|
|
30
|
+
return self.contextCompositionRef
|
|
31
|
+
|
|
32
|
+
def setContextCompositionRef(self, value):
|
|
33
|
+
self.contextCompositionRef = value
|
|
34
|
+
return self
|
|
35
|
+
|
|
36
|
+
def getContextPortRef(self):
|
|
37
|
+
return self.contextPortRef
|
|
38
|
+
|
|
39
|
+
def setContextPortRef(self, value):
|
|
40
|
+
self.contextPortRef = value
|
|
41
|
+
return self
|
|
42
|
+
|
|
43
|
+
def getTargetDataPrototypeRef(self):
|
|
44
|
+
return self.targetDataPrototypeRef
|
|
45
|
+
|
|
46
|
+
def setTargetDataPrototypeRef(self, value):
|
|
47
|
+
self.targetDataPrototypeRef = value
|
|
48
|
+
return self
|
armodel/models/m2_msr.py
CHANGED
|
@@ -123,6 +123,7 @@ class CompuScale(Compu):
|
|
|
123
123
|
self.upperLimit = None # type: Limit
|
|
124
124
|
self.compuInverseValue = None # type: CompuConst
|
|
125
125
|
self.compuScaleContents = None # type: CompuScaleContents
|
|
126
|
+
self.short_label = None # type: ARLiteral
|
|
126
127
|
|
|
127
128
|
class CompuScales(CompuContent):
|
|
128
129
|
def __init__(self):
|
armodel/models/port_prototype.py
CHANGED
|
@@ -1,95 +1,6 @@
|
|
|
1
1
|
from typing import List
|
|
2
2
|
|
|
3
|
-
from .m2.autosar_templates.sw_component_template.communication import ClientComSpec, ModeSwitchReceiverComSpec, ModeSwitchSenderComSpec, NonqueuedReceiverComSpec, NonqueuedSenderComSpec, PPortComSpec, QueuedReceiverComSpec, QueuedSenderComSpec, RPortComSpec, ServerComSpec
|
|
3
|
+
from .m2.autosar_templates.sw_component_template.communication import ClientComSpec, ModeSwitchReceiverComSpec, ModeSwitchSenderComSpec, NonqueuedReceiverComSpec, NonqueuedSenderComSpec, PPortComSpec, ParameterRequireComSpec, QueuedReceiverComSpec, QueuedSenderComSpec, RPortComSpec, ServerComSpec
|
|
4
4
|
from .general_structure import ARObject, Identifiable
|
|
5
5
|
from .ar_ref import TRefType
|
|
6
6
|
|
|
7
|
-
class PortPrototype(Identifiable):
|
|
8
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
9
|
-
super().__init__(parent, short_name)
|
|
10
|
-
|
|
11
|
-
class AbstractProvidedPortPrototype(PortPrototype):
|
|
12
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
13
|
-
super().__init__(parent, short_name)
|
|
14
|
-
|
|
15
|
-
self.provided_com_specs = [] # type: List[PPortComSpec]
|
|
16
|
-
|
|
17
|
-
def _validateRPortComSpec(self, com_spec: PPortComSpec):
|
|
18
|
-
if isinstance(com_spec, NonqueuedSenderComSpec):
|
|
19
|
-
if com_spec.dataElementRef == None:
|
|
20
|
-
raise ValueError(
|
|
21
|
-
"operation of NonqueuedSenderComSpec is invalid")
|
|
22
|
-
if com_spec.dataElementRef.dest != "VARIABLE-DATA-PROTOTYPE":
|
|
23
|
-
raise ValueError(
|
|
24
|
-
"Invalid operation dest of NonqueuedSenderComSpec")
|
|
25
|
-
elif isinstance(com_spec, ServerComSpec):
|
|
26
|
-
pass
|
|
27
|
-
elif isinstance(com_spec, QueuedSenderComSpec):
|
|
28
|
-
pass
|
|
29
|
-
elif isinstance(com_spec, ModeSwitchSenderComSpec):
|
|
30
|
-
pass
|
|
31
|
-
else:
|
|
32
|
-
raise ValueError("Unsupported com spec")
|
|
33
|
-
|
|
34
|
-
def addProvidedComSpec(self, com_spec):
|
|
35
|
-
self._validateRPortComSpec(com_spec)
|
|
36
|
-
self.provided_com_specs.append(com_spec)
|
|
37
|
-
|
|
38
|
-
def getProvidedComSpecs(self) -> List[PPortComSpec]:
|
|
39
|
-
return self.provided_com_specs
|
|
40
|
-
|
|
41
|
-
def getNonqueuedSenderComSpecs(self) -> List[NonqueuedSenderComSpec]:
|
|
42
|
-
return filter(lambda c: isinstance(c, NonqueuedSenderComSpec), self.provided_com_specs)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class AbstractRequiredPortPrototype(PortPrototype):
|
|
46
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
47
|
-
super().__init__(parent, short_name)
|
|
48
|
-
|
|
49
|
-
self.required_com_specs = [] # type: List[RPortComSpec]
|
|
50
|
-
|
|
51
|
-
def _validateRPortComSpec(self, com_spec: RPortComSpec):
|
|
52
|
-
if (isinstance(com_spec, ClientComSpec)):
|
|
53
|
-
if (com_spec.operationRef == None):
|
|
54
|
-
raise ValueError(
|
|
55
|
-
"The operation reference of ClientComSpec has not been defined.")
|
|
56
|
-
if (com_spec.operationRef.dest != "CLIENT-SERVER-OPERATION"):
|
|
57
|
-
raise ValueError("Invalid operation dest of ClientComSpec.")
|
|
58
|
-
elif (isinstance(com_spec, NonqueuedReceiverComSpec)):
|
|
59
|
-
if (com_spec.dataElementRef == None):
|
|
60
|
-
raise ValueError(
|
|
61
|
-
"The data element reference of NonqueuedReceiverComSpec has not been defined.")
|
|
62
|
-
if (com_spec.dataElementRef.dest != "VARIABLE-DATA-PROTOTYPE"):
|
|
63
|
-
raise ValueError(
|
|
64
|
-
"Invalid date element dest of NonqueuedReceiverComSpec.")
|
|
65
|
-
elif isinstance(com_spec, QueuedReceiverComSpec):
|
|
66
|
-
pass
|
|
67
|
-
elif isinstance(com_spec, ModeSwitchReceiverComSpec):
|
|
68
|
-
pass
|
|
69
|
-
else:
|
|
70
|
-
raise ValueError("Unsupported RPortComSpec <%s>" % type(com_spec))
|
|
71
|
-
|
|
72
|
-
def addRequiredComSpec(self, com_spec: RPortComSpec):
|
|
73
|
-
self._validateRPortComSpec(com_spec)
|
|
74
|
-
self.required_com_specs.append(com_spec)
|
|
75
|
-
|
|
76
|
-
def getRequiredComSpecs(self) -> List[RPortComSpec]:
|
|
77
|
-
return self.required_com_specs
|
|
78
|
-
|
|
79
|
-
def getClientComSpecs(self) -> List[ClientComSpec]:
|
|
80
|
-
return filter(lambda c: isinstance(c, ClientComSpec), self.required_com_specs)
|
|
81
|
-
|
|
82
|
-
def getNonqueuedReceiverComSpecs(self) -> List[NonqueuedReceiverComSpec]:
|
|
83
|
-
return filter(lambda c: isinstance(c, NonqueuedReceiverComSpec), self.required_com_specs)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class PPortPrototype(AbstractProvidedPortPrototype):
|
|
87
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
88
|
-
super().__init__(parent, short_name)
|
|
89
|
-
|
|
90
|
-
self.provided_interface_tref = TRefType()
|
|
91
|
-
class RPortPrototype(AbstractRequiredPortPrototype):
|
|
92
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
93
|
-
super().__init__(parent, short_name)
|
|
94
|
-
|
|
95
|
-
self.required_interface_tref = TRefType()
|
armodel/models/service_needs.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
from abc import ABCMeta
|
|
3
|
+
|
|
4
|
+
from .m2.autosar_templates.sw_component_template.swc_internal_behavior.instance_refs_usage import AutosarParameterRef, AutosarVariableRef
|
|
3
5
|
from .general_structure import Identifiable
|
|
4
|
-
from .ar_ref import
|
|
6
|
+
from .ar_ref import RefType
|
|
5
7
|
from .ar_object import ARBoolean, ARLiteral, ARObject
|
|
6
8
|
|
|
7
9
|
|
armodel/models/sw_component.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from typing import List
|
|
2
2
|
from abc import ABCMeta
|
|
3
3
|
|
|
4
|
+
from .m2.autosar_templates.sw_component_template.components import SwComponentType
|
|
5
|
+
from .m2.autosar_templates.sw_component_template.composition.instance_refs import POperationInAtomicSwcInstanceRef
|
|
4
6
|
from .m2.autosar_templates.sw_component_template.components.instance_refs import RModeInAtomicSwcInstanceRef, RVariableInAtomicSwcInstanceRef
|
|
5
7
|
from .m2.autosar_templates.sw_component_template.swc_internal_behavior import RunnableEntity
|
|
6
8
|
from .internal_behavior import IncludedDataTypeSet, InternalBehavior
|
|
@@ -8,11 +10,10 @@ 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 .data_prototype import ParameterDataPrototype, VariableDataPrototype
|
|
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
|
|
16
17
|
from .m2.autosar_templates.common_structure import ValueSpecification
|
|
17
18
|
|
|
18
19
|
class AbstractEvent(Identifiable):
|
|
@@ -333,60 +334,7 @@ class SwcInternalBehavior(InternalBehavior):
|
|
|
333
334
|
def getRunnableEntity(self, short_name) -> RunnableEntity:
|
|
334
335
|
return self.elements[short_name]
|
|
335
336
|
|
|
336
|
-
class PortGroup(Identifiable):
|
|
337
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
338
|
-
super().__init__(parent, short_name)
|
|
339
|
-
|
|
340
|
-
self._inner_group_iref = [] # type: List[InnerPortGroupInCompositionInstanceRef]
|
|
341
|
-
self._outer_port_ref = [] # type: List[RefType]
|
|
342
337
|
|
|
343
|
-
def addInnerGroupIRef(self, iref: InnerPortGroupInCompositionInstanceRef):
|
|
344
|
-
self._inner_group_iref.append(iref)
|
|
345
|
-
|
|
346
|
-
def getInnerGroupIRefs(self) -> List[InnerPortGroupInCompositionInstanceRef]:
|
|
347
|
-
return self._inner_group_iref
|
|
348
|
-
|
|
349
|
-
def addOuterPortRef(self, ref: RefType):
|
|
350
|
-
self._outer_port_ref.append(ref)
|
|
351
|
-
|
|
352
|
-
def getOuterPortRefs(self) -> List[RefType]:
|
|
353
|
-
return self._outer_port_ref
|
|
354
|
-
|
|
355
|
-
class SwComponentType(ARElement):
|
|
356
|
-
__metaclass__ = ABCMeta
|
|
357
|
-
|
|
358
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
359
|
-
super().__init__(parent, short_name)
|
|
360
|
-
|
|
361
|
-
def createPPortPrototype(self, short_name: str) -> PPortPrototype:
|
|
362
|
-
prototype = PPortPrototype(self, short_name)
|
|
363
|
-
if (short_name not in self.elements):
|
|
364
|
-
self.elements[short_name] = prototype
|
|
365
|
-
return self.elements[short_name]
|
|
366
|
-
|
|
367
|
-
def createRPortPrototype(self, short_name) -> RPortPrototype:
|
|
368
|
-
prototype = RPortPrototype(self, short_name)
|
|
369
|
-
if (short_name not in self.elements):
|
|
370
|
-
self.elements[short_name] = prototype
|
|
371
|
-
return self.elements[short_name]
|
|
372
|
-
|
|
373
|
-
def createPortGroup(self, short_name) -> PortGroup:
|
|
374
|
-
port_group = PortGroup(self, short_name)
|
|
375
|
-
if (short_name not in self.elements):
|
|
376
|
-
self.elements[short_name] = port_group
|
|
377
|
-
return self.elements[short_name]
|
|
378
|
-
|
|
379
|
-
def getPPortPrototypes(self) -> List[PPortPrototype]:
|
|
380
|
-
return list(sorted(filter(lambda c: isinstance(c, PPortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
381
|
-
|
|
382
|
-
def getRPortPrototypes(self) -> List[RPortPrototype]:
|
|
383
|
-
return list(sorted(filter(lambda c: isinstance(c, RPortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
384
|
-
|
|
385
|
-
def getPortPrototypes(self) -> List[PortPrototype]:
|
|
386
|
-
return list(sorted(filter(lambda c: isinstance(c, PortPrototype), self.elements.values()), key= lambda o: o.short_name))
|
|
387
|
-
|
|
388
|
-
def getPortGroups(self) -> List[PortGroup]:
|
|
389
|
-
return list(sorted(filter(lambda c: isinstance(c, PortGroup), self.elements.values()), key= lambda o: o.short_name))
|
|
390
338
|
|
|
391
339
|
class AtomicSwComponentType(SwComponentType):
|
|
392
340
|
__metaclass__ = ABCMeta
|
|
@@ -434,89 +382,4 @@ class ServiceSwComponentType(AtomicSwComponentType):
|
|
|
434
382
|
def __init__(self, parent: ARObject, short_name: str):
|
|
435
383
|
super().__init__(parent, short_name)
|
|
436
384
|
|
|
437
|
-
class SwConnector(Identifiable):
|
|
438
|
-
__metaclass__ = ABCMeta
|
|
439
|
-
|
|
440
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
441
|
-
super().__init__(parent, short_name)
|
|
442
|
-
|
|
443
|
-
self.mapping_ref = None # type: RefType
|
|
444
|
-
|
|
445
|
-
class AssemblySwConnector(SwConnector):
|
|
446
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
447
|
-
super().__init__(parent, short_name)
|
|
448
|
-
|
|
449
|
-
self.provider_iref = None # type: PPortInCompositionInstanceRef
|
|
450
|
-
self.requester_iref = None # type: RPortInCompositionInstanceRef
|
|
451
|
-
|
|
452
|
-
class DelegationSwConnector(SwConnector):
|
|
453
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
454
|
-
super().__init__(parent, short_name)
|
|
455
|
-
|
|
456
|
-
self.inner_port_iref = None # type: PortInCompositionTypeInstanceRef
|
|
457
|
-
self.outer_port_ref = None # type: RefType
|
|
458
|
-
|
|
459
|
-
class PassThroughSwConnector(SwConnector):
|
|
460
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
461
|
-
super().__init__(parent, short_name)
|
|
462
|
-
|
|
463
|
-
self.provided_outer_port_ref = None # type: RefType
|
|
464
|
-
self.required_outer_port_ref = None # type: RefType
|
|
465
|
-
|
|
466
|
-
class SwComponentPrototype(Identifiable):
|
|
467
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
468
|
-
super().__init__(parent, short_name)
|
|
469
|
-
|
|
470
|
-
self.type_tref = RefType()
|
|
471
|
-
|
|
472
|
-
class CompositionSwComponentType(SwComponentType):
|
|
473
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
474
|
-
super().__init__(parent, short_name)
|
|
475
|
-
|
|
476
|
-
self.constant_value_mapping_refs = [] # type: List[RefType]
|
|
477
|
-
self._data_type_mapping_refs = [] # type: List[RefType]
|
|
478
|
-
self.instantiation_rte_event_props = [] # type: List[InstantiationRTEEventProps]
|
|
479
|
-
|
|
480
|
-
def removeAllAssemblySwConnector(self):
|
|
481
|
-
for sw_connector in self.getAssemblySwConnectors():
|
|
482
|
-
self.elements.pop(sw_connector.short_name)
|
|
483
|
-
|
|
484
|
-
def removeAllDelegationSwConnector(self):
|
|
485
|
-
for sw_connector in self.getDelegationSwConnectors():
|
|
486
|
-
self.elements.pop(sw_connector.short_name)
|
|
487
|
-
|
|
488
|
-
def createAssemblySwConnector(self, short_name: str) -> AssemblySwConnector:
|
|
489
|
-
if (short_name not in self.elements):
|
|
490
|
-
connector = AssemblySwConnector(self, short_name)
|
|
491
|
-
self.elements[short_name] = connector
|
|
492
|
-
return self.elements[short_name]
|
|
493
|
-
|
|
494
|
-
def createDelegationSwConnector(self, short_name: str) -> DelegationSwConnector:
|
|
495
|
-
if short_name not in self.elements:
|
|
496
|
-
connector = DelegationSwConnector(self, short_name)
|
|
497
|
-
self.elements[short_name] = connector
|
|
498
|
-
return self.elements[short_name]
|
|
499
|
-
|
|
500
|
-
def getAssemblySwConnectors(self) -> List[AssemblySwConnector]:
|
|
501
|
-
return list(sorted(filter(lambda e: isinstance(e, AssemblySwConnector), self.elements.values()), key = lambda c: c.short_name))
|
|
502
|
-
|
|
503
|
-
def getDelegationSwConnectors(self) -> List[DelegationSwConnector]:
|
|
504
|
-
return list(sorted(filter(lambda e: isinstance(e, DelegationSwConnector), self.elements.values()), key = lambda c: c.short_name))
|
|
505
|
-
|
|
506
|
-
def getSwConnectors(self) -> List[SwConnector]:
|
|
507
|
-
return list(sorted(filter(lambda e: isinstance(e, SwConnector), self.elements.values()), key = lambda c: c.short_name))
|
|
508
|
-
|
|
509
|
-
def createSwComponentPrototype(self, short_name: str) -> SwComponentPrototype:
|
|
510
|
-
if (short_name not in self.elements):
|
|
511
|
-
connector = SwComponentPrototype(self, short_name)
|
|
512
|
-
self.elements[short_name] = connector
|
|
513
|
-
return self.elements[short_name]
|
|
514
|
-
|
|
515
|
-
def getSwComponentPrototypes(self) -> List[SwComponentPrototype]:
|
|
516
|
-
return list(filter(lambda e: isinstance(e, SwComponentPrototype), self.elements.values()))
|
|
517
|
-
|
|
518
|
-
def addDataTypeMapping(self, data_type_mapping_ref: RefType):
|
|
519
|
-
self._data_type_mapping_refs.append(data_type_mapping_ref)
|
|
520
385
|
|
|
521
|
-
def getDataTypeMappings(self) -> List[RefType]:
|
|
522
|
-
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
|