armodel 1.3.0__py3-none-any.whl → 1.4.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- armodel/__init__.py +2 -1
- armodel/cli/arxml_dump_cli.py +8 -6
- armodel/cli/arxml_format_cli.py +72 -0
- armodel/cli/connector2xlsx_cli.py +75 -0
- armodel/cli/connector_update_cli.py +77 -0
- armodel/cli/swc_list_cli.py +2 -2
- armodel/data_models/__init__.py +0 -0
- armodel/data_models/sw_connector.py +22 -0
- armodel/lib/__init__.py +1 -1
- armodel/lib/sw_component.py +34 -0
- armodel/models/__init__.py +8 -2
- armodel/models/annotation.py +20 -0
- armodel/models/ar_object.py +184 -0
- armodel/models/ar_package.py +144 -14
- armodel/models/ar_ref.py +74 -8
- armodel/models/bsw_module_template.py +97 -25
- armodel/models/calibration.py +119 -0
- armodel/models/common_structure.py +203 -36
- armodel/models/communication.py +17 -0
- armodel/models/data_def_properties.py +16 -0
- armodel/models/data_dictionary.py +46 -9
- armodel/models/data_prototype.py +24 -5
- armodel/models/datatype.py +86 -19
- armodel/models/end_to_end_protection.py +67 -0
- armodel/models/general_structure.py +72 -17
- armodel/models/global_constraints.py +40 -0
- armodel/models/implementation.py +80 -32
- armodel/models/m2_msr.py +82 -6
- armodel/models/multilanguage_data.py +42 -0
- armodel/models/per_instance_memory.py +14 -0
- armodel/models/port_interface.py +27 -4
- armodel/models/port_prototype.py +48 -23
- armodel/models/record_layout.py +118 -0
- armodel/models/service_mapping.py +11 -0
- armodel/models/service_needs.py +48 -0
- armodel/models/sw_component.py +257 -43
- armodel/models/unit.py +14 -0
- armodel/parser/abstract_arxml_parser.py +248 -0
- armodel/parser/arxml_parser.py +1550 -648
- armodel/parser/connector_xlsx_parser.py +190 -0
- armodel/parser/excel_parser.py +18 -0
- armodel/report/__init__.py +1 -0
- armodel/report/connector_xls_report.py +76 -0
- armodel/report/excel_report.py +42 -0
- armodel/tests/__init__.py +0 -0
- armodel/tests/test_armodel/__init__.py +0 -0
- armodel/tests/test_armodel/models/__init__.py +0 -0
- armodel/tests/test_armodel/models/test_ar_object.py +152 -0
- armodel/tests/test_armodel/models/test_ar_package.py +294 -0
- armodel/tests/test_armodel/models/test_ar_ref.py +74 -0
- armodel/tests/test_armodel/models/test_bsw_module_template.py +46 -0
- armodel/tests/test_armodel/models/test_common_structure.py +73 -0
- armodel/tests/test_armodel/models/test_data_dictionary.py +29 -0
- armodel/tests/test_armodel/models/test_data_prototype.py +86 -0
- armodel/tests/test_armodel/models/test_datatype.py +239 -0
- armodel/tests/test_armodel/models/test_general_structure.py +50 -0
- armodel/tests/test_armodel/models/test_implementation.py +26 -0
- armodel/tests/test_armodel/models/test_m2_msr.py +77 -0
- armodel/tests/test_armodel/models/test_port_interface.py +198 -0
- armodel/tests/test_armodel/models/test_port_prototype.py +14 -0
- armodel/tests/test_armodel/parser/__init__.py +0 -0
- armodel/tests/test_armodel/parser/test_arxml_parser.py +15 -0
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +192 -0
- armodel/tests/test_armodel/parser/test_sw_components.py +93 -0
- armodel/writer/__init__.py +1 -0
- armodel/writer/abstract_arxml_writer.py +123 -0
- armodel/writer/arxml_writer.py +1755 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/METADATA +124 -4
- armodel-1.4.3.dist-info/RECORD +78 -0
- armodel-1.4.3.dist-info/entry_points.txt +7 -0
- armodel-1.3.0.dist-info/RECORD +0 -31
- armodel-1.3.0.dist-info/entry_points.txt +0 -4
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/LICENSE +0 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/WHEEL +0 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/top_level.txt +0 -0
armodel/models/datatype.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
|
-
from .general_structure import ARElement, Referrable, ARObject
|
|
4
|
-
from .data_prototype import ApplicationArrayElement, ApplicationRecordElement
|
|
5
|
-
from .data_dictionary import SwDataDefProps
|
|
6
|
-
from .common_structure import ImplementationDataTypeElement
|
|
7
3
|
|
|
4
|
+
from .ar_object import ARLiteral, ARNumerical
|
|
5
|
+
from .ar_ref import RefType
|
|
6
|
+
from .ar_package import Referrable
|
|
7
|
+
from .general_structure import ARElement, ARObject, Identifiable
|
|
8
|
+
from .data_prototype import ApplicationCompositeElementDataPrototype, ApplicationRecordElement
|
|
9
|
+
from .data_dictionary import SwDataDefProps
|
|
10
|
+
from .common_structure import ImplementationDataTypeElement, ModeRequestTypeMap
|
|
8
11
|
|
|
9
12
|
class ImplementationProps(Referrable, metaclass=ABCMeta):
|
|
10
13
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -14,11 +17,23 @@ class ImplementationProps(Referrable, metaclass=ABCMeta):
|
|
|
14
17
|
super().__init__(parent, short_name)
|
|
15
18
|
self.symbol = ""
|
|
16
19
|
|
|
17
|
-
|
|
18
20
|
class SymbolProps(ImplementationProps):
|
|
19
21
|
def __init__(self, parent: ARObject, short_name: str):
|
|
20
22
|
super().__init__(parent, short_name)
|
|
21
23
|
|
|
24
|
+
class BaseTypeDefinition(ARObject):
|
|
25
|
+
def __init__(self):
|
|
26
|
+
super().__init__()
|
|
27
|
+
|
|
28
|
+
class BaseTypeDirectDefinition(BaseTypeDefinition):
|
|
29
|
+
def __init__(self):
|
|
30
|
+
super().__init__()
|
|
31
|
+
|
|
32
|
+
self.base_type_encoding = None
|
|
33
|
+
self.base_type_size = None # type: ARNumerical
|
|
34
|
+
self.byteOrder = None # type: str
|
|
35
|
+
self.mem_alignment = None # type: ARNumerical
|
|
36
|
+
self.native_declaration = None
|
|
22
37
|
|
|
23
38
|
class BaseType(ARElement, metaclass=ABCMeta):
|
|
24
39
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -26,14 +41,13 @@ class BaseType(ARElement, metaclass=ABCMeta):
|
|
|
26
41
|
raise NotImplementedError("BaseType is an abstract class.")
|
|
27
42
|
|
|
28
43
|
super().__init__(parent, short_name)
|
|
29
|
-
self.base_type_definition = None # Type: BaseTypeDefinition
|
|
30
44
|
|
|
45
|
+
self.baseTypeDefinition = BaseTypeDirectDefinition()
|
|
31
46
|
|
|
32
47
|
class SwBaseType(BaseType):
|
|
33
48
|
def __init__(self, parent: ARObject, short_name: str):
|
|
34
49
|
super().__init__(parent, short_name)
|
|
35
50
|
|
|
36
|
-
|
|
37
51
|
class AtpType(ARElement, metaclass=ABCMeta):
|
|
38
52
|
def __init__(self, parent: ARObject, short_name: str):
|
|
39
53
|
if type(self) == AtpType:
|
|
@@ -71,25 +85,60 @@ class ApplicationCompositeDataType(ApplicationDataType, metaclass=ABCMeta):
|
|
|
71
85
|
|
|
72
86
|
super().__init__(parent, short_name)
|
|
73
87
|
|
|
88
|
+
class ApplicationArrayElement(ApplicationCompositeElementDataPrototype):
|
|
89
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
90
|
+
super().__init__(parent, short_name)
|
|
91
|
+
|
|
92
|
+
self.arraySizeHandling = None # type: str
|
|
93
|
+
self.arraySizeSemantics = None # type: str
|
|
94
|
+
self.indexDataTypeRef = None # type: RefType
|
|
95
|
+
self.maxNumberOfElements = None # type: ARNumerical
|
|
96
|
+
|
|
97
|
+
def setArraySizeHandling(self, handling: str):
|
|
98
|
+
self.arraySizeHandling = handling
|
|
99
|
+
return self
|
|
100
|
+
|
|
101
|
+
def setArraySizeSemantics(self, semantics: str):
|
|
102
|
+
self.arraySizeSemantics = semantics
|
|
103
|
+
return self
|
|
104
|
+
|
|
105
|
+
def setIndexDataTypeRef(self, ref: RefType):
|
|
106
|
+
self.indexDataTypeRef = ref
|
|
107
|
+
return self
|
|
108
|
+
|
|
109
|
+
def setMaxNumberOfElements(self, number: ARNumerical):
|
|
110
|
+
self.maxNumberOfElements = number
|
|
111
|
+
return self
|
|
74
112
|
|
|
75
113
|
class ApplicationArrayDataType(ApplicationCompositeDataType):
|
|
76
114
|
def __init__(self, parent: ARObject, short_name: str):
|
|
77
115
|
super().__init__(parent, short_name)
|
|
78
116
|
|
|
79
|
-
self.dynamic_array_size_profile =
|
|
80
|
-
self.element = None
|
|
81
|
-
|
|
117
|
+
self.dynamic_array_size_profile = None # type: ARLiteral
|
|
118
|
+
self.element = None # type: ApplicationArrayElement
|
|
82
119
|
|
|
120
|
+
def createApplicationArrayElement(self, short_name: str) -> ApplicationArrayElement:
|
|
121
|
+
if (short_name not in self.elements):
|
|
122
|
+
array_element = ApplicationArrayElement(self, short_name)
|
|
123
|
+
self.elements[short_name] = array_element
|
|
124
|
+
self.element = self.elements[short_name]
|
|
125
|
+
return self.elements[short_name]
|
|
126
|
+
|
|
83
127
|
class ApplicationRecordDataType(ApplicationCompositeDataType):
|
|
84
128
|
def __init__(self, parent: ARObject, short_name: str):
|
|
85
129
|
super().__init__(parent, short_name)
|
|
86
130
|
|
|
131
|
+
self.record_elements = []
|
|
132
|
+
|
|
87
133
|
def createApplicationRecordElement(self, short_name: str) -> ApplicationRecordElement:
|
|
88
134
|
if (short_name not in self.elements):
|
|
89
135
|
record_element = ApplicationRecordElement(self, short_name)
|
|
90
136
|
self.elements[short_name] = record_element
|
|
137
|
+
self.record_elements.append(self.elements[short_name])
|
|
91
138
|
return self.elements[short_name]
|
|
92
139
|
|
|
140
|
+
def getApplicationRecordElements(self) -> List[ApplicationRecordElement]:
|
|
141
|
+
return self.record_elements
|
|
93
142
|
|
|
94
143
|
class AbstractImplementationDataType(AutosarDataType, metaclass=ABCMeta):
|
|
95
144
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -108,9 +157,10 @@ class ImplementationDataType(AbstractImplementationDataType):
|
|
|
108
157
|
|
|
109
158
|
def __init__(self, parent: ARObject, short_name: str):
|
|
110
159
|
super().__init__(parent, short_name)
|
|
111
|
-
|
|
112
|
-
self.
|
|
113
|
-
self.
|
|
160
|
+
|
|
161
|
+
self.sub_elements = [] # type: List[str]
|
|
162
|
+
self.symbol_props = None # type: ARLiteral
|
|
163
|
+
self._type_emitter = None # type: ARLiteral
|
|
114
164
|
|
|
115
165
|
self._array_type = None # ImplementationDataType
|
|
116
166
|
|
|
@@ -134,21 +184,38 @@ class ImplementationDataType(AbstractImplementationDataType):
|
|
|
134
184
|
|
|
135
185
|
def setArrayElementType(self, type: str):
|
|
136
186
|
self._array_type = type
|
|
187
|
+
return self
|
|
188
|
+
|
|
189
|
+
def setTypeEmitter(self, emitter: str):
|
|
190
|
+
self._type_emitter = emitter
|
|
191
|
+
return self
|
|
192
|
+
|
|
193
|
+
def getTypeEmitter(self) -> str:
|
|
194
|
+
return self._type_emitter
|
|
137
195
|
|
|
138
196
|
|
|
139
197
|
class DataTypeMap(ARObject):
|
|
140
198
|
def __init__(self):
|
|
141
|
-
self.application_data_type_ref = None
|
|
142
|
-
self.implementation_data_type_ref = None
|
|
143
|
-
|
|
199
|
+
self.application_data_type_ref = None # type: RefType
|
|
200
|
+
self.implementation_data_type_ref = None # type: RefType
|
|
144
201
|
|
|
145
202
|
class DataTypeMappingSet(ARElement):
|
|
146
203
|
def __init__(self, parent: ARObject, short_name: str):
|
|
147
204
|
super().__init__(parent, short_name)
|
|
148
|
-
|
|
205
|
+
|
|
206
|
+
self._dataTypeMaps = [] # type: List[DataTypeMap]
|
|
207
|
+
self._modeRequestTypeMaps = [] # type: List[ModeRequestTypeMap]
|
|
149
208
|
|
|
150
209
|
def addDataTypeMap(self, type_map: DataTypeMap):
|
|
151
|
-
self.
|
|
210
|
+
self._dataTypeMaps.append(type_map)
|
|
152
211
|
|
|
153
212
|
def getDataTypeMaps(self) -> List[DataTypeMap]:
|
|
154
|
-
return self.
|
|
213
|
+
return self._dataTypeMaps
|
|
214
|
+
|
|
215
|
+
def addModeRequestTypeMap(self, map: ModeRequestTypeMap):
|
|
216
|
+
self._modeRequestTypeMaps.append(map)
|
|
217
|
+
|
|
218
|
+
def getModeRequestTypeMaps(self) -> List[ModeRequestTypeMap]:
|
|
219
|
+
return self._modeRequestTypeMaps
|
|
220
|
+
|
|
221
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from .ar_ref import VariableDataPrototypeInSystemInstanceRef
|
|
4
|
+
from .ar_object import ARNumerical, ARObject
|
|
5
|
+
from .general_structure import Identifiable
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EndToEndDescription(ARObject):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__()
|
|
11
|
+
|
|
12
|
+
self.category = None # type: str
|
|
13
|
+
self.counterOffset = None # type: int
|
|
14
|
+
self.crcOffset = None # type: int
|
|
15
|
+
self.dataIds = [] # type: List[ARNumerical]
|
|
16
|
+
self.dataIdMode = None # type: int
|
|
17
|
+
self.dataIdNibbleOffset = None # type: int
|
|
18
|
+
self.dataLength = None # type: int
|
|
19
|
+
self.maxDeltaCounterInit = None # type: int
|
|
20
|
+
self.maxNoNewOrRepeatedData = None # type: int
|
|
21
|
+
self.syncCounterInit = None # type: int
|
|
22
|
+
|
|
23
|
+
def addDataId(self, id: ARNumerical):
|
|
24
|
+
self.dataIds.append(id)
|
|
25
|
+
|
|
26
|
+
def getDataIds(self) -> List[ARNumerical]:
|
|
27
|
+
return sorted(self.dataIds, key = lambda a: a)
|
|
28
|
+
|
|
29
|
+
class EndToEndProtectionVariablePrototype(ARObject):
|
|
30
|
+
def __init__(self):
|
|
31
|
+
super().__init__()
|
|
32
|
+
|
|
33
|
+
self._receiverIRefs = [] # type: List[VariableDataPrototypeInSystemInstanceRef]
|
|
34
|
+
self.senderIRef = None # type: VariableDataPrototypeInSystemInstanceRef
|
|
35
|
+
self.shortLabel = None # type: str
|
|
36
|
+
|
|
37
|
+
def addReceiverIref(self, iref: VariableDataPrototypeInSystemInstanceRef):
|
|
38
|
+
self._receiverIRefs.append(iref)
|
|
39
|
+
|
|
40
|
+
def getReceiverIrefs(self) -> List[VariableDataPrototypeInSystemInstanceRef]:
|
|
41
|
+
return self._receiverIRefs
|
|
42
|
+
|
|
43
|
+
class EndToEndProtection(Identifiable):
|
|
44
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
45
|
+
super().__init__(parent, short_name)
|
|
46
|
+
|
|
47
|
+
self.endToEndProfile = None # type: EndToEndDescription
|
|
48
|
+
self.endToEndProtectionVariablePrototype = [] # type: List[EndToEndProtectionVariablePrototype]
|
|
49
|
+
|
|
50
|
+
def addEndToEndProtectionVariablePrototype(self, prototype: EndToEndProtectionVariablePrototype):
|
|
51
|
+
self.endToEndProtectionVariablePrototype.append(prototype)
|
|
52
|
+
|
|
53
|
+
def getEndToEndProtectionVariablePrototypes(self) -> List[EndToEndProtectionVariablePrototype]:
|
|
54
|
+
return self.endToEndProtectionVariablePrototype
|
|
55
|
+
|
|
56
|
+
class EndToEndProtectionSet(Identifiable):
|
|
57
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
58
|
+
super().__init__(parent, short_name)
|
|
59
|
+
|
|
60
|
+
def createEndToEndProtection(self, short_name: str) -> EndToEndProtection:
|
|
61
|
+
if (short_name not in self.elements):
|
|
62
|
+
protection = EndToEndProtection(self, short_name)
|
|
63
|
+
self.elements[short_name] = protection
|
|
64
|
+
return self.elements[short_name]
|
|
65
|
+
|
|
66
|
+
def getEndToEndProtections(self) -> List[EndToEndProtection]:
|
|
67
|
+
return sorted(filter(lambda c: isinstance(c, EndToEndProtection), self.elements.values()), key= lambda e: e.short_name)
|
|
@@ -1,13 +1,53 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
from .ar_ref import RefType
|
|
5
|
+
from .multilanguage_data import MultiLanguageOverviewParagraph, MultilanguageLongName
|
|
6
|
+
from .ar_object import ARObject
|
|
7
|
+
|
|
8
|
+
class Sd(ARObject):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__()
|
|
11
|
+
|
|
12
|
+
self.gid = ""
|
|
13
|
+
self.value = ""
|
|
14
|
+
|
|
15
|
+
class Sdg(ARObject):
|
|
16
|
+
def __init__(self):
|
|
17
|
+
super().__init__()
|
|
18
|
+
|
|
19
|
+
self.gid = ""
|
|
20
|
+
self.sd = [] # type: List[Sd]
|
|
21
|
+
self.sdg_caption = None
|
|
22
|
+
self.sdg_contents_type = None
|
|
5
23
|
|
|
24
|
+
def addSd(self, sd: Sd):
|
|
25
|
+
self.sd.append(sd)
|
|
26
|
+
|
|
27
|
+
def getSds(self) -> List[Sd]:
|
|
28
|
+
return self.sd
|
|
29
|
+
|
|
30
|
+
class AdminData(ARObject):
|
|
31
|
+
def __init__(self):
|
|
32
|
+
super().__init__()
|
|
33
|
+
|
|
34
|
+
self.doc_revision = []
|
|
35
|
+
self.language = None
|
|
36
|
+
self.sdg = []
|
|
37
|
+
self.used_languages = None
|
|
38
|
+
|
|
39
|
+
def addSdg(self, sdg: Sdg):
|
|
40
|
+
self.sdg.append(sdg)
|
|
41
|
+
|
|
42
|
+
def getSdgs(self) -> List[Sdg]:
|
|
43
|
+
return self.sdg
|
|
6
44
|
|
|
7
45
|
class Referrable(ARObject, metaclass=ABCMeta):
|
|
8
46
|
def __init__(self, parent: ARObject, short_name: str):
|
|
9
47
|
if type(self) == Referrable:
|
|
10
48
|
raise NotImplementedError("Referrable is an abstract class.")
|
|
49
|
+
ARObject.__init__(self)
|
|
50
|
+
|
|
11
51
|
self.parent = parent
|
|
12
52
|
self.short_name = short_name
|
|
13
53
|
|
|
@@ -19,15 +59,26 @@ class MultilanguageReferrable(Referrable, metaclass=ABCMeta):
|
|
|
19
59
|
def __init__(self, parent: ARObject, short_name: str):
|
|
20
60
|
if type(self) == MultilanguageReferrable:
|
|
21
61
|
raise NotImplementedError("MultilanguageReferrable is an abstract class.")
|
|
62
|
+
|
|
22
63
|
super().__init__(parent, short_name)
|
|
64
|
+
|
|
23
65
|
self.parent = parent
|
|
24
|
-
self.long_name = None
|
|
66
|
+
self.long_name = None # type: MultilanguageLongName
|
|
25
67
|
|
|
26
|
-
class CollectableElement(metaclass=ABCMeta):
|
|
68
|
+
class CollectableElement(ARObject, metaclass=ABCMeta):
|
|
27
69
|
def __init__(self):
|
|
28
70
|
if type(self) == CollectableElement:
|
|
29
71
|
raise NotImplementedError("CollectableElement is an abstract class.")
|
|
30
|
-
self.elements = {} # type: dict
|
|
72
|
+
self.elements = {} # type: dict[str, PackageableElement]
|
|
73
|
+
|
|
74
|
+
def getTotalElement(self) -> int:
|
|
75
|
+
#return len(list(filter(lambda a: not isinstance(a, ARPackage) , self.elements.values())))
|
|
76
|
+
return len(self.elements.values())
|
|
77
|
+
|
|
78
|
+
def removeElement(self, key):
|
|
79
|
+
if key not in self.elements:
|
|
80
|
+
raise KeyError("Invalid key <%s> for removing element" % key)
|
|
81
|
+
self.elements.pop(key)
|
|
31
82
|
|
|
32
83
|
def getElements(self):
|
|
33
84
|
return self.elements.values()
|
|
@@ -44,8 +95,9 @@ class Identifiable(MultilanguageReferrable, CollectableElement, metaclass=ABCMet
|
|
|
44
95
|
MultilanguageReferrable.__init__(self, parent, short_name)
|
|
45
96
|
CollectableElement.__init__(self)
|
|
46
97
|
|
|
98
|
+
self.admin_data = None # type: AdminData
|
|
47
99
|
self._category = None
|
|
48
|
-
self.desc = None
|
|
100
|
+
self.desc = None # type: MultiLanguageOverviewParagraph
|
|
49
101
|
|
|
50
102
|
@property
|
|
51
103
|
def category(self):
|
|
@@ -78,30 +130,31 @@ class SwcBswRunnableMapping(ARObject):
|
|
|
78
130
|
'''
|
|
79
131
|
super().__init__()
|
|
80
132
|
|
|
81
|
-
self.
|
|
82
|
-
self.
|
|
133
|
+
self.bswEntityRef = None # type: RefType
|
|
134
|
+
self.swcRunnableRef = None # type: RefType
|
|
83
135
|
|
|
84
136
|
class SwcBswMapping(Identifiable):
|
|
85
137
|
def __init__(self, parent: ARObject, short_name: str):
|
|
86
138
|
super().__init__(parent, short_name)
|
|
87
139
|
|
|
88
|
-
self.
|
|
89
|
-
self.
|
|
90
|
-
self.
|
|
91
|
-
self.
|
|
92
|
-
self.
|
|
140
|
+
self.bswBehaviorRef = None # type: RefType
|
|
141
|
+
self._runnableMappings = []
|
|
142
|
+
self.swcBehaviorRef = None # type: RefType
|
|
143
|
+
self.synchronizedModeGroups = []
|
|
144
|
+
self.synchronizedTriggers = []
|
|
93
145
|
|
|
94
146
|
def addRunnableMapping(self, mapping: SwcBswRunnableMapping):
|
|
95
|
-
self.
|
|
147
|
+
self._runnableMappings.append(mapping)
|
|
96
148
|
|
|
97
149
|
def getRunnableMappings(self) -> List[SwcBswRunnableMapping]:
|
|
98
|
-
return self.
|
|
150
|
+
return self._runnableMappings
|
|
99
151
|
|
|
100
152
|
class ARElement(PackageableElement, metaclass=ABCMeta):
|
|
101
153
|
def __init__(self, parent: ARObject, short_name: str):
|
|
102
154
|
if type(self) == ARElement:
|
|
103
155
|
raise NotImplementedError("ARElement is an abstract class.")
|
|
104
156
|
super().__init__(parent, short_name)
|
|
157
|
+
|
|
105
158
|
|
|
106
159
|
class AtpStructureElement(AtpFeature, metaclass=ABCMeta):
|
|
107
160
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -109,7 +162,9 @@ class AtpStructureElement(AtpFeature, metaclass=ABCMeta):
|
|
|
109
162
|
raise NotImplementedError("AtpStructureElement is an abstract class.")
|
|
110
163
|
super().__init__(parent, short_name)
|
|
111
164
|
|
|
112
|
-
class Limit:
|
|
165
|
+
class Limit(ARObject):
|
|
113
166
|
def __init__(self):
|
|
114
|
-
|
|
115
|
-
|
|
167
|
+
super().__init__()
|
|
168
|
+
|
|
169
|
+
self.intervalType = None # type: str
|
|
170
|
+
self.value = None # type: str
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from .ar_ref import RefType
|
|
2
|
+
from .ar_object import ARNumerical, ARObject
|
|
3
|
+
from .general_structure import Identifiable, Limit
|
|
4
|
+
|
|
5
|
+
from typing import List
|
|
6
|
+
|
|
7
|
+
class InternalConstrs(ARObject):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super().__init__()
|
|
10
|
+
|
|
11
|
+
self.lower_limit = None # type: Limit
|
|
12
|
+
self.upper_limit = None # type: Limit
|
|
13
|
+
|
|
14
|
+
class PhysConstrs(ARObject):
|
|
15
|
+
def __init__(self):
|
|
16
|
+
super().__init__()
|
|
17
|
+
|
|
18
|
+
self.lower_limit = None # type: Limit
|
|
19
|
+
self.upper_limit = None # type: Limit
|
|
20
|
+
self.unit_ref = None # type: RefType
|
|
21
|
+
|
|
22
|
+
class DataConstrRule(ARObject):
|
|
23
|
+
def __init__(self):
|
|
24
|
+
super().__init__()
|
|
25
|
+
|
|
26
|
+
self.constrLevel = None # type: ARNumerical
|
|
27
|
+
self.internalConstrs = None # type: InternalConstrs
|
|
28
|
+
self.physConstrs = None # type: PhysConstrs
|
|
29
|
+
|
|
30
|
+
class DataConstr(Identifiable):
|
|
31
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
32
|
+
super().__init__(parent, short_name)
|
|
33
|
+
|
|
34
|
+
self.data_constr_rule = [] # type: List[DataConstrRule]
|
|
35
|
+
|
|
36
|
+
def addDataConstrRule(self, rule: DataConstrRule):
|
|
37
|
+
self.data_constr_rule.append(rule)
|
|
38
|
+
|
|
39
|
+
def getDataConstrRules(self) -> List[DataConstrRule]:
|
|
40
|
+
return self.data_constr_rule
|
armodel/models/implementation.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
|
-
from .ar_object import ARObject
|
|
3
|
+
from .ar_object import ARLiteral, ARNumerical, ARObject
|
|
4
4
|
from .general_structure import PackageableElement, Identifiable
|
|
5
5
|
from .common_structure import ResourceConsumption
|
|
6
6
|
from .ar_ref import RefType
|
|
@@ -12,10 +12,43 @@ class EngineeringObject(ARObject, metaclass=ABCMeta):
|
|
|
12
12
|
|
|
13
13
|
super().__init__()
|
|
14
14
|
|
|
15
|
-
self.category =
|
|
16
|
-
self.domain = None # type:
|
|
17
|
-
self.revision_label = None
|
|
18
|
-
self.short_label =
|
|
15
|
+
self.category = None # type: ARLiteral
|
|
16
|
+
self.domain = None # type: ARLiteral
|
|
17
|
+
self.revision_label = None # type: ARLiteral
|
|
18
|
+
self.short_label = None # type: ARLiteral
|
|
19
|
+
|
|
20
|
+
def setCategory(self, category: ARLiteral):
|
|
21
|
+
if isinstance(category, ARLiteral):
|
|
22
|
+
self.category = category
|
|
23
|
+
else:
|
|
24
|
+
self.category = ARLiteral()
|
|
25
|
+
self.category.setValue(str(category))
|
|
26
|
+
|
|
27
|
+
return self
|
|
28
|
+
|
|
29
|
+
def getCategory(self) -> ARLiteral:
|
|
30
|
+
return self.category
|
|
31
|
+
|
|
32
|
+
def setDomain(self, domain: ARLiteral):
|
|
33
|
+
self.domain = domain
|
|
34
|
+
return self
|
|
35
|
+
|
|
36
|
+
def getDomain(self) -> ARLiteral:
|
|
37
|
+
return self.domain
|
|
38
|
+
|
|
39
|
+
def setRevisionLabel(self, revision_label: ARLiteral):
|
|
40
|
+
self.revision_label = revision_label
|
|
41
|
+
return self
|
|
42
|
+
|
|
43
|
+
def getRevisionLabel(self) -> ARLiteral:
|
|
44
|
+
return self.revision_label
|
|
45
|
+
|
|
46
|
+
def setShortLabel(self, label: ARLiteral):
|
|
47
|
+
self.short_label = label
|
|
48
|
+
return self
|
|
49
|
+
|
|
50
|
+
def getShortLabel(self) -> ARLiteral:
|
|
51
|
+
return self.short_label
|
|
19
52
|
|
|
20
53
|
class AutosarEngineeringObject(EngineeringObject):
|
|
21
54
|
def __init__(self):
|
|
@@ -25,17 +58,17 @@ class Code(Identifiable):
|
|
|
25
58
|
def __init__(self, parent: ARObject, short_name: str):
|
|
26
59
|
super().__init__(parent, short_name)
|
|
27
60
|
|
|
28
|
-
self.
|
|
29
|
-
self.
|
|
61
|
+
self._artifactDescriptors = [] # type: List[AutosarEngineeringObject]
|
|
62
|
+
self.callbackHeaderRefs = [] # type: List[RefType]
|
|
30
63
|
|
|
31
64
|
def addArtifactDescriptor(self, desc: AutosarEngineeringObject):
|
|
32
|
-
self.
|
|
65
|
+
self._artifactDescriptors.append(desc)
|
|
33
66
|
|
|
34
67
|
def getArtifactDescriptors(self, category:str = "") -> List[AutosarEngineeringObject]:
|
|
35
68
|
if (category == ""):
|
|
36
|
-
return self.
|
|
69
|
+
return self._artifactDescriptors
|
|
37
70
|
else:
|
|
38
|
-
return list(filter(lambda a: a.
|
|
71
|
+
return list(filter(lambda a: a.getCategory().getText() == category, self._artifactDescriptors))
|
|
39
72
|
|
|
40
73
|
class Implementation(PackageableElement, metaclass=ABCMeta):
|
|
41
74
|
def __init__(self, parent: ARObject, short_name: str) -> None:
|
|
@@ -43,20 +76,21 @@ class Implementation(PackageableElement, metaclass=ABCMeta):
|
|
|
43
76
|
raise NotImplementedError("Implementation is an abstract class.")
|
|
44
77
|
|
|
45
78
|
super().__init__(parent, short_name)
|
|
46
|
-
|
|
47
|
-
self.
|
|
48
|
-
self.
|
|
49
|
-
self.
|
|
50
|
-
self.
|
|
51
|
-
self.
|
|
52
|
-
self.
|
|
53
|
-
self.
|
|
54
|
-
self.
|
|
55
|
-
self.
|
|
56
|
-
self.
|
|
57
|
-
self.
|
|
58
|
-
self.
|
|
59
|
-
self.
|
|
79
|
+
|
|
80
|
+
self.build_action_manifest_ref = None # type: RefType
|
|
81
|
+
self.compilers = None
|
|
82
|
+
self.generated_artifacts = None
|
|
83
|
+
self.hw_element_refs = [] # type: List[RefType]
|
|
84
|
+
self.linker = []
|
|
85
|
+
self.mc_support = None
|
|
86
|
+
self.programming_language = None # type: ARLiteral
|
|
87
|
+
self.required_artifacts = []
|
|
88
|
+
self.required_generator_tools = []
|
|
89
|
+
self._resource_consumption = None # type: ResourceConsumption
|
|
90
|
+
self.sw_version = "" # type: ARLiteral
|
|
91
|
+
self.swc_bsw_mapping_ref = None # type: RefType
|
|
92
|
+
self.used_code_generator = None # type: ARLiteral
|
|
93
|
+
self.vendor_id = 0 # type: ARNumerical
|
|
60
94
|
|
|
61
95
|
def createCodeDescriptor(self, short_name: str) -> Code:
|
|
62
96
|
if (short_name not in self.elements):
|
|
@@ -67,22 +101,36 @@ class Implementation(PackageableElement, metaclass=ABCMeta):
|
|
|
67
101
|
def getCodeDescriptors(self)-> List[Code]:
|
|
68
102
|
return list(filter(lambda a : isinstance(a, Code), self.elements.values()))
|
|
69
103
|
|
|
104
|
+
def setResourceConsumption(self, consumption: ResourceConsumption):
|
|
105
|
+
self.elements[consumption.short_name] = consumption
|
|
106
|
+
self._resource_consumption = consumption
|
|
107
|
+
return self
|
|
108
|
+
|
|
109
|
+
def getResourceConsumption(self) -> ResourceConsumption:
|
|
110
|
+
return self._resource_consumption
|
|
111
|
+
|
|
70
112
|
class BswImplementation(Implementation):
|
|
71
113
|
def __init__(self, parent: ARObject, short_name: str) -> None:
|
|
72
114
|
super().__init__(parent, short_name)
|
|
73
115
|
|
|
74
|
-
self.ar_release_version =
|
|
75
|
-
self.
|
|
76
|
-
self.
|
|
77
|
-
self.
|
|
78
|
-
self.
|
|
79
|
-
self.
|
|
80
|
-
|
|
116
|
+
self.ar_release_version = None # type: ARLiteral
|
|
117
|
+
self.behavior_ref = None # type: RefType
|
|
118
|
+
self.preconfiguredConfigurationRef = [] # type: List[RefType]
|
|
119
|
+
self.recommendedConfigurationRef = [] # type: List[RefType]
|
|
120
|
+
self.vendorApiInfix = None # type: str
|
|
121
|
+
self._vendorSpecificModuleDefRef = [] # type: List[RefType]
|
|
122
|
+
|
|
123
|
+
def addVendorSpecificModuleDefRef(self, ref: RefType):
|
|
124
|
+
self._vendorSpecificModuleDefRef.append(ref)
|
|
81
125
|
|
|
126
|
+
def getVendorSpecificModuleDefRefs(self):
|
|
127
|
+
return self._vendorSpecificModuleDefRef
|
|
128
|
+
|
|
82
129
|
class SwcImplementation(Implementation):
|
|
83
130
|
def __init__(self, parent: ARObject, short_name: str) -> None:
|
|
84
131
|
super().__init__(parent, short_name)
|
|
85
132
|
|
|
86
133
|
self.behavior_ref = None # type: RefType
|
|
87
134
|
self.per_instance_memory_size = None
|
|
88
|
-
self.required_rte_vendor = ""
|
|
135
|
+
self.required_rte_vendor = ""
|
|
136
|
+
|