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.
Files changed (52) hide show
  1. armodel/data_models/sw_connector.py +3 -3
  2. armodel/models/__init__.py +4 -2
  3. armodel/models/ar_object.py +1 -1
  4. armodel/models/ar_package.py +185 -151
  5. armodel/models/ar_ref.py +0 -202
  6. armodel/models/common_structure.py +3 -71
  7. armodel/models/communication.py +1 -1
  8. armodel/models/datatype.py +5 -69
  9. armodel/models/end_to_end_protection.py +1 -1
  10. armodel/models/general_structure.py +10 -4
  11. armodel/models/internal_behavior.py +1 -1
  12. armodel/models/m2/autosar_templates/common_structure/implementation.py +21 -0
  13. armodel/models/m2/autosar_templates/common_structure/implementation_data_types.py +148 -0
  14. armodel/models/m2/autosar_templates/ecuc_description_template.py +2 -1
  15. armodel/models/m2/autosar_templates/generic_structure/__init__.py +0 -0
  16. armodel/models/m2/autosar_templates/generic_structure/abstract_structure.py +69 -0
  17. armodel/models/m2/autosar_templates/sw_component_template/communication.py +44 -0
  18. armodel/models/m2/autosar_templates/sw_component_template/components/__init__.py +246 -0
  19. armodel/models/m2/autosar_templates/sw_component_template/components/instance_refs.py +33 -1
  20. armodel/models/m2/autosar_templates/sw_component_template/composition/__init__.py +154 -0
  21. armodel/models/m2/autosar_templates/sw_component_template/composition/instance_refs.py +157 -0
  22. armodel/models/m2/autosar_templates/sw_component_template/data_type/__init__.py +0 -0
  23. armodel/models/m2/autosar_templates/sw_component_template/data_type/data_prototypes.py +104 -0
  24. armodel/models/m2/autosar_templates/sw_component_template/port_interface/__init__.py +243 -0
  25. armodel/models/m2/autosar_templates/sw_component_template/port_interface/instance_refs.py +39 -0
  26. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/data_elements.py +3 -11
  27. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/instance_refs_usage.py +169 -0
  28. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/mode_declaration_group.py +1 -2
  29. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +5 -4
  30. armodel/models/m2/autosar_templates/system_template/instance_refs.py +48 -0
  31. armodel/models/m2_msr.py +1 -0
  32. armodel/models/port_prototype.py +1 -90
  33. armodel/models/service_needs.py +3 -1
  34. armodel/models/sw_component.py +6 -143
  35. armodel/parser/__init__.py +2 -1
  36. armodel/parser/arxml_parser.py +124 -58
  37. armodel/parser/file_parser.py +43 -0
  38. armodel/tests/test_armodel/models/test_ar_package.py +5 -2
  39. armodel/tests/test_armodel/models/test_ar_ref.py +15 -13
  40. armodel/tests/test_armodel/models/test_common_structure.py +6 -5
  41. armodel/tests/test_armodel/models/test_data_prototype.py +1 -1
  42. armodel/tests/test_armodel/models/test_datatype.py +8 -8
  43. armodel/tests/test_armodel/models/test_port_interface.py +1 -1
  44. armodel/tests/test_armodel/parser/test_sw_components.py +1 -1
  45. armodel/writer/abstract_arxml_writer.py +5 -1
  46. armodel/writer/arxml_writer.py +68 -58
  47. {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/METADATA +5 -1
  48. {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/RECORD +52 -39
  49. {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/LICENSE +0 -0
  50. {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/WHEEL +0 -0
  51. {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/entry_points.txt +0 -0
  52. {armodel-1.6.0.dist-info → armodel-1.6.1.dist-info}/top_level.txt +0 -0
armodel/models/ar_ref.py CHANGED
@@ -1,5 +1,3 @@
1
- from abc import ABCMeta
2
- from typing import List
3
1
  from .ar_object import ARObject
4
2
 
5
3
  class RefType(ARObject):
@@ -25,203 +23,3 @@ class TRefType(RefType):
25
23
  def __init__(self):
26
24
  super().__init__()
27
25
 
28
- class AnyInstanceRef(ARObject):
29
- def __init__(self):
30
- super().__init__()
31
-
32
- self.baseRef = None # type: RefType
33
- self.contextElementRef = None # type: RefType
34
- self.targetRef = None # type: RefType
35
-
36
- def getBaseRef(self) -> RefType:
37
- return self.baseRef
38
-
39
- def setBaseRef(self, value: RefType):
40
- self.baseRef = value
41
- return self
42
-
43
- def getContextElementRef(self) -> RefType:
44
- return self.contextElementRef
45
-
46
- def setContextElementRef(self, value: RefType):
47
- self.contextElementRef = value
48
- return self
49
-
50
- def getTargetRef(self) -> RefType:
51
- return self.targetRef
52
-
53
- def setTargetRef(self, value:RefType):
54
- self.targetRef = value
55
- return self
56
-
57
- class AutosarVariableRef(ARObject):
58
- def __init__(self):
59
- super().__init__()
60
-
61
- self.autosarVariableIRef = None # type: VariableInAtomicSWCTypeInstanceRef
62
- self.autosarVariableInImplDatatype = None # type: ArVariableInImplementationDataInstanceRef
63
- self.localVariableRef = None
64
-
65
- def getAutosarVariableIRef(self):
66
- return self.autosarVariableIRef
67
-
68
- def setAutosarVariableIRef(self, value):
69
- self.autosarVariableIRef = value
70
- return self
71
-
72
- def getAutosarVariableInImplDatatype(self):
73
- return self.autosarVariableInImplDatatype
74
-
75
- def setAutosarVariableInImplDatatype(self, value):
76
- self.autosarVariableInImplDatatype = value
77
- return self
78
-
79
- def getLocalVariableRef(self):
80
- return self.localVariableRef
81
-
82
- def setLocalVariableRef(self, value):
83
- self.localVariableRef = value
84
- return self
85
-
86
- class AutosarParameterRef(ARObject):
87
- def __init__(self):
88
- super().__init__()
89
-
90
- self.autosar_parameter_iref = None # type: ParameterInAtomicSWCTypeInstanceRef
91
- self.local_parameter_ref = None # type: RefType
92
-
93
- class AtpInstanceRef(ARObject, metaclass=ABCMeta):
94
- def __init__(self):
95
- if type(self) == AtpInstanceRef:
96
- raise NotImplementedError("AtpInstanceRef is an abstract class.")
97
-
98
- super().__init__()
99
- class VariableInAtomicSWCTypeInstanceRef(AtpInstanceRef):
100
- def __init__(self):
101
- super().__init__()
102
-
103
- self.baseRef = None # type: RefType
104
- self.contextDataPrototypeRefs = [] # type: List[RefType]
105
- self.portPrototypeRef = None # type: RefType
106
- self.rootVariableDataPrototypeRef = None # type: RefType
107
- self.targetDataPrototypeRef = None # type: RefType
108
-
109
- def getBaseRef(self):
110
- return self.baseRef
111
-
112
- def setBaseRef(self, value):
113
- self.baseRef = value
114
- return self
115
-
116
- def getContextDataPrototypeRefs(self):
117
- return self.contextDataPrototypeRefs
118
-
119
- def addContextDataPrototypeRef(self, value):
120
- self.contextDataPrototypeRefs.append(value)
121
- return self
122
-
123
- def getPortPrototypeRef(self):
124
- return self.portPrototypeRef
125
-
126
- def setPortPrototypeRef(self, value):
127
- self.portPrototypeRef = value
128
- return self
129
-
130
- def getRootVariableDataPrototypeRef(self):
131
- return self.rootVariableDataPrototypeRef
132
-
133
- def setRootVariableDataPrototypeRef(self, value):
134
- self.rootVariableDataPrototypeRef = value
135
- return self
136
-
137
- def getTargetDataPrototypeRef(self):
138
- return self.targetDataPrototypeRef
139
-
140
- def setTargetDataPrototypeRef(self, value):
141
- self.targetDataPrototypeRef = value
142
- return self
143
-
144
-
145
- class PortInCompositionTypeInstanceRef(AtpInstanceRef, metaclass=ABCMeta):
146
- def __init__(self):
147
- if type(self) == PortInCompositionTypeInstanceRef:
148
- raise NotImplementedError("PortInCompositionTypeInstanceRef is an abstract class.")
149
- super().__init__()
150
-
151
- self.abstract_context_component_ref = None # type: RefType
152
- self.base_ref = None # type: RefType
153
- self.target_port_ref = None # type: RefType
154
-
155
- class PPortInCompositionInstanceRef(PortInCompositionTypeInstanceRef):
156
- def __init__(self):
157
- super().__init__()
158
- self.context_component_ref = None # type: RefType
159
- self.target_p_port_ref = None # type: RefType
160
-
161
- class RPortInCompositionInstanceRef(PortInCompositionTypeInstanceRef):
162
- def __init__(self):
163
- super().__init__()
164
- self.context_component_ref = None # type: RefType
165
- self.target_r_port_ref = None # type: RefType
166
-
167
- class ArVariableInImplementationDataInstanceRef(AtpInstanceRef):
168
- def __init__(self):
169
- super().__init__()
170
- self.port_prototype_ref = None # type: RefType
171
- self.target_data_prototype_ref = None # type: RefType
172
-
173
- class OperationInAtomicSwcInstanceRef(AtpInstanceRef, metaclass=ABCMeta):
174
- def __init__(self):
175
- if type(self) == OperationInAtomicSwcInstanceRef:
176
- raise NotImplementedError("OperationInAtomicSwcInstanceRef is an abstract class.")
177
- super().__init__()
178
-
179
- class POperationInAtomicSwcInstanceRef(OperationInAtomicSwcInstanceRef):
180
- def __init__(self):
181
- super().__init__()
182
- self.context_p_port_ref = None # type: RefType
183
- self.target_provided_operation_ref = None # type: RefType
184
-
185
- class ROperationInAtomicSwcInstanceRef(OperationInAtomicSwcInstanceRef):
186
- def __init__(self):
187
- super().__init__()
188
- self.context_r_port_ref = None # type: RefType
189
- self.target_required_operation_ref = None # type: RefType
190
-
191
- class ParameterInAtomicSWCTypeInstanceRef(AtpInstanceRef):
192
- def __init__(self):
193
- super().__init__()
194
-
195
- self.base_ref = None # type: RefType
196
- self.context_data_prototype_ref = None # type: RefType
197
- self.port_prototype_ref = None # type: RefType
198
- self.root_parameter_data_prototype_ref = None # type: RefType
199
- self.target_data_prototype_ref = None # type: RefType
200
-
201
- class ApplicationCompositeElementInPortInterfaceInstanceRef(AtpInstanceRef):
202
- def __init__(self):
203
- super().__init__()
204
-
205
- self.base_ref = None # type: RefType
206
- self.context_data_prototype_ref = None # type: RefType
207
- self.root_data_prototype_ref = None # type: RefType
208
- self.target_data_prototype_ref = None # type: RefType
209
-
210
- class InnerPortGroupInCompositionInstanceRef(AtpInstanceRef):
211
- def __init__(self):
212
- super().__init__()
213
-
214
- self.baseRef = None # type: RefType
215
- self.contextRef = None # type: RefType
216
- self.targetRef = None # type: RefType
217
-
218
- class VariableDataPrototypeInSystemInstanceRef(AtpInstanceRef):
219
- def __init__(self):
220
- super().__init__()
221
-
222
- self.base_ref = None # type: RefType
223
- self.context_component_refs = [] # type: List[RefType]
224
- self.context_composition_ref = None # type: RefType
225
- self.context_port_ref = None # type: RefType
226
- self.target_data_prototype_ref = None # type: RefType
227
-
@@ -10,74 +10,6 @@ from .ar_ref import RefType, TRefType
10
10
 
11
11
  import re
12
12
 
13
- class AbstractImplementationDataTypeElement(Identifiable):
14
- def __init__(self, parent, short_name: str):
15
- super().__init__(parent, short_name)
16
-
17
- class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
18
- ARRAY_SIZE_SEMANTICS_FIXED_SIZE = "FIXED-SIZE"
19
- ARRAY_SIZE_SEMANTICS_VARIABLE_SIZE = "VARIABLE_SIZE"
20
-
21
- def __init__(self, parent, short_name: str):
22
- super().__init__(parent, short_name)
23
-
24
- self.arrayImplPolicy = None # type: ARLiteral
25
- self.arraySize = None # type: ARNumerical
26
- self.arraySizeHandling = None # type: ARLiteral
27
- self.arraySizeSemantics = None # type: ARLiteral
28
- self.isOptional = None # type: ARBoolean
29
- self.swDataDefProps = None # type: SwDataDefProps
30
-
31
- def getArrayImplPolicy(self):
32
- return self.arrayImplPolicy
33
-
34
- def setArrayImplPolicy(self, value):
35
- self.arrayImplPolicy = value
36
- return self
37
-
38
- def getArraySize(self):
39
- return self.arraySize
40
-
41
- def setArraySize(self, value):
42
- self.arraySize = value
43
- return self
44
-
45
- def getArraySizeHandling(self):
46
- return self.arraySizeHandling
47
-
48
- def setArraySizeHandling(self, value):
49
- self.arraySizeHandling = value
50
- return self
51
-
52
- def getArraySizeSemantics(self):
53
- return self.arraySizeSemantics
54
-
55
- def setArraySizeSemantics(self, value):
56
- self.arraySizeSemantics = value
57
- return self
58
-
59
- def getIsOptional(self):
60
- return self.isOptional
61
-
62
- def setIsOptional(self, value):
63
- self.isOptional = value
64
- return self
65
-
66
- def getSwDataDefProps(self):
67
- return self.swDataDefProps
68
-
69
- def setSwDataDefProps(self, value):
70
- self.swDataDefProps = value
71
- return self
72
-
73
- def createImplementationDataTypeElement(self, short_name: str): # type: (...) -> ImplementationDataTypeElement
74
- if (short_name not in self.elements):
75
- event = ImplementationDataTypeElement(self, short_name)
76
- self.elements[short_name] = event
77
- return self.elements[short_name]
78
-
79
- def getImplementationDataTypeElements(self): # type:(...) -> List[ImplementationDataTypeElement]
80
- return list(filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values()))
81
13
 
82
14
  class ExclusiveArea(Identifiable):
83
15
  def __init__(self, parent: ARObject, short_name: str):
@@ -249,9 +181,9 @@ class MemorySection(Identifiable):
249
181
 
250
182
  @alignment.setter
251
183
  def alignment(self, value: ARLiteral):
252
- if value is not None:
184
+ if value is not None and value.getValue() != "":
253
185
  match = False
254
- if value.value in ("UNKNOWN", "UNSPECIFIED", "BOOLEAN", "PTR"):
186
+ if value.getValue() in ("UNKNOWN", "UNSPECIFIED", "BOOLEAN", "PTR"):
255
187
  self._alignment = value
256
188
  match = True
257
189
  else:
@@ -261,7 +193,7 @@ class MemorySection(Identifiable):
261
193
  match = True
262
194
 
263
195
  if not match:
264
- raise ValueError("Invalid alignment <%s> of memory section <%s>" % (value, self.short_name))
196
+ raise ValueError("Invalid alignment <%s> of memory section <%s>" % (value, self.getShortName()))
265
197
 
266
198
  def addOption(self, option: ARLiteral):
267
199
  self.options.append(option)
@@ -1,6 +1,6 @@
1
1
 
2
+ from .m2.autosar_templates.sw_component_template.port_interface.instance_refs import ApplicationCompositeElementInPortInterfaceInstanceRef
2
3
  from .m2.msr.data_dictionary.data_def_properties import SwDataDefProps
3
- from .ar_ref import ApplicationCompositeElementInPortInterfaceInstanceRef
4
4
  from .ar_object import ARObject
5
5
 
6
6
  class TransmissionAcknowledgementRequest(ARObject):
@@ -3,22 +3,9 @@ from typing import List
3
3
 
4
4
  from .ar_object import ARLiteral, ARNumerical
5
5
  from .ar_ref import RefType
6
- from .ar_package import Referrable
7
6
  from .general_structure import ARElement, ARObject
8
- from .data_prototype import ApplicationCompositeElementDataPrototype, ApplicationRecordElement
9
- from .common_structure import ImplementationDataTypeElement, ModeRequestTypeMap
10
-
11
- class ImplementationProps(Referrable, metaclass=ABCMeta):
12
- def __init__(self, parent: ARObject, short_name: str):
13
- if type(self) == ImplementationProps:
14
- raise NotImplementedError("ImplementationProps is an abstract class.")
15
-
16
- super().__init__(parent, short_name)
17
- self.symbol = ""
18
-
19
- class SymbolProps(ImplementationProps):
20
- def __init__(self, parent: ARObject, short_name: str):
21
- super().__init__(parent, short_name)
7
+ from .m2.autosar_templates.sw_component_template.data_type.data_prototypes import ApplicationCompositeElementDataPrototype, ApplicationRecordElement
8
+ from .common_structure import ModeRequestTypeMap
22
9
 
23
10
  class BaseTypeDefinition(ARObject):
24
11
  def __init__(self):
@@ -29,9 +16,9 @@ class BaseTypeDirectDefinition(BaseTypeDefinition):
29
16
  super().__init__()
30
17
 
31
18
  self.base_type_encoding = None
32
- self.base_type_size = None # type: ARNumerical
33
- self.byteOrder = None # type: str
34
- self.mem_alignment = None # type: ARNumerical
19
+ self.base_type_size = None # type: ARNumerical
20
+ self.byteOrder = None # type: str
21
+ self.mem_alignment = None # type: ARNumerical
35
22
  self.native_declaration = None
36
23
 
37
24
  class BaseType(ARElement, metaclass=ABCMeta):
@@ -146,58 +133,7 @@ class ApplicationRecordDataType(ApplicationCompositeDataType):
146
133
  def getApplicationRecordElements(self) -> List[ApplicationRecordElement]:
147
134
  return self.record_elements
148
135
 
149
- class AbstractImplementationDataType(AutosarDataType, metaclass=ABCMeta):
150
- def __init__(self, parent: ARObject, short_name: str):
151
- if type(self) == AbstractImplementationDataType:
152
- raise NotImplementedError("AbstractImplementationDataType is an abstract class.")
153
-
154
- super().__init__(parent, short_name)
155
-
156
-
157
- class ImplementationDataType(AbstractImplementationDataType):
158
- CATEGORY_TYPE_REFERENCE = "TYPE_REFERENCE"
159
- CATEGORY_TYPE_VALUE = "VALUE"
160
- CATEGORY_TYPE_STRUCTURE = "STRUCTURE"
161
- CATEGORY_DATA_REFERENCE = "DATA_REFERENCE"
162
- CATEGORY_ARRAY = "ARRAY"
163
-
164
- def __init__(self, parent: ARObject, short_name: str):
165
- super().__init__(parent, short_name)
166
-
167
- self.sub_elements = [] # type: List[str]
168
- self.symbol_props = None # type: ARLiteral
169
- self._type_emitter = None # type: ARLiteral
170
-
171
- self._array_type = None # ImplementationDataType
172
-
173
- #type: ImplementationDataTypeElement
174
- def createImplementationDataTypeElement(self, short_name: str):
175
- self.sub_elements.append(short_name)
176
- if (short_name not in self.elements):
177
- event = ImplementationDataTypeElement(self, short_name)
178
- self.elements[short_name] = event
179
- return self.elements[short_name]
180
136
 
181
- def getImplementationDataTypeElements(self) -> List[ImplementationDataTypeElement]:
182
- elements = []
183
- for sub_element in self.sub_elements:
184
- elements.append(self.elements[sub_element])
185
- return elements
186
- # return filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values())
187
-
188
- def getArrayElementType(self) -> str:
189
- return self._array_type
190
-
191
- def setArrayElementType(self, type: str):
192
- self._array_type = type
193
- return self
194
-
195
- def setTypeEmitter(self, emitter: str):
196
- self._type_emitter = emitter
197
- return self
198
-
199
- def getTypeEmitter(self) -> str:
200
- return self._type_emitter
201
137
 
202
138
 
203
139
  class DataTypeMap(ARObject):
@@ -1,6 +1,6 @@
1
1
  from typing import List
2
2
 
3
- from .ar_ref import VariableDataPrototypeInSystemInstanceRef
3
+ from .m2.autosar_templates.system_template.instance_refs import VariableDataPrototypeInSystemInstanceRef
4
4
  from .ar_object import ARNumerical, ARObject
5
5
  from .general_structure import Identifiable
6
6
 
@@ -4,7 +4,7 @@ from typing import List
4
4
  from .annotation import Annotation
5
5
  from .ar_ref import RefType
6
6
  from .multilanguage_data import MultiLanguageOverviewParagraph, MultilanguageLongName
7
- from .ar_object import ARObject
7
+ from .ar_object import ARObject, ARLiteral
8
8
 
9
9
  class Sd(ARObject):
10
10
  def __init__(self):
@@ -108,7 +108,10 @@ class Referrable(ARObject, metaclass=ABCMeta):
108
108
  @property
109
109
  def full_name(self) -> str:
110
110
  return self._parent.full_name + "/" + self.short_name
111
-
111
+
112
+ def getFullName(self) -> str:
113
+ return self.full_name
114
+
112
115
  class MultilanguageReferrable(Referrable, metaclass = ABCMeta):
113
116
  def __init__(self, parent: ARObject, short_name: str):
114
117
  if type(self) == MultilanguageReferrable:
@@ -142,6 +145,9 @@ class CollectableElement(ARObject, metaclass = ABCMeta):
142
145
 
143
146
  def getElements(self):
144
147
  return self.elements.values()
148
+
149
+ def addElement(self, element: Referrable):
150
+ self.elements[element.getShortName()] = element
145
151
 
146
152
  def getElement(self, short_name: str) -> Referrable:
147
153
  if (short_name not in self.elements):
@@ -157,7 +163,7 @@ class Identifiable(MultilanguageReferrable, CollectableElement, metaclass=ABCMet
157
163
 
158
164
  self.annotations = [] # type: List[Annotation]
159
165
  self.adminData = None # type: AdminData
160
- self.category = None
166
+ self.category = None # type: ARLiteral
161
167
  self.desc = None # type: MultiLanguageOverviewParagraph
162
168
 
163
169
  def getAdminData(self):
@@ -213,7 +219,7 @@ class Describable(ARObject, metaclass=ABCMeta):
213
219
  return self._category
214
220
 
215
221
  @category.setter
216
- def category(self, value):
222
+ def category(self, value: ARLiteral):
217
223
  self._category = value
218
224
 
219
225
  class AtpFeature(Identifiable, metaclass=ABCMeta):
@@ -4,7 +4,7 @@ from typing import List
4
4
  from .ar_object import ARLiteral, ARObject
5
5
  from .ar_ref import RefType
6
6
  from .common_structure import ExclusiveArea
7
- from .data_prototype import ParameterDataPrototype
7
+ from .m2.autosar_templates.sw_component_template.data_type.data_prototypes import ParameterDataPrototype
8
8
  from .general_structure import Identifiable
9
9
 
10
10
  class IncludedDataTypeSet(ARObject):
@@ -0,0 +1,21 @@
1
+ from abc import ABCMeta
2
+
3
+ from ....ar_object import ARLiteral, ARObject
4
+ from ....general_structure import Referrable
5
+
6
+
7
+ class ImplementationProps(Referrable, metaclass = ABCMeta):
8
+ def __init__(self, parent: ARObject, short_name: str):
9
+ if type(self) == ImplementationProps:
10
+ raise NotImplementedError("ImplementationProps is an abstract class.")
11
+
12
+ super().__init__(parent, short_name)
13
+
14
+ self.symbol = None # type: ARLiteral
15
+
16
+ def getSymbol(self):
17
+ return self.symbol
18
+
19
+ def setSymbol(self, value):
20
+ self.symbol = value
21
+ return self
@@ -0,0 +1,148 @@
1
+ from abc import ABCMeta
2
+ from typing import List
3
+
4
+ from ...msr.data_dictionary.data_def_properties import SwDataDefProps
5
+ from ....general_structure import Identifiable
6
+ from ....ar_object import ARBoolean, ARLiteral, ARNumerical, ARObject
7
+ from ....datatype import AutosarDataType
8
+ from ..sw_component_template.components import SymbolProps
9
+
10
+ class AbstractImplementationDataTypeElement(Identifiable):
11
+ def __init__(self, parent, short_name: str):
12
+ super().__init__(parent, short_name)
13
+
14
+ class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
15
+ ARRAY_SIZE_SEMANTICS_FIXED_SIZE = "FIXED-SIZE"
16
+ ARRAY_SIZE_SEMANTICS_VARIABLE_SIZE = "VARIABLE_SIZE"
17
+
18
+ def __init__(self, parent, short_name: str):
19
+ super().__init__(parent, short_name)
20
+
21
+ self.arrayImplPolicy = None # type: ARLiteral
22
+ self.arraySize = None # type: ARNumerical
23
+ self.arraySizeHandling = None # type: ARLiteral
24
+ self.arraySizeSemantics = None # type: ARLiteral
25
+ self.isOptional = None # type: ARBoolean
26
+ self.swDataDefProps = None # type: SwDataDefProps
27
+
28
+ def getArrayImplPolicy(self):
29
+ return self.arrayImplPolicy
30
+
31
+ def setArrayImplPolicy(self, value):
32
+ self.arrayImplPolicy = value
33
+ return self
34
+
35
+ def getArraySize(self):
36
+ return self.arraySize
37
+
38
+ def setArraySize(self, value):
39
+ self.arraySize = value
40
+ return self
41
+
42
+ def getArraySizeHandling(self):
43
+ return self.arraySizeHandling
44
+
45
+ def setArraySizeHandling(self, value):
46
+ self.arraySizeHandling = value
47
+ return self
48
+
49
+ def getArraySizeSemantics(self):
50
+ return self.arraySizeSemantics
51
+
52
+ def setArraySizeSemantics(self, value):
53
+ self.arraySizeSemantics = value
54
+ return self
55
+
56
+ def getIsOptional(self):
57
+ return self.isOptional
58
+
59
+ def setIsOptional(self, value):
60
+ self.isOptional = value
61
+ return self
62
+
63
+ def getSwDataDefProps(self):
64
+ return self.swDataDefProps
65
+
66
+ def setSwDataDefProps(self, value):
67
+ self.swDataDefProps = value
68
+ return self
69
+
70
+ def createImplementationDataTypeElement(self, short_name: str): # type: (...) -> ImplementationDataTypeElement
71
+ if (short_name not in self.elements):
72
+ event = ImplementationDataTypeElement(self, short_name)
73
+ self.elements[short_name] = event
74
+ return self.elements[short_name]
75
+
76
+ def getImplementationDataTypeElements(self): # type:(...) -> List[ImplementationDataTypeElement]
77
+ return list(filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values()))
78
+
79
+
80
+ class AbstractImplementationDataType(AutosarDataType, metaclass = ABCMeta):
81
+ def __init__(self, parent: ARObject, short_name: str):
82
+ if type(self) == AbstractImplementationDataType:
83
+ raise NotImplementedError("AbstractImplementationDataType is an abstract class.")
84
+
85
+ super().__init__(parent, short_name)
86
+
87
+ class ImplementationDataType(AbstractImplementationDataType):
88
+ CATEGORY_TYPE_REFERENCE = "TYPE_REFERENCE"
89
+ CATEGORY_TYPE_VALUE = "VALUE"
90
+ CATEGORY_TYPE_STRUCTURE = "STRUCTURE"
91
+ CATEGORY_DATA_REFERENCE = "DATA_REFERENCE"
92
+ CATEGORY_ARRAY = "ARRAY"
93
+
94
+ def __init__(self, parent: ARObject, short_name: str):
95
+ super().__init__(parent, short_name)
96
+
97
+ self.sub_elements = [] # type: List[str]
98
+ self.symbolProps = None # type: SymbolProps
99
+ self._type_emitter = None # type: ARLiteral
100
+
101
+ self._array_type = None # ImplementationDataType
102
+ self._struct_type = None # ImplementationDataType
103
+
104
+
105
+ def createImplementationDataTypeElement(self, short_name: str) -> ImplementationDataTypeElement:
106
+ self.sub_elements.append(short_name)
107
+ if (short_name not in self.elements):
108
+ event = ImplementationDataTypeElement(self, short_name)
109
+ self.elements[short_name] = event
110
+ return self.elements[short_name]
111
+
112
+ def getImplementationDataTypeElements(self) -> List[ImplementationDataTypeElement]:
113
+ elements = []
114
+ for sub_element in self.sub_elements:
115
+ elements.append(self.elements[sub_element])
116
+ return elements
117
+ # return filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values())
118
+
119
+ def getArrayElementType(self) -> str:
120
+ return self._array_type
121
+
122
+ def setArrayElementType(self, type: str):
123
+ self._array_type = type
124
+ return self
125
+
126
+ def setTypeEmitter(self, emitter: str):
127
+ self._type_emitter = emitter
128
+ return self
129
+
130
+ def getTypeEmitter(self) -> str:
131
+ return self._type_emitter
132
+
133
+ def setStructElementType(self, type: str):
134
+ self._struct_type = type
135
+ return self
136
+
137
+ def getStructElementType(self) -> str:
138
+ return self._struct_type
139
+
140
+ def createSymbolProps(self, short_name: str) -> SymbolProps:
141
+ if short_name not in self.element:
142
+ symbol_props = SymbolProps(self, short_name)
143
+ self.elements[short_name] = symbol_props
144
+ self.symbolProps = symbol_props
145
+ return self.symbolProps
146
+
147
+ def getSymbolProps(self) -> SymbolProps:
148
+ return self.symbolProps
@@ -1,9 +1,10 @@
1
1
  from abc import ABCMeta
2
2
  from typing import List
3
3
 
4
+ from ..autosar_templates.generic_structure.abstract_structure import AnyInstanceRef
4
5
  from ..msr.documentation.block_elements import DocumentationBlock
5
6
  from ...annotation import Annotation
6
- from ...ar_ref import AnyInstanceRef, RefType
7
+ from ...ar_ref import RefType
7
8
  from ...ar_object import ARBoolean, ARLiteral, ARNumerical, ARObject
8
9
  from ...general_structure import ARElement
9
10