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.
Files changed (96) hide show
  1. armodel/cli/arxml_dump_cli.py +13 -13
  2. armodel/cli/memory_section_cli.py +76 -0
  3. armodel/cli/system_signal_cli.py +74 -0
  4. armodel/data_models/sw_connector.py +3 -3
  5. armodel/lib/__init__.py +2 -1
  6. armodel/lib/system_signal.py +37 -0
  7. armodel/models/__init__.py +9 -4
  8. armodel/models/annotation.py +27 -3
  9. armodel/models/ar_object.py +18 -6
  10. armodel/models/ar_package.py +271 -127
  11. armodel/models/ar_ref.py +11 -166
  12. armodel/models/bsw_module_template.py +37 -14
  13. armodel/models/common_structure.py +91 -174
  14. armodel/models/communication.py +2 -2
  15. armodel/models/data_prototype.py +41 -6
  16. armodel/models/datatype.py +16 -74
  17. armodel/models/end_to_end_protection.py +1 -1
  18. armodel/models/fibex/can_communication.py +119 -3
  19. armodel/models/fibex/fibex_4_can/__init__.py +0 -0
  20. armodel/models/fibex/fibex_4_lin/__init__.py +0 -0
  21. armodel/models/fibex/fibex_4_multiplatform.py +81 -88
  22. armodel/models/fibex/fibex_core/__init__.py +0 -0
  23. armodel/models/fibex/fibex_core/core_communication.py +627 -0
  24. armodel/models/fibex/fibex_core/core_topology.py +180 -0
  25. armodel/models/fibex/lin_communication.py +24 -3
  26. armodel/models/general_structure.py +110 -11
  27. armodel/models/internal_behavior.py +1 -1
  28. armodel/models/m2/__init__.py +0 -0
  29. armodel/models/m2/autosar_templates/__init__.py +0 -0
  30. armodel/models/m2/autosar_templates/common_structure/__init__.py +188 -0
  31. armodel/models/m2/autosar_templates/common_structure/constants.py +0 -0
  32. armodel/models/m2/autosar_templates/common_structure/implementation.py +21 -0
  33. armodel/models/m2/autosar_templates/common_structure/implementation_data_types.py +148 -0
  34. armodel/models/m2/autosar_templates/ecuc_description_template.py +269 -0
  35. armodel/models/m2/autosar_templates/generic_structure/__init__.py +0 -0
  36. armodel/models/m2/autosar_templates/generic_structure/abstract_structure.py +69 -0
  37. armodel/models/m2/autosar_templates/sw_component_template/__init__.py +0 -0
  38. armodel/models/m2/autosar_templates/sw_component_template/communication.py +360 -0
  39. armodel/models/m2/autosar_templates/sw_component_template/components/__init__.py +246 -0
  40. armodel/models/m2/autosar_templates/sw_component_template/components/instance_refs.py +181 -0
  41. armodel/models/m2/autosar_templates/sw_component_template/composition/__init__.py +154 -0
  42. armodel/models/m2/autosar_templates/sw_component_template/composition/instance_refs.py +157 -0
  43. armodel/models/m2/autosar_templates/sw_component_template/data_type/__init__.py +0 -0
  44. armodel/models/m2/autosar_templates/sw_component_template/data_type/data_prototypes.py +104 -0
  45. armodel/models/m2/autosar_templates/sw_component_template/port_interface/__init__.py +243 -0
  46. armodel/models/m2/autosar_templates/sw_component_template/port_interface/instance_refs.py +39 -0
  47. armodel/models/m2/autosar_templates/sw_component_template/port_interface.py +236 -0
  48. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/__init__.py +203 -0
  49. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/access_count.py +13 -0
  50. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/data_elements.py +46 -0
  51. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/instance_refs_usage.py +169 -0
  52. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/mode_declaration_group.py +38 -0
  53. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +27 -0
  54. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/trigger.py +10 -0
  55. armodel/models/m2/autosar_templates/system_template/__init__.py +321 -0
  56. armodel/models/m2/autosar_templates/system_template/data_mapping.py +88 -0
  57. armodel/models/m2/autosar_templates/system_template/instance_refs.py +48 -0
  58. armodel/models/m2/autosar_templates/system_template/network_management.py +554 -0
  59. armodel/models/m2/autosar_templates/system_template/transport_protocols.py +7 -0
  60. armodel/models/m2/msr/__init__.py +0 -0
  61. armodel/models/m2/msr/asam_hdo/__init__.py +0 -0
  62. armodel/models/m2/msr/asam_hdo/units.py +105 -0
  63. armodel/models/m2/msr/data_dictionary/__init__.py +0 -0
  64. armodel/models/m2/msr/data_dictionary/auxillary_objects.py +42 -0
  65. armodel/models/m2/msr/data_dictionary/data_def_properties.py +295 -0
  66. armodel/models/m2/msr/documentation/__init__.py +0 -0
  67. armodel/models/m2/msr/documentation/block_elements.py +18 -0
  68. armodel/models/m2_msr.py +1 -0
  69. armodel/models/multilanguage_data.py +15 -0
  70. armodel/models/per_instance_memory.py +34 -6
  71. armodel/models/port_prototype.py +2 -253
  72. armodel/models/service_needs.py +3 -1
  73. armodel/models/sw_component.py +19 -358
  74. armodel/parser/__init__.py +2 -1
  75. armodel/parser/abstract_arxml_parser.py +10 -1
  76. armodel/parser/arxml_parser.py +912 -229
  77. armodel/parser/file_parser.py +43 -0
  78. armodel/tests/test_armodel/models/test_ar_package.py +6 -3
  79. armodel/tests/test_armodel/models/test_ar_ref.py +18 -16
  80. armodel/tests/test_armodel/models/test_bsw_module_template.py +5 -5
  81. armodel/tests/test_armodel/models/test_common_structure.py +8 -7
  82. armodel/tests/test_armodel/models/test_data_dictionary.py +5 -5
  83. armodel/tests/test_armodel/models/test_data_prototype.py +2 -2
  84. armodel/tests/test_armodel/models/test_datatype.py +9 -9
  85. armodel/tests/test_armodel/models/test_port_interface.py +2 -2
  86. armodel/tests/test_armodel/parser/test_parse_bswmd.py +3 -3
  87. armodel/tests/test_armodel/parser/test_sw_components.py +3 -3
  88. armodel/writer/abstract_arxml_writer.py +5 -1
  89. armodel/writer/arxml_writer.py +870 -224
  90. {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/METADATA +28 -1
  91. armodel-1.6.1.dist-info/RECORD +140 -0
  92. {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/entry_points.txt +3 -1
  93. armodel-1.5.0.dist-info/RECORD +0 -91
  94. {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/LICENSE +0 -0
  95. {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/WHEEL +0 -0
  96. {armodel-1.5.0.dist-info → armodel-1.6.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,243 @@
1
+ from abc import ABCMeta
2
+ from typing import List
3
+
4
+ from ..data_type.data_prototypes import ParameterDataPrototype, VariableDataPrototype, AutosarDataPrototype
5
+ from .....ar_object import ARBoolean, ARLiteral, ARNumerical
6
+ from .....common_structure import ModeDeclarationGroupPrototype, Trigger
7
+ from .....datatype import AtpType
8
+ from .....general_structure import ARObject, Identifiable, AtpFeature
9
+ from .....ar_ref import RefType
10
+
11
+ class PortInterface(AtpType, metaclass = ABCMeta):
12
+ def __init__(self, parent: ARObject, short_name: str):
13
+ if type(self) == PortInterface:
14
+ raise NotImplementedError("PortInterface is an abstract class.")
15
+ super().__init__(parent, short_name)
16
+
17
+ self.isService = None # type: ARBoolean
18
+ self.serviceKind = None # type: ARLiteral
19
+
20
+ def getIsService(self):
21
+ return self.isService
22
+
23
+ def setIsService(self, value):
24
+ self.isService = value
25
+ return self
26
+
27
+ def getServiceKind(self):
28
+ return self.serviceKind
29
+
30
+ def setServiceKind(self, value):
31
+ self.serviceKind = value
32
+ return self
33
+
34
+ class DataInterface(PortInterface, metaclass = ABCMeta):
35
+ def __init__(self, parent: ARObject, short_name: str):
36
+ if type(self) == DataInterface:
37
+ raise NotImplementedError("DataInterface is an abstract class.")
38
+ super().__init__(parent, short_name)
39
+
40
+ class NvDataInterface(DataInterface):
41
+ def __init__(self, parent: ARObject, short_name: str):
42
+ super().__init__(parent, short_name)
43
+
44
+ self.nvDatas = [] # type: List[VariableDataPrototype]
45
+
46
+ def getNvDatas(self):
47
+ return self.nvDatas
48
+
49
+ def setNvData(self, value):
50
+ self.nvDatas.append(value)
51
+ return self
52
+
53
+ class ParameterInterface(DataInterface):
54
+ def __init__(self, parent: ARObject, short_name: str):
55
+ super().__init__(parent, short_name)
56
+
57
+ self.parameters = [] # type: List[ParameterDataPrototype]
58
+
59
+ def getParameters(self):
60
+ return list(sorted(filter(lambda a : isinstance(a, ParameterDataPrototype), self.elements.values()), key = lambda a: a.short_name))
61
+
62
+ def createParameter(self, short_name: str) -> ParameterDataPrototype:
63
+ if (short_name not in self.elements):
64
+ parameter = ParameterDataPrototype(self, short_name)
65
+ self.elements[short_name] = parameter
66
+ self.parameters.append(parameter)
67
+ return self.elements[short_name]
68
+
69
+ class InvalidationPolicy(ARObject):
70
+ def __init__(self):
71
+ super().__init__()
72
+
73
+ self.dataElementRef = None # type: RefType
74
+ self.handleInvalid = None # type: ARLiteral
75
+
76
+ def getDataElementRef(self):
77
+ return self.dataElementRef
78
+
79
+ def setDataElementRef(self, value):
80
+ self.dataElementRef = value
81
+ return self
82
+
83
+ def getHandleInvalid(self):
84
+ return self.handleInvalid
85
+
86
+ def setHandleInvalid(self, value):
87
+ self.handleInvalid = value
88
+ return self
89
+
90
+ class SenderReceiverInterface(DataInterface):
91
+ def __init__(self, parent: ARObject, short_name: str):
92
+ super().__init__(parent, short_name)
93
+
94
+ self.invalidationPolicies = [] # type: List[InvalidationPolicy]
95
+ self.metaDataItemSets = [] # type: List[MetaDataItemSet]
96
+
97
+ def getInvalidationPolicies(self):
98
+ return self.invalidationPolicies
99
+
100
+ def addInvalidationPolicy(self, value):
101
+ self.invalidationPolicies.append(value)
102
+ return self
103
+
104
+ def getMetaDataItemSets(self):
105
+ return self.metaDataItemSets
106
+
107
+ def addMetaDataItemSet(self, value):
108
+ self.metaDataItemSets.append(value)
109
+ return self
110
+
111
+ def createDataElement(self, short_name) -> VariableDataPrototype:
112
+ if (short_name not in self.elements):
113
+ data_element = VariableDataPrototype(self, short_name)
114
+ self.elements[short_name] = data_element
115
+ return self.elements[short_name]
116
+
117
+ def getDataElements(self) -> List[VariableDataPrototype]:
118
+ return list(filter(lambda c: isinstance(c, VariableDataPrototype), self.elements.values()))
119
+
120
+ def getDataElement(self, short_name) -> VariableDataPrototype:
121
+ if (short_name in self.elements):
122
+ data_element = self.elements[short_name]
123
+ #if (not isinstance(data_element, VariableDataPrototype)):
124
+ # raise IndexError("%s is not data element." % short_name)
125
+ return data_element
126
+ raise IndexError("data element <%s> can not be found." % short_name)
127
+
128
+ def createInvalidationPolicy(self) -> InvalidationPolicy:
129
+ policy = InvalidationPolicy(self)
130
+ self.invalidation_polivys.append(policy)
131
+ return policy
132
+
133
+ def getInvalidationPolicys(self) -> List[InvalidationPolicy]:
134
+ return list(filter(lambda c: isinstance(c, InvalidationPolicy), self.invalidation_polivys))
135
+
136
+ class ArgumentDataPrototype(AutosarDataPrototype):
137
+ def __init__(self, parent: ARObject, short_name: str):
138
+ super().__init__(parent, short_name)
139
+ self.direction = ""
140
+ self.server_argument_impl_policy = ""
141
+
142
+ class ApplicationError(Identifiable):
143
+ def __init__(self, parent: ARObject, short_name: str):
144
+ super().__init__(parent, short_name)
145
+
146
+ self.error_code = None # type: ARNumerical
147
+
148
+ class ClientServerOperation(AtpFeature):
149
+ """
150
+ An operation declared within the scope of a client/server interface.
151
+ Package: M2::AUTOSARTemplates::SWComponentTemplate::PortInterface
152
+ Base: ARObject, AtpClassifier , AtpFeature, AtpStructureElement, Identifiable, MultilanguageReferrable, Referrable
153
+
154
+ Attributes:
155
+ -----------
156
+ _argument: ArgumentDataPrototype (optional)
157
+ An argument of this ClientServerOperation
158
+
159
+ _possibleError: RefType -> ApplicationError (optional)
160
+ Possible errors that may by raised by the referring operation
161
+
162
+ Methods:
163
+ --------
164
+ addArgumentDataPrototype add the argument
165
+ getArgumentDataPrototypes get the arguments
166
+ addPossibleErrorRef add the possible error
167
+ getPossbileErrorRefs get the possible errors
168
+
169
+ """
170
+ def __init__(self, parent: ARObject, short_name: str):
171
+ super().__init__(parent, short_name)
172
+
173
+ self._arguments = []
174
+ self._possible_error_refs = [] # type: List[RefType]
175
+
176
+ def addArgumentDataPrototype(self, prototype: ArgumentDataPrototype):
177
+ self._arguments.append(prototype)
178
+
179
+ def getArgumentDataPrototypes(self) -> List[ArgumentDataPrototype]:
180
+ return self._arguments
181
+
182
+ def addPossibleErrorRef(self, possible_error_ref: RefType):
183
+ self._possible_error_refs.append(possible_error_ref)
184
+
185
+ def getPossbileErrorRefs(self) -> List[RefType]:
186
+ return self._possible_error_refs
187
+
188
+
189
+ class ClientServerInterface(PortInterface):
190
+ """
191
+ A client/server interface declares a number of operations that can be invoked on a server by a client.
192
+ Package: M2::AUTOSARTemplates::SWComponentTemplate::PortInterface
193
+ Base: ARElement, ARObject, AtpBlueprint, AtpBlueprintable, AtpClassifier , AtpType, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, PortInterface, Referrable
194
+
195
+ Methods:
196
+ --------
197
+ createOperation create ClientServerOperation(s) of this ClientServerInterface.
198
+ createApplicationError create Application errors that are defined as part of this interface
199
+ getOperations get all ClientServerOperation(s) of this ClientServerInterface
200
+ getPossibleErrors get all Application error(s) of this ClientServerInterface
201
+
202
+ """
203
+ def __init__(self, parent: ARObject, short_name: str):
204
+ super().__init__(parent, short_name)
205
+
206
+ def createOperation(self, short_name: str) -> ClientServerOperation:
207
+ if (short_name not in self.elements):
208
+ operation = ClientServerOperation(self, short_name)
209
+ self.elements[short_name] = operation
210
+ return self.elements[short_name]
211
+
212
+ def createApplicationError(self, short_name: str) -> ApplicationError:
213
+ if (short_name not in self.elements):
214
+ error = ApplicationError(self, short_name)
215
+ self.elements[short_name] = error
216
+ return self.elements[short_name]
217
+
218
+ def getOperations(self) -> List[ClientServerOperation]:
219
+ return list(filter(lambda c: isinstance(c, ClientServerOperation), self.elements.values()))
220
+
221
+ def getPossibleErrors(self) -> List[ApplicationError]:
222
+ return list(filter(lambda c: isinstance(c, ApplicationError), self.elements.values()))
223
+
224
+ class TriggerInterface(PortInterface):
225
+ def __init__(self, parent: ARObject, short_name: str):
226
+ super().__init__(parent, short_name)
227
+
228
+ self._triggers = [] # type: Trigger
229
+
230
+ class ModeSwitchInterface(PortInterface):
231
+ def __init__(self, parent: ARObject, short_name: str):
232
+ super().__init__(parent, short_name)
233
+
234
+ self._modeGroup = [] # type: List[ModeDeclarationGroupPrototype]
235
+
236
+ def createModeGroup(self, short_name: str) -> ModeDeclarationGroupPrototype:
237
+ prototype = ModeDeclarationGroupPrototype(self, short_name)
238
+ if (short_name not in self.elements):
239
+ self.elements[short_name] = prototype
240
+ return self.elements[short_name]
241
+
242
+ def getModeGroups(self) -> List[ModeDeclarationGroupPrototype]:
243
+ return list(sorted(filter(lambda c: isinstance(c, ModeDeclarationGroupPrototype), self.elements.values()), key= lambda o: o.short_name))
@@ -0,0 +1,39 @@
1
+ from .....ar_ref import RefType
2
+ from ...generic_structure.abstract_structure import AtpInstanceRef
3
+
4
+ class ApplicationCompositeElementInPortInterfaceInstanceRef(AtpInstanceRef):
5
+ def __init__(self):
6
+ super().__init__()
7
+
8
+ self.baseRef = None # type: RefType
9
+ self.contextDataPrototypeRef = None # type: RefType
10
+ self.rootDataPrototypeRef = None # type: RefType
11
+ self.targetDataPrototypeRef = None # type: RefType
12
+
13
+ def getBaseRef(self):
14
+ return self.baseRef
15
+
16
+ def setBaseRef(self, value):
17
+ self.baseRef = value
18
+ return self
19
+
20
+ def getContextDataPrototypeRef(self):
21
+ return self.contextDataPrototypeRef
22
+
23
+ def setContextDataPrototypeRef(self, value):
24
+ self.contextDataPrototypeRef = value
25
+ return self
26
+
27
+ def getRootDataPrototypeRef(self):
28
+ return self.rootDataPrototypeRef
29
+
30
+ def setRootDataPrototypeRef(self, value):
31
+ self.rootDataPrototypeRef = value
32
+ return self
33
+
34
+ def getTargetDataPrototypeRef(self):
35
+ return self.targetDataPrototypeRef
36
+
37
+ def setTargetDataPrototypeRef(self, value):
38
+ self.targetDataPrototypeRef = value
39
+ return self
@@ -0,0 +1,236 @@
1
+ from abc import ABCMeta
2
+ from typing import List
3
+
4
+ from ....ar_object import ARBoolean, ARLiteral, ARNumerical
5
+ from ....common_structure import ModeDeclarationGroupPrototype, Trigger
6
+ from ....datatype import AtpType
7
+ from ....general_structure import ARObject, Identifiable, AtpFeature
8
+ from ....data_prototype import ParameterDataPrototype, VariableDataPrototype, AutosarDataPrototype
9
+ from ....ar_ref import RefType
10
+
11
+ class PortInterface(AtpType, metaclass = ABCMeta):
12
+ def __init__(self, parent: ARObject, short_name: str):
13
+ if type(self) == PortInterface:
14
+ raise NotImplementedError("PortInterface is an abstract class.")
15
+ super().__init__(parent, short_name)
16
+
17
+ self.isService = None # type: ARBoolean
18
+ self.serviceKind = None # type: ARLiteral
19
+
20
+ def getIsService(self):
21
+ return self.isService
22
+
23
+ def setIsService(self, value):
24
+ self.isService = value
25
+ return self
26
+
27
+ def getServiceKind(self):
28
+ return self.serviceKind
29
+
30
+ def setServiceKind(self, value):
31
+ self.serviceKind = value
32
+ return self
33
+
34
+ class DataInterface(PortInterface, metaclass = ABCMeta):
35
+ def __init__(self, parent: ARObject, short_name: str):
36
+ if type(self) == DataInterface:
37
+ raise NotImplementedError("DataInterface is an abstract class.")
38
+ super().__init__(parent, short_name)
39
+
40
+ class NvDataInterface(DataInterface):
41
+ def __init__(self, parent: ARObject, short_name: str):
42
+ super().__init__(parent, short_name)
43
+
44
+ self.nvDatas = [] # type: List[VariableDataPrototype]
45
+
46
+ def getNvDatas(self):
47
+ return self.nvDatas
48
+
49
+ def setNvData(self, value):
50
+ self.nvDatas.append(value)
51
+ return self
52
+
53
+
54
+ class ParameterInterface(DataInterface):
55
+ def __init__(self, parent: ARObject, short_name: str):
56
+ super().__init__(parent, short_name)
57
+
58
+ self.parameters = [] # type: List[ParameterDataPrototype]
59
+
60
+ def getParameters(self):
61
+ return self.parameters
62
+
63
+ def addParameter(self, value):
64
+ self.parameters.append(value)
65
+ return self
66
+
67
+ class InvalidationPolicy(ARObject):
68
+ def __init__(self):
69
+ super().__init__()
70
+
71
+ self.dataElementRef = None # type: RefType
72
+ self.handleInvalid = None # type: ARLiteral
73
+
74
+ def getDataElementRef(self):
75
+ return self.dataElementRef
76
+
77
+ def setDataElementRef(self, value):
78
+ self.dataElementRef = value
79
+ return self
80
+
81
+ def getHandleInvalid(self):
82
+ return self.handleInvalid
83
+
84
+ def setHandleInvalid(self, value):
85
+ self.handleInvalid = value
86
+ return self
87
+
88
+
89
+
90
+ class SenderReceiverInterface(DataInterface):
91
+ def __init__(self, parent: ARObject, short_name: str):
92
+ super().__init__(parent, short_name)
93
+
94
+ self.invalidationPolicies = [] # type: List[InvalidationPolicy]
95
+ self.metaDataItemSets = [] # type: List[MetaDataItemSet]
96
+
97
+ def getInvalidationPolicies(self):
98
+ return self.invalidationPolicies
99
+
100
+ def addInvalidationPolicy(self, value):
101
+ self.invalidationPolicies.append(value)
102
+ return self
103
+
104
+ def getMetaDataItemSets(self):
105
+ return self.metaDataItemSets
106
+
107
+ def addMetaDataItemSet(self, value):
108
+ self.metaDataItemSets.append(value)
109
+ return self
110
+
111
+
112
+ def createDataElement(self, short_name) -> VariableDataPrototype:
113
+ if (short_name not in self.elements):
114
+ data_element = VariableDataPrototype(self, short_name)
115
+ self.elements[short_name] = data_element
116
+ return self.elements[short_name]
117
+
118
+ def getDataElements(self) -> List[VariableDataPrototype]:
119
+ return list(filter(lambda c: isinstance(c, VariableDataPrototype), self.elements.values()))
120
+
121
+ def getDataElement(self, short_name) -> VariableDataPrototype:
122
+ if (short_name in self.elements):
123
+ data_element = self.elements[short_name]
124
+ #if (not isinstance(data_element, VariableDataPrototype)):
125
+ # raise IndexError("%s is not data element." % short_name)
126
+ return data_element
127
+ raise IndexError("data element <%s> can not be found." % short_name)
128
+
129
+ class ArgumentDataPrototype(AutosarDataPrototype):
130
+ def __init__(self, parent: ARObject, short_name: str):
131
+ super().__init__(parent, short_name)
132
+ self.direction = ""
133
+ self.server_argument_impl_policy = ""
134
+
135
+ class ApplicationError(Identifiable):
136
+ def __init__(self, parent: ARObject, short_name: str):
137
+ super().__init__(parent, short_name)
138
+
139
+ self.error_code = None # type: ARNumerical
140
+
141
+ class ClientServerOperation(AtpFeature):
142
+ """
143
+ An operation declared within the scope of a client/server interface.
144
+ Package: M2::AUTOSARTemplates::SWComponentTemplate::PortInterface
145
+ Base: ARObject, AtpClassifier , AtpFeature, AtpStructureElement, Identifiable, MultilanguageReferrable, Referrable
146
+
147
+ Attributes:
148
+ -----------
149
+ _argument: ArgumentDataPrototype (optional)
150
+ An argument of this ClientServerOperation
151
+
152
+ _possibleError: RefType -> ApplicationError (optional)
153
+ Possible errors that may by raised by the referring operation
154
+
155
+ Methods:
156
+ --------
157
+ addArgumentDataPrototype add the argument
158
+ getArgumentDataPrototypes get the arguments
159
+ addPossibleErrorRef add the possible error
160
+ getPossbileErrorRefs get the possible errors
161
+
162
+ """
163
+ def __init__(self, parent: ARObject, short_name: str):
164
+ super().__init__(parent, short_name)
165
+
166
+ self._arguments = []
167
+ self._possible_error_refs = [] # type: List[RefType]
168
+
169
+ def addArgumentDataPrototype(self, prototype: ArgumentDataPrototype):
170
+ self._arguments.append(prototype)
171
+
172
+ def getArgumentDataPrototypes(self) -> List[ArgumentDataPrototype]:
173
+ return self._arguments
174
+
175
+ def addPossibleErrorRef(self, possible_error_ref: RefType):
176
+ self._possible_error_refs.append(possible_error_ref)
177
+
178
+ def getPossbileErrorRefs(self) -> List[RefType]:
179
+ return self._possible_error_refs
180
+
181
+
182
+ class ClientServerInterface(PortInterface):
183
+ """
184
+ A client/server interface declares a number of operations that can be invoked on a server by a client.
185
+ Package: M2::AUTOSARTemplates::SWComponentTemplate::PortInterface
186
+ Base: ARElement, ARObject, AtpBlueprint, AtpBlueprintable, AtpClassifier , AtpType, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, PortInterface, Referrable
187
+
188
+ Methods:
189
+ --------
190
+ createOperation create ClientServerOperation(s) of this ClientServerInterface.
191
+ createApplicationError create Application errors that are defined as part of this interface
192
+ getOperations get all ClientServerOperation(s) of this ClientServerInterface
193
+ getPossibleErrors get all Application error(s) of this ClientServerInterface
194
+
195
+ """
196
+ def __init__(self, parent: ARObject, short_name: str):
197
+ super().__init__(parent, short_name)
198
+
199
+ def createOperation(self, short_name: str) -> ClientServerOperation:
200
+ if (short_name not in self.elements):
201
+ operation = ClientServerOperation(self, short_name)
202
+ self.elements[short_name] = operation
203
+ return self.elements[short_name]
204
+
205
+ def createApplicationError(self, short_name: str) -> ApplicationError:
206
+ if (short_name not in self.elements):
207
+ error = ApplicationError(self, short_name)
208
+ self.elements[short_name] = error
209
+ return self.elements[short_name]
210
+
211
+ def getOperations(self) -> List[ClientServerOperation]:
212
+ return list(filter(lambda c: isinstance(c, ClientServerOperation), self.elements.values()))
213
+
214
+ def getPossibleErrors(self) -> List[ApplicationError]:
215
+ return list(filter(lambda c: isinstance(c, ApplicationError), self.elements.values()))
216
+
217
+ class TriggerInterface(PortInterface):
218
+ def __init__(self, parent: ARObject, short_name: str):
219
+ super().__init__(parent, short_name)
220
+
221
+ self._triggers = [] # type: Trigger
222
+
223
+ class ModeSwitchInterface(PortInterface):
224
+ def __init__(self, parent: ARObject, short_name: str):
225
+ super().__init__(parent, short_name)
226
+
227
+ self._modeGroup = [] # type: List[ModeDeclarationGroupPrototype]
228
+
229
+ def createModeGroup(self, short_name: str) -> ModeDeclarationGroupPrototype:
230
+ prototype = ModeDeclarationGroupPrototype(self, short_name)
231
+ if (short_name not in self.elements):
232
+ self.elements[short_name] = prototype
233
+ return self.elements[short_name]
234
+
235
+ def getModeGroups(self) -> List[ModeDeclarationGroupPrototype]:
236
+ return list(sorted(filter(lambda c: isinstance(c, ModeDeclarationGroupPrototype), self.elements.values()), key= lambda o: o.short_name))