armodel 1.7.2__py3-none-any.whl → 1.7.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/cli/arxml_dump_cli.py +1 -1
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswBehavior.py +42 -19
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswInterfaces.py +104 -30
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswOverview.py +12 -16
- armodel/models/M2/AUTOSARTemplates/CommonStructure/FlatMap.py +70 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/Implementation.py +12 -9
- armodel/models/M2/AUTOSARTemplates/CommonStructure/InternalBehavior.py +29 -22
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/HardwareConfiguration.py +33 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/HeapUsage.py +10 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/SoftwareContext.py +23 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/StackUsage.py +93 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/__init__.py +39 -5
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ServiceNeeds.py +26 -2
- armodel/models/M2/AUTOSARTemplates/CommonStructure/SwcBswMapping.py +48 -6
- armodel/models/M2/AUTOSARTemplates/GenericStructure/AbstractStructure.py +5 -5
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/ARPackage.py +21 -1
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/PrimitiveTypes.py +12 -0
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Composition/__init__.py +8 -0
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/PortInterface/__init__.py +196 -5
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/ServiceMapping.py +11 -2
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/__init__.py +36 -21
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/DataMapping.py +10 -1
- armodel/models/M2/MSR/AsamHdo/ComputationMethod.py +16 -1
- armodel/models/M2/MSR/CalibrationData/CalibrationValue.py +34 -3
- armodel/models/M2/MSR/DataDictionary/DataDefProperties.py +7 -0
- armodel/models/M2/MSR/DataDictionary/ServiceProcessTask.py +33 -0
- armodel/models/__init__.py +3 -0
- armodel/parser/abstract_arxml_parser.py +4 -14
- armodel/parser/arxml_parser.py +347 -180
- armodel/tests/test_armodel/models/test_ar_object.py +6 -2
- armodel/tests/test_armodel/models/test_port_interface.py +4 -4
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +48 -48
- armodel/writer/abstract_arxml_writer.py +1 -0
- armodel/writer/arxml_writer.py +351 -226
- {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/METADATA +15 -2
- {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/RECORD +40 -34
- {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/LICENSE +0 -0
- {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/WHEEL +0 -0
- {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/entry_points.txt +0 -0
- {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/top_level.txt +0 -0
armodel/cli/arxml_dump_cli.py
CHANGED
|
@@ -116,7 +116,7 @@ def show_bsw_internal_behavior(indent: int, behavior: BswInternalBehavior):
|
|
|
116
116
|
print("%s-%s: %s" % (" " * (indent + 4), "ImplementedEntryRef", starts_on_event.implementedEntryRef.value))
|
|
117
117
|
implemented_entry = document.find(starts_on_event.implementedEntryRef.value) # type: BswModuleEntry
|
|
118
118
|
print("%s-%s: %s" % (" " * (indent + 4), "ImplementedEntry", implemented_entry.short_name))
|
|
119
|
-
print("%s-%s: %d" % (" " * (indent + 6), "Service Id", implemented_entry.
|
|
119
|
+
print("%s-%s: %d" % (" " * (indent + 6), "Service Id", implemented_entry.serviceId))
|
|
120
120
|
|
|
121
121
|
def show_bsw_module_description(indent: int, description: BswModuleDescription):
|
|
122
122
|
print("%s-%s" % (" " * indent, description.short_name))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from ....M2.AUTOSARTemplates.SWComponentTemplate.SwcInternalBehavior.IncludedDataTypes import IncludedDataTypeSet
|
|
2
2
|
from ....M2.AUTOSARTemplates.SWComponentTemplate.SwcInternalBehavior.ModeDeclarationGroup import IncludedModeDeclarationGroupSet
|
|
3
3
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import Identifiable
|
|
4
|
-
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARBoolean, ARFloat, ARNumerical, TimeValue
|
|
4
|
+
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARBoolean, AREnum, ARFloat, ARNumerical, String, TimeValue
|
|
5
5
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
|
|
6
6
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import RefType
|
|
7
7
|
from ....M2.AUTOSARTemplates.CommonStructure.InternalBehavior import ExecutableEntity
|
|
@@ -132,23 +132,36 @@ class BswSchedulableEntity(BswModuleEntity):
|
|
|
132
132
|
def __init__(self, parent: ARObject, short_name: str):
|
|
133
133
|
super().__init__(parent, short_name)
|
|
134
134
|
|
|
135
|
+
class BswInterruptCategory(AREnum):
|
|
136
|
+
CAT1 = "cat1"
|
|
137
|
+
CAT2 = "cat2"
|
|
138
|
+
|
|
139
|
+
def __init__(self):
|
|
140
|
+
super().__init__((
|
|
141
|
+
BswInterruptCategory.CAT1,
|
|
142
|
+
BswInterruptCategory.CAT2,
|
|
143
|
+
))
|
|
144
|
+
|
|
135
145
|
class BswInterruptEntity(BswModuleEntity):
|
|
136
146
|
def __init__(self, parent: ARObject, short_name: str):
|
|
137
147
|
super().__init__(parent, short_name)
|
|
138
148
|
|
|
139
|
-
self.
|
|
140
|
-
self.
|
|
149
|
+
self.interruptCategory = None # type: BswInterruptCategory
|
|
150
|
+
self.interruptSource = None # type: String
|
|
141
151
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return self._interrupt_category
|
|
152
|
+
def getInterruptCategory(self):
|
|
153
|
+
return self.interruptCategory
|
|
145
154
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
155
|
+
def setInterruptCategory(self, value):
|
|
156
|
+
self.interruptCategory = value
|
|
157
|
+
return self
|
|
158
|
+
|
|
159
|
+
def getInterruptSource(self):
|
|
160
|
+
return self.interruptSource
|
|
151
161
|
|
|
162
|
+
def setInterruptSource(self, value):
|
|
163
|
+
self.interruptSource = value
|
|
164
|
+
return self
|
|
152
165
|
|
|
153
166
|
class BswEvent(Identifiable, metaclass=ABCMeta):
|
|
154
167
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -293,23 +306,33 @@ class BswInternalBehavior(InternalBehavior):
|
|
|
293
306
|
|
|
294
307
|
def createBswCalledEntity(self, short_name: str) -> BswCalledEntity:
|
|
295
308
|
if (short_name not in self.elements):
|
|
296
|
-
|
|
297
|
-
self.
|
|
298
|
-
self.entities.append(
|
|
299
|
-
return self.
|
|
309
|
+
entity = BswCalledEntity(self, short_name)
|
|
310
|
+
self.addElement(entity)
|
|
311
|
+
self.entities.append(entity)
|
|
312
|
+
return self.getElement(short_name)
|
|
300
313
|
|
|
301
314
|
def getBswCalledEntities(self) -> List[BswCalledEntity]:
|
|
302
315
|
return list(filter(lambda a: isinstance(a, BswCalledEntity), self.elements.values()))
|
|
303
316
|
|
|
304
317
|
def createBswSchedulableEntity(self, short_name: str) -> BswSchedulableEntity:
|
|
305
318
|
if (short_name not in self.elements):
|
|
306
|
-
|
|
307
|
-
self.
|
|
308
|
-
self.entities.append(
|
|
309
|
-
return self.
|
|
319
|
+
entity = BswSchedulableEntity(self, short_name)
|
|
320
|
+
self.addElement(entity)
|
|
321
|
+
self.entities.append(entity)
|
|
322
|
+
return self.getElement(short_name)
|
|
310
323
|
|
|
311
324
|
def getBswSchedulableEntities(self) -> List[BswSchedulableEntity]:
|
|
312
325
|
return list(filter(lambda a: isinstance(a, BswSchedulableEntity), self.elements.values()))
|
|
326
|
+
|
|
327
|
+
def createBswInterruptEntity(self, short_name: str) -> BswInterruptEntity:
|
|
328
|
+
if (short_name not in self.elements):
|
|
329
|
+
entity = BswInterruptEntity(self, short_name)
|
|
330
|
+
self.addElement(entity)
|
|
331
|
+
self.entities.append(entity)
|
|
332
|
+
return self.getElement(short_name)
|
|
333
|
+
|
|
334
|
+
def getBswInterruptEntities(self) -> List[BswInterruptEntity]:
|
|
335
|
+
return list(filter(lambda a: isinstance(a, BswInterruptEntity), self.elements.values()))
|
|
313
336
|
|
|
314
337
|
def getBswModuleEntities(self) -> List[BswModuleEntity]:
|
|
315
338
|
return list(filter(lambda a: isinstance(a, BswModuleEntity), self.elements.values()))
|
|
@@ -1,52 +1,126 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from ....M2.MSR.DataDictionary.ServiceProcessTask import SwServiceArg
|
|
1
4
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
|
|
2
5
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import ARElement
|
|
3
|
-
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import
|
|
6
|
+
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARLiteral, ARNumerical, Boolean, Identifier, NameToken
|
|
4
7
|
|
|
5
8
|
class BswModuleEntry(ARElement):
|
|
6
9
|
def __init__(self, parent: ARObject, short_name: str):
|
|
7
10
|
super().__init__(parent, short_name)
|
|
8
11
|
|
|
9
|
-
self.
|
|
10
|
-
self.
|
|
11
|
-
self.
|
|
12
|
-
self.
|
|
13
|
-
self.
|
|
14
|
-
self.
|
|
12
|
+
self.arguments = [] # type: List[SwServiceArg]
|
|
13
|
+
self.bswEntryKind = None # type: BswEntryKindEnum
|
|
14
|
+
self.callType = None # type: BswCallType
|
|
15
|
+
self.executionContext = None # type: BswExecutionContext
|
|
16
|
+
self.functionPrototypeEmitter = None # type: NameToken
|
|
17
|
+
self.isReentrant = None # type: Boolean
|
|
18
|
+
self.isSynchronous = None # type: Boolean
|
|
19
|
+
self.returnType = None # type: SwServiceArg
|
|
20
|
+
self.role = None # type: Identifier
|
|
21
|
+
self.serviceId = None # type: ARNumerical
|
|
22
|
+
self.swServiceImplPolicy = None # type: SwServiceImplPolicyEnum
|
|
23
|
+
|
|
24
|
+
def getArguments(self):
|
|
25
|
+
return self.arguments
|
|
26
|
+
|
|
27
|
+
def createArgument(self, short_name: str) -> SwServiceArg:
|
|
28
|
+
if (short_name not in self.elements):
|
|
29
|
+
arg = SwServiceArg(self, short_name)
|
|
30
|
+
self.addElement(arg)
|
|
31
|
+
self.arguments.append(arg)
|
|
32
|
+
return self.getElement(short_name)
|
|
33
|
+
|
|
34
|
+
def getBswEntryKind(self):
|
|
35
|
+
return self.bswEntryKind
|
|
36
|
+
|
|
37
|
+
def setBswEntryKind(self, value):
|
|
38
|
+
self.bswEntryKind = value
|
|
39
|
+
return self
|
|
15
40
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return self._execution_context
|
|
41
|
+
def getCallType(self):
|
|
42
|
+
return self.callType
|
|
19
43
|
|
|
20
|
-
|
|
21
|
-
|
|
44
|
+
def setCallType(self, value):
|
|
45
|
+
self.callType = value
|
|
46
|
+
return self
|
|
47
|
+
|
|
48
|
+
def getExecutionContext(self):
|
|
49
|
+
return self.executionContext
|
|
50
|
+
|
|
51
|
+
def setExecutionContext(self, value):
|
|
22
52
|
if value.upper() not in ("HOOK", "INTERRUPT-CAT-1", "INTERRUPT-CAT-2", "TASK", "UNSPECIFIED"):
|
|
23
53
|
raise ValueError("Invalid execution context <%s> of BswModuleEntry <%s>" % (value, self.short_name))
|
|
24
|
-
self.
|
|
54
|
+
self.executionContext = value
|
|
55
|
+
return self
|
|
56
|
+
|
|
57
|
+
def getFunctionPrototypeEmitter(self):
|
|
58
|
+
return self.functionPrototypeEmitter
|
|
59
|
+
|
|
60
|
+
def setFunctionPrototypeEmitter(self, value):
|
|
61
|
+
self.functionPrototypeEmitter = value
|
|
62
|
+
return self
|
|
63
|
+
|
|
64
|
+
def getIsReentrant(self):
|
|
65
|
+
return self.isReentrant
|
|
25
66
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return self
|
|
67
|
+
def setIsReentrant(self, value):
|
|
68
|
+
self.isReentrant = value
|
|
69
|
+
return self
|
|
29
70
|
|
|
30
|
-
|
|
31
|
-
|
|
71
|
+
def getIsSynchronous(self):
|
|
72
|
+
return self.isSynchronous
|
|
73
|
+
|
|
74
|
+
def setIsSynchronous(self, value):
|
|
75
|
+
self.isSynchronous = value
|
|
76
|
+
return self
|
|
77
|
+
|
|
78
|
+
def getReturnType(self):
|
|
79
|
+
return self.returnType
|
|
80
|
+
|
|
81
|
+
def setReturnType(self, value):
|
|
82
|
+
self.returnType = value
|
|
83
|
+
return self
|
|
84
|
+
|
|
85
|
+
def getRole(self):
|
|
86
|
+
return self.role
|
|
87
|
+
|
|
88
|
+
def setRole(self, value):
|
|
89
|
+
self.role = value
|
|
90
|
+
return self
|
|
91
|
+
|
|
92
|
+
def getServiceId(self):
|
|
93
|
+
return self.serviceId
|
|
94
|
+
|
|
95
|
+
def setServiceId(self, value):
|
|
96
|
+
self.serviceId = value
|
|
97
|
+
return self
|
|
98
|
+
|
|
99
|
+
def getSwServiceImplPolicy(self):
|
|
100
|
+
return self.swServiceImplPolicy
|
|
101
|
+
|
|
102
|
+
def setSwServiceImplPolicy(self, value):
|
|
32
103
|
if value.upper() not in ("INLINE", "INLINE-CONDITIONAL", "MACRO", "STANDARD"):
|
|
33
104
|
raise ValueError("Invalid SwServiceImplPolicy <%s> of BswModuleEntry <%s>" % (value, self.short_name))
|
|
34
|
-
self.
|
|
105
|
+
self.swServiceImplPolicy = value
|
|
106
|
+
return self
|
|
35
107
|
|
|
36
108
|
def __str__(self) -> str:
|
|
37
109
|
result = []
|
|
110
|
+
|
|
38
111
|
result.append("short_name : %s" % self.short_name)
|
|
39
|
-
if self.
|
|
40
|
-
result.append("service_id : %d" % self.
|
|
41
|
-
if self.
|
|
42
|
-
result.append("is_reentrant : %s" % self.
|
|
43
|
-
if self.
|
|
44
|
-
result.append("is_synchronous : %s" % self.
|
|
45
|
-
if self.
|
|
46
|
-
result.append("call_type : %s" % self.
|
|
112
|
+
if self.serviceId != None:
|
|
113
|
+
result.append("service_id : %d" % self.serviceId)
|
|
114
|
+
if self.isReentrant != None:
|
|
115
|
+
result.append("is_reentrant : %s" % self.isReentrant)
|
|
116
|
+
if self.isSynchronous != None:
|
|
117
|
+
result.append("is_synchronous : %s" % self.isSynchronous)
|
|
118
|
+
if self.callType != None:
|
|
119
|
+
result.append("call_type : %s" % self.callType)
|
|
47
120
|
if self.execution_context != None:
|
|
48
|
-
result.append("execution_context : %s" % self.
|
|
121
|
+
result.append("execution_context : %s" % self.executionContext)
|
|
49
122
|
if self.sw_service_impl_policy != None:
|
|
50
|
-
result.append("sw_service_impl_policy : %s" % self.
|
|
123
|
+
result.append("sw_service_impl_policy : %s" % self.swServiceImplPolicy)
|
|
51
124
|
|
|
52
|
-
return "\n".join(result)
|
|
125
|
+
return "\n".join(result)
|
|
126
|
+
|
|
@@ -19,30 +19,26 @@ class BswModuleDescription(ARElement):
|
|
|
19
19
|
super().__init__(parent, short_name)
|
|
20
20
|
|
|
21
21
|
# MODULE-ID
|
|
22
|
-
self.
|
|
22
|
+
self.moduleId = None # type: ARPositiveInteger
|
|
23
|
+
|
|
23
24
|
# PROVIDED-ENTRYS
|
|
24
|
-
self.
|
|
25
|
+
self.implementedEntryRefs = [] # type: List[RefType]
|
|
25
26
|
|
|
26
27
|
self.providedModeGroups = {} # type: Dict[str, ModeDeclarationGroupPrototype]
|
|
27
28
|
self.requiredModeGroups = {} # type: Dict[str, ModeDeclarationGroupPrototype]
|
|
29
|
+
|
|
30
|
+
def getModuleId(self):
|
|
31
|
+
return self.moduleId
|
|
32
|
+
|
|
33
|
+
def setModuleId(self, value):
|
|
34
|
+
self.moduleId = value
|
|
35
|
+
return self
|
|
28
36
|
|
|
29
37
|
def addImplementedEntry(self, entry_ref: RefType):
|
|
30
|
-
self.
|
|
38
|
+
self.implementedEntryRefs.append(entry_ref)
|
|
31
39
|
|
|
32
40
|
def getImplementedEntries(self) -> List[RefType]:
|
|
33
|
-
return self.
|
|
34
|
-
|
|
35
|
-
#@property
|
|
36
|
-
#def category(self) -> str:
|
|
37
|
-
# return ARElement.getCategory(self)
|
|
38
|
-
|
|
39
|
-
#@category.setter
|
|
40
|
-
#def category(self, value:str):
|
|
41
|
-
# if value is None:
|
|
42
|
-
# return
|
|
43
|
-
# if value not in ("BSW_MODULE", "BSW_CLUSTER", "LIBRARY"):
|
|
44
|
-
# raise ValueError("Invalid category <%s> of BswModuleDescription <%s>" % (value, self.short_name))
|
|
45
|
-
# ARElement.setCategory(self, value)
|
|
41
|
+
return self.implementedEntryRefs
|
|
46
42
|
|
|
47
43
|
def createProvidedModeGroup(self, short_name: str) -> ModeDeclarationGroupPrototype:
|
|
48
44
|
if (short_name not in self.elements):
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from ....M2.MSR.DataDictionary.DataDefProperties import SwDataDefProps
|
|
3
|
+
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import Identifier
|
|
4
|
+
from ....M2.AUTOSARTemplates.GenericStructure.AbstractStructure import AnyInstanceRef
|
|
5
|
+
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
|
|
6
|
+
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import ARElement, Identifiable
|
|
7
|
+
|
|
8
|
+
class FlatInstanceDescriptor(Identifiable):
|
|
9
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
10
|
+
super().__init__(parent, short_name)
|
|
11
|
+
|
|
12
|
+
self.ecuExtractReferenceIRef = None # type: AnyInstanceRef
|
|
13
|
+
self.role = None # type: Identifier
|
|
14
|
+
self.rtePluginProps = None # type: RtePluginProps
|
|
15
|
+
self.swDataDefProps = None # type: SwDataDefProps
|
|
16
|
+
self.upstreamReferenceIRef = None # type: AnyInstanceRef
|
|
17
|
+
|
|
18
|
+
def getEcuExtractReferenceIRef(self):
|
|
19
|
+
return self.ecuExtractReferenceIRef
|
|
20
|
+
|
|
21
|
+
def setEcuExtractReferenceIRef(self, value):
|
|
22
|
+
self.ecuExtractReferenceIRef = value
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
def getRole(self):
|
|
26
|
+
return self.role
|
|
27
|
+
|
|
28
|
+
def setRole(self, value):
|
|
29
|
+
self.role = value
|
|
30
|
+
return self
|
|
31
|
+
|
|
32
|
+
def getRtePluginProps(self):
|
|
33
|
+
return self.rtePluginProps
|
|
34
|
+
|
|
35
|
+
def setRtePluginProps(self, value):
|
|
36
|
+
self.rtePluginProps = value
|
|
37
|
+
return self
|
|
38
|
+
|
|
39
|
+
def getSwDataDefProps(self):
|
|
40
|
+
return self.swDataDefProps
|
|
41
|
+
|
|
42
|
+
def setSwDataDefProps(self, value):
|
|
43
|
+
self.swDataDefProps = value
|
|
44
|
+
return self
|
|
45
|
+
|
|
46
|
+
def getUpstreamReferenceIRef(self):
|
|
47
|
+
return self.upstreamReferenceIRef
|
|
48
|
+
|
|
49
|
+
def setUpstreamReferenceIRef(self, value):
|
|
50
|
+
self.upstreamReferenceIRef = value
|
|
51
|
+
return self
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class FlatMap(ARElement):
|
|
55
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
56
|
+
super().__init__(parent, short_name)
|
|
57
|
+
|
|
58
|
+
self.instances = [] # type: List[FlatInstanceDescriptor]
|
|
59
|
+
|
|
60
|
+
def getInstances(self):
|
|
61
|
+
return list(sorted(filter(lambda a: isinstance(a, FlatInstanceDescriptor), self.elements.values()), key= lambda o:o.short_name))
|
|
62
|
+
|
|
63
|
+
def createFlatInstanceDescriptor(self, short_name: str):
|
|
64
|
+
if (short_name not in self.elements):
|
|
65
|
+
element = FlatInstanceDescriptor(self, short_name)
|
|
66
|
+
self.addElement(element)
|
|
67
|
+
self.instances.append(element)
|
|
68
|
+
return self.getElement(short_name)
|
|
69
|
+
|
|
70
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
|
-
from ....M2.AUTOSARTemplates.CommonStructure import ResourceConsumption
|
|
3
|
+
from ....M2.AUTOSARTemplates.CommonStructure.ResourceConsumption import ResourceConsumption
|
|
4
4
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.EngineeringObject import AutosarEngineeringObject
|
|
5
5
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import Identifiable, PackageableElement, Referrable
|
|
6
6
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import PositiveInteger, RefType, ARLiteral, String
|
|
@@ -28,17 +28,18 @@ class Code(Identifiable):
|
|
|
28
28
|
def __init__(self, parent: ARObject, short_name: str):
|
|
29
29
|
super().__init__(parent, short_name)
|
|
30
30
|
|
|
31
|
-
self.
|
|
31
|
+
self.artifactDescriptors = [] # type: List[AutosarEngineeringObject]
|
|
32
32
|
self.callbackHeaderRefs = [] # type: List[RefType]
|
|
33
33
|
|
|
34
34
|
def addArtifactDescriptor(self, desc: AutosarEngineeringObject):
|
|
35
|
-
self.
|
|
35
|
+
self.artifactDescriptors.append(desc)
|
|
36
|
+
return self
|
|
36
37
|
|
|
37
38
|
def getArtifactDescriptors(self, category:str = "") -> List[AutosarEngineeringObject]:
|
|
38
39
|
if (category == ""):
|
|
39
|
-
return self.
|
|
40
|
+
return self.artifactDescriptors
|
|
40
41
|
else:
|
|
41
|
-
return list(filter(lambda a: a.getCategory().getText() == category, self.
|
|
42
|
+
return list(filter(lambda a: a.getCategory().getText() == category, self.artifactDescriptors))
|
|
42
43
|
|
|
43
44
|
class Compiler(Identifiable):
|
|
44
45
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -199,10 +200,12 @@ class Implementation(PackageableElement, metaclass = ABCMeta):
|
|
|
199
200
|
def getResourceConsumption(self):
|
|
200
201
|
return self.resourceConsumption
|
|
201
202
|
|
|
202
|
-
def
|
|
203
|
-
self.elements
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
def createResourceConsumption(self, short_name: str) -> ResourceConsumption:
|
|
204
|
+
if (short_name not in self.elements):
|
|
205
|
+
consumption = ResourceConsumption(self, short_name)
|
|
206
|
+
self.addElement(consumption)
|
|
207
|
+
self.resourceConsumption = consumption
|
|
208
|
+
return self.getElement(short_name)
|
|
206
209
|
|
|
207
210
|
def getSwcBswMappingRef(self):
|
|
208
211
|
return self.swcBswMappingRef
|
|
@@ -23,17 +23,18 @@ class ExecutableEntity(Identifiable, metaclass=ABCMeta):
|
|
|
23
23
|
|
|
24
24
|
super().__init__(parent, short_name)
|
|
25
25
|
|
|
26
|
-
self.
|
|
26
|
+
self.activationReasons = [] # type: List[ExecutableEntityActivationReason]
|
|
27
|
+
self.canEnterExclusiveAreaRefs = [] # type: List[RefType]
|
|
27
28
|
self.minimumStartInterval = None # type: ARFloat
|
|
28
29
|
self.reentrancyLevel = None #
|
|
29
|
-
|
|
30
|
+
|
|
30
31
|
self.swAddrMethodRef = None # type: RefType
|
|
31
32
|
|
|
32
|
-
def
|
|
33
|
-
return self.
|
|
33
|
+
def getActivationReasons(self):
|
|
34
|
+
return self.activationReasons
|
|
34
35
|
|
|
35
|
-
def
|
|
36
|
-
self.
|
|
36
|
+
def addActivationReason(self, value):
|
|
37
|
+
self.activationReasons.append(value)
|
|
37
38
|
return self
|
|
38
39
|
|
|
39
40
|
def getMinimumStartInterval(self):
|
|
@@ -76,33 +77,39 @@ class InternalBehavior(Identifiable, metaclass=ABCMeta):
|
|
|
76
77
|
raise NotImplementedError("InternalBehavior is an abstract class.")
|
|
77
78
|
super().__init__(parent, short_name)
|
|
78
79
|
|
|
79
|
-
self.
|
|
80
|
-
self.
|
|
80
|
+
self.constantMemories = [] # type: List[ParameterDataPrototype]
|
|
81
|
+
self.constantValueMappingRefs = [] # type: List[RefType]
|
|
82
|
+
self.dataTypeMappingRefs = [] # type: List[RefType]
|
|
83
|
+
self.exclusiveAreas = [] # type: List[ExclusiveArea]
|
|
84
|
+
self.exclusiveAreaNestingOrders = [] # type: List[ExclusiveAreaNestingOrder]
|
|
85
|
+
self.staticMemories = [] # type: List[VariableDataPrototype]
|
|
86
|
+
|
|
87
|
+
def createConstantMemory(self, short_name: str) -> ParameterDataPrototype:
|
|
88
|
+
if (short_name not in self.elements):
|
|
89
|
+
prototype = ParameterDataPrototype(self, short_name)
|
|
90
|
+
self.addElement(prototype)
|
|
91
|
+
self.constantMemories.append(prototype)
|
|
92
|
+
return self.getElement(short_name)
|
|
93
|
+
|
|
94
|
+
def getConstantMemorys(self) -> List[ParameterDataPrototype]:
|
|
95
|
+
return self.constantMemories
|
|
81
96
|
|
|
82
97
|
def addDataTypeMappingRef(self, ref: RefType):
|
|
83
|
-
self.
|
|
98
|
+
self.dataTypeMappingRefs.append(ref)
|
|
84
99
|
|
|
85
100
|
def getDataTypeMappingRefs(self) -> List[RefType]:
|
|
86
|
-
return self.
|
|
101
|
+
return self.dataTypeMappingRefs
|
|
87
102
|
|
|
88
103
|
def createExclusiveArea(self, short_name: str) -> ExclusiveArea:
|
|
89
104
|
if (short_name not in self.elements):
|
|
90
|
-
|
|
91
|
-
self.
|
|
92
|
-
|
|
105
|
+
area = ExclusiveArea(self, short_name)
|
|
106
|
+
self.addElement(area)
|
|
107
|
+
self.exclusiveAreas.append(area)
|
|
108
|
+
return self.getElement(short_name)
|
|
93
109
|
|
|
94
110
|
def getExclusiveAreas(self) -> List[ExclusiveArea]:
|
|
95
111
|
return list(filter(lambda c: isinstance(c, ExclusiveArea), self.elements.values()))
|
|
96
112
|
|
|
97
|
-
def createConstantMemory(self, short_name: str) -> ParameterDataPrototype:
|
|
98
|
-
if (short_name not in self.elements):
|
|
99
|
-
prototype = ParameterDataPrototype(self, short_name)
|
|
100
|
-
self.elements[short_name] = prototype
|
|
101
|
-
self.constant_memories.append(prototype)
|
|
102
|
-
return self.elements[short_name]
|
|
103
|
-
|
|
104
|
-
def getConstantMemorys(self) -> List[ParameterDataPrototype]:
|
|
105
|
-
return self.constant_memories
|
|
106
113
|
|
|
107
114
|
class AbstractEvent(Identifiable):
|
|
108
115
|
def __init__(self, parent: ARObject, short_name: str):
|
armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/HardwareConfiguration.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import String
|
|
2
|
+
from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
|
|
3
|
+
|
|
4
|
+
class HardwareConfiguration(ARObject):
|
|
5
|
+
def __init__(self):
|
|
6
|
+
super().__init__()
|
|
7
|
+
|
|
8
|
+
self.additionalInformation = None # type: String
|
|
9
|
+
self.processorMode = None # type: String
|
|
10
|
+
self.processorSpeed = None # type: String
|
|
11
|
+
|
|
12
|
+
def getAdditionalInformation(self):
|
|
13
|
+
return self.additionalInformation
|
|
14
|
+
|
|
15
|
+
def setAdditionalInformation(self, value):
|
|
16
|
+
self.additionalInformation = value
|
|
17
|
+
return self
|
|
18
|
+
|
|
19
|
+
def getProcessorMode(self):
|
|
20
|
+
return self.processorMode
|
|
21
|
+
|
|
22
|
+
def setProcessorMode(self, value):
|
|
23
|
+
self.processorMode = value
|
|
24
|
+
return self
|
|
25
|
+
|
|
26
|
+
def getProcessorSpeed(self):
|
|
27
|
+
return self.processorSpeed
|
|
28
|
+
|
|
29
|
+
def setProcessorSpeed(self, value):
|
|
30
|
+
self.processorSpeed = value
|
|
31
|
+
return self
|
|
32
|
+
|
|
33
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from abc import ABCMeta
|
|
2
|
+
from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
|
|
3
|
+
from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import Identifiable
|
|
4
|
+
|
|
5
|
+
class HeapUsage(Identifiable, metaclass = ABCMeta):
|
|
6
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
7
|
+
if type(self) == HeapUsage:
|
|
8
|
+
raise NotImplementedError("HeapUsage is an abstract class.")
|
|
9
|
+
|
|
10
|
+
super().__init__(parent, short_name)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from armodel.models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import String
|
|
2
|
+
from .....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
|
|
3
|
+
|
|
4
|
+
class SoftwareContext(ARObject):
|
|
5
|
+
def __init__(self):
|
|
6
|
+
super().__init__()
|
|
7
|
+
|
|
8
|
+
self.input = None # type: String
|
|
9
|
+
self.state = None # type: String
|
|
10
|
+
|
|
11
|
+
def getInput(self):
|
|
12
|
+
return self.input
|
|
13
|
+
|
|
14
|
+
def setInput(self, value):
|
|
15
|
+
self.input = value
|
|
16
|
+
return self
|
|
17
|
+
|
|
18
|
+
def getState(self):
|
|
19
|
+
return self.state
|
|
20
|
+
|
|
21
|
+
def setState(self, value):
|
|
22
|
+
self.state = value
|
|
23
|
+
return self
|