armodel 1.8.2__py3-none-any.whl → 1.8.4__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/format_xml_cli.py +62 -0
- armodel/cli/uuid_checker_cli.py +94 -0
- armodel/models/M2/AUTOSARTemplates/AutosarTopLevelStructure.py +4 -1
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswBehavior.py +7 -0
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswInterfaces.py +7 -4
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ImplementationDataTypes.py +17 -15
- armodel/models/M2/AUTOSARTemplates/CommonStructure/TriggerDeclaration.py +1 -1
- armodel/models/M2/AUTOSARTemplates/CommonStructure/__init__.py +44 -28
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/Identifiable.py +5 -5
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/PrimitiveTypes.py +15 -3
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Communication.py +247 -45
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/AutosarVariableRef.py +9 -6
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/DataElements.py +7 -5
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/RTEEvents.py +3 -3
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/Trigger.py +43 -2
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/__init__.py +40 -43
- armodel/models/M2/MSR/AsamHdo/ComputationMethod.py +13 -12
- armodel/models/M2/MSR/DataDictionary/DataDefProperties.py +40 -9
- armodel/models/utils/uuid_mgr.py +6 -0
- armodel/parser/abstract_arxml_parser.py +5 -1
- armodel/parser/arxml_parser.py +111 -62
- armodel/tests/test_armodel/models/test_common_structure.py +2 -2
- armodel/tests/test_armodel/parser/test_arxml_parser.py +38 -0
- armodel/tests/test_armodel/parser/test_implementation_data_type.py +247 -0
- armodel/tests/test_armodel/parser/test_rte_event.py +142 -0
- armodel/tests/test_armodel/parser/test_runnable_entity.py +135 -0
- armodel/writer/abstract_arxml_writer.py +2 -0
- armodel/writer/arxml_writer.py +106 -28
- {armodel-1.8.2.dist-info → armodel-1.8.4.dist-info}/METADATA +19 -1
- {armodel-1.8.2.dist-info → armodel-1.8.4.dist-info}/RECORD +34 -29
- {armodel-1.8.2.dist-info → armodel-1.8.4.dist-info}/entry_points.txt +2 -0
- {armodel-1.8.2.dist-info → armodel-1.8.4.dist-info}/LICENSE +0 -0
- {armodel-1.8.2.dist-info → armodel-1.8.4.dist-info}/WHEEL +0 -0
- {armodel-1.8.2.dist-info → armodel-1.8.4.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
import pkg_resources
|
|
4
|
+
import xml.etree.ElementTree as ET
|
|
5
|
+
from xml.dom import minidom
|
|
6
|
+
import logging
|
|
7
|
+
import re
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def patch_xml(xml: str) -> str:
|
|
11
|
+
xml = re.sub(r"\<([\w-]+)\/\>", r"<\1></\1>", xml)
|
|
12
|
+
# xml = re.sub(r"<([\w-]+)\s+(\w+)=(\"[\w-]+\")\/>", r"<\1 \2=\3></\1>", xml)
|
|
13
|
+
# xml = re.sub(r""", '"', xml)
|
|
14
|
+
return xml
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def perform_format(args):
|
|
18
|
+
try:
|
|
19
|
+
# Load XML file
|
|
20
|
+
logging.info("Loading XML file: %s" % args.INPUT)
|
|
21
|
+
tree = ET.parse(args.INPUT)
|
|
22
|
+
ET.register_namespace("", "http://autosar.org/schema/r4.0")
|
|
23
|
+
root = tree.getroot()
|
|
24
|
+
|
|
25
|
+
# Save the XML file
|
|
26
|
+
xml = ET.tostring(root, encoding="UTF-8", xml_declaration=True, short_empty_elements=False)
|
|
27
|
+
|
|
28
|
+
dom = minidom.parse(args.INPUT)
|
|
29
|
+
xml = dom.toprettyxml(indent=" ", encoding="UTF-8")
|
|
30
|
+
|
|
31
|
+
xml = patch_xml(xml.decode())
|
|
32
|
+
|
|
33
|
+
lines = xml.splitlines()
|
|
34
|
+
|
|
35
|
+
logging.info("Saving XML file: %s" % args.OUTPUT)
|
|
36
|
+
|
|
37
|
+
with open(args.OUTPUT, "w", encoding="utf-8") as f_out:
|
|
38
|
+
for line in lines:
|
|
39
|
+
if line.strip() == "":
|
|
40
|
+
continue
|
|
41
|
+
f_out.write(line + "\n")
|
|
42
|
+
|
|
43
|
+
except Exception as e:
|
|
44
|
+
logging.error(e)
|
|
45
|
+
sys.exit(1)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def main():
|
|
49
|
+
version = pkg_resources.require("armodel")[0].version
|
|
50
|
+
|
|
51
|
+
ap = argparse.ArgumentParser()
|
|
52
|
+
ap.description = "arxml-format ver: %s" % version
|
|
53
|
+
ap.add_argument("INPUT", help="The path of XML file")
|
|
54
|
+
ap.add_argument("OUTPUT", help="The path of XML file")
|
|
55
|
+
|
|
56
|
+
args = ap.parse_args()
|
|
57
|
+
|
|
58
|
+
perform_format(args)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if __name__ == "__main__":
|
|
62
|
+
main()
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import pkg_resources
|
|
3
|
+
import logging
|
|
4
|
+
import sys
|
|
5
|
+
import os.path
|
|
6
|
+
|
|
7
|
+
from ..models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import Referrable
|
|
8
|
+
from ..models.M2.AUTOSARTemplates.AutosarTopLevelStructure import AUTOSAR
|
|
9
|
+
from ..parser.arxml_parser import ARXMLParser
|
|
10
|
+
from ..lib.cli_args_parser import InputFileParser
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def perform_uuid_duplicate_check(args):
|
|
14
|
+
logger = logging.getLogger()
|
|
15
|
+
|
|
16
|
+
formatter = logging.Formatter('[%(levelname)s] : %(message)s')
|
|
17
|
+
|
|
18
|
+
stdout_handler = logging.StreamHandler(sys.stderr)
|
|
19
|
+
stdout_handler.setFormatter(formatter)
|
|
20
|
+
|
|
21
|
+
base_path = os.path.dirname(args.OUTPUT)
|
|
22
|
+
log_file = os.path.join(base_path, 'uuid_check.log')
|
|
23
|
+
|
|
24
|
+
if os.path.exists(log_file):
|
|
25
|
+
os.remove(log_file)
|
|
26
|
+
|
|
27
|
+
if args.verbose:
|
|
28
|
+
file_handler = logging.FileHandler(log_file)
|
|
29
|
+
file_handler.setFormatter(formatter)
|
|
30
|
+
file_handler.setLevel(logging.DEBUG)
|
|
31
|
+
|
|
32
|
+
logger.setLevel(logging.DEBUG)
|
|
33
|
+
|
|
34
|
+
if args.verbose:
|
|
35
|
+
stdout_handler.setLevel(logging.DEBUG)
|
|
36
|
+
else:
|
|
37
|
+
stdout_handler.setLevel(logging.INFO)
|
|
38
|
+
|
|
39
|
+
if args.verbose:
|
|
40
|
+
logger.addHandler(file_handler)
|
|
41
|
+
logger.addHandler(stdout_handler)
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
options = {}
|
|
45
|
+
if args.warning:
|
|
46
|
+
options['warning'] = True
|
|
47
|
+
|
|
48
|
+
inputs = []
|
|
49
|
+
inputs.append(args.INPUT)
|
|
50
|
+
parser = InputFileParser(inputs)
|
|
51
|
+
filenames = parser.parse()
|
|
52
|
+
|
|
53
|
+
document = AUTOSAR().getInstance()
|
|
54
|
+
parser = ARXMLParser(options)
|
|
55
|
+
|
|
56
|
+
for filename in filenames:
|
|
57
|
+
parser.load(filename, document)
|
|
58
|
+
|
|
59
|
+
with open(args.OUTPUT, 'w') as f_out:
|
|
60
|
+
for uuid in document.getDuplicateUUIDs():
|
|
61
|
+
ar_objects = document.getARObjectByUUID(uuid)
|
|
62
|
+
if len(ar_objects) > 1:
|
|
63
|
+
f_out.write("Duplicate UUID found: %s \n" % uuid)
|
|
64
|
+
for ar_object in ar_objects:
|
|
65
|
+
if isinstance(ar_object, Referrable):
|
|
66
|
+
f_out.write(" - %s (%s)\n" % (ar_object.getFullName(), type(ar_object).__name__))
|
|
67
|
+
else:
|
|
68
|
+
raise NotImplementedError("Unsupported type <%s>" % type(ar_object))
|
|
69
|
+
|
|
70
|
+
except Exception as e:
|
|
71
|
+
logger.error(e)
|
|
72
|
+
if args.verbose:
|
|
73
|
+
raise e
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def main():
|
|
77
|
+
version = pkg_resources.require("armodel")[0].version
|
|
78
|
+
|
|
79
|
+
ap = argparse.ArgumentParser()
|
|
80
|
+
ap.description = "arxml-format ver: %s" % version
|
|
81
|
+
ap.add_argument("-v", "--verbose", required=False, help="Print debug information", action="store_true")
|
|
82
|
+
ap.add_argument("--log", required=False, help="Log all information to file")
|
|
83
|
+
ap.add_argument("-w", "--warning", required=False, help="Skip the error and report it as warning message", action="store_true")
|
|
84
|
+
|
|
85
|
+
ap.add_argument("INPUT", help="The path of AUTOSAR ARXML file")
|
|
86
|
+
ap.add_argument("OUTPUT", help="The path of output ARXML file")
|
|
87
|
+
|
|
88
|
+
args = ap.parse_args()
|
|
89
|
+
|
|
90
|
+
perform_uuid_duplicate_check(args)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
main()
|
|
@@ -247,13 +247,16 @@ class AbstractAUTOSAR(CollectableElement):
|
|
|
247
247
|
return self
|
|
248
248
|
|
|
249
249
|
def getARObjectByUUID(self, uuid: str) -> List[ARObject]:
|
|
250
|
-
return self.uuid_mgr.getObjects()
|
|
250
|
+
return self.uuid_mgr.getObjects(uuid)
|
|
251
251
|
|
|
252
252
|
def addARObject(self, value: ARObject):
|
|
253
253
|
if value is not None:
|
|
254
254
|
self.uuid_mgr.addObject(value)
|
|
255
255
|
return self
|
|
256
256
|
|
|
257
|
+
def getDuplicateUUIDs(self) -> List[str]:
|
|
258
|
+
return self.uuid_mgr.getDuplicateUUIDs()
|
|
259
|
+
|
|
257
260
|
def setARRelease(self, release: str):
|
|
258
261
|
if release not in self.release_xsd_mappings:
|
|
259
262
|
raise "invalid AUTOSAR Release <%s>" % release
|
|
@@ -162,6 +162,13 @@ class BswModuleEntity(ExecutableEntity, metaclass=ABCMeta):
|
|
|
162
162
|
self.addElement(access)
|
|
163
163
|
self.callPoints.append(access)
|
|
164
164
|
return self.getElement(short_name)
|
|
165
|
+
|
|
166
|
+
def createBswSynchronousServerCallPoint(self, short_name):
|
|
167
|
+
if (not self.IsElementExists(short_name)):
|
|
168
|
+
access = BswSynchronousServerCallPoint(self, short_name)
|
|
169
|
+
self.addElement(access)
|
|
170
|
+
self.callPoints.append(access)
|
|
171
|
+
return self.getElement(short_name)
|
|
165
172
|
|
|
166
173
|
def getDataReceivePoints(self):
|
|
167
174
|
return self.dataReceivePoints
|
|
@@ -45,7 +45,7 @@ class BswModuleEntry(ARElement):
|
|
|
45
45
|
def __init__(self, parent: ARObject, short_name: str):
|
|
46
46
|
super().__init__(parent, short_name)
|
|
47
47
|
|
|
48
|
-
self.arguments = [] # type
|
|
48
|
+
self.arguments = [] # type
|
|
49
49
|
self.bswEntryKind = None # type: BswEntryKindEnum
|
|
50
50
|
self.callType = None # type: BswCallType
|
|
51
51
|
self.executionContext = None # type: BswExecutionContext
|
|
@@ -114,9 +114,12 @@ class BswModuleEntry(ARElement):
|
|
|
114
114
|
def getReturnType(self):
|
|
115
115
|
return self.returnType
|
|
116
116
|
|
|
117
|
-
def
|
|
118
|
-
self.
|
|
119
|
-
|
|
117
|
+
def createReturnType(self, short_name: str) -> SwServiceArg:
|
|
118
|
+
if (short_name not in self.elements):
|
|
119
|
+
arg = SwServiceArg(self, short_name)
|
|
120
|
+
self.addElement(arg)
|
|
121
|
+
self.returnType = arg
|
|
122
|
+
return self.getElement(short_name)
|
|
120
123
|
|
|
121
124
|
def getRole(self):
|
|
122
125
|
return self.role
|
|
@@ -21,33 +21,34 @@ class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
|
|
|
21
21
|
def __init__(self, parent, short_name: str):
|
|
22
22
|
super().__init__(parent, short_name)
|
|
23
23
|
|
|
24
|
-
self.arrayImplPolicy = None
|
|
25
|
-
self.arraySize = None
|
|
26
|
-
self.arraySizeHandling = None
|
|
27
|
-
self.arraySizeSemantics = None
|
|
28
|
-
self.isOptional = None
|
|
29
|
-
self.
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
self.arrayImplPolicy: ARLiteral = None
|
|
25
|
+
self.arraySize: ARNumerical = None
|
|
26
|
+
self.arraySizeHandling: ARLiteral = None
|
|
27
|
+
self.arraySizeSemantics: ARLiteral = None
|
|
28
|
+
self.isOptional: ARBoolean = None
|
|
29
|
+
self.subElements: List[ImplementationDataTypeElement] = []
|
|
30
|
+
self.swDataDefProps: SwDataDefProps = None
|
|
31
|
+
|
|
32
|
+
def getArrayImplPolicy(self) -> ARLiteral:
|
|
32
33
|
return self.arrayImplPolicy
|
|
33
34
|
|
|
34
|
-
def setArrayImplPolicy(self, value):
|
|
35
|
+
def setArrayImplPolicy(self, value: ARLiteral):
|
|
35
36
|
if value is not None:
|
|
36
37
|
self.arrayImplPolicy = value
|
|
37
38
|
return self
|
|
38
39
|
|
|
39
|
-
def getArraySize(self):
|
|
40
|
+
def getArraySize(self) -> ARNumerical:
|
|
40
41
|
return self.arraySize
|
|
41
42
|
|
|
42
|
-
def setArraySize(self, value):
|
|
43
|
+
def setArraySize(self, value: ARNumerical):
|
|
43
44
|
if value is not None:
|
|
44
45
|
self.arraySize = value
|
|
45
46
|
return self
|
|
46
47
|
|
|
47
|
-
def getArraySizeHandling(self):
|
|
48
|
+
def getArraySizeHandling(self) -> ARLiteral:
|
|
48
49
|
return self.arraySizeHandling
|
|
49
50
|
|
|
50
|
-
def setArraySizeHandling(self, value):
|
|
51
|
+
def setArraySizeHandling(self, value: ARLiteral):
|
|
51
52
|
if value is not None:
|
|
52
53
|
self.arraySizeHandling = value
|
|
53
54
|
return self
|
|
@@ -80,10 +81,11 @@ class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
|
|
|
80
81
|
if (not self.IsElementExists(short_name)):
|
|
81
82
|
type_element = ImplementationDataTypeElement(self, short_name)
|
|
82
83
|
self.addElement(type_element)
|
|
84
|
+
self.subElements.append(type_element)
|
|
83
85
|
return self.getElement(short_name, ImplementationDataTypeElement)
|
|
84
86
|
|
|
85
|
-
def
|
|
86
|
-
return
|
|
87
|
+
def getSubElements(self) -> List["ImplementationDataTypeElement"]:
|
|
88
|
+
return self.subElements
|
|
87
89
|
|
|
88
90
|
|
|
89
91
|
class AbstractImplementationDataType(AutosarDataType, metaclass=ABCMeta):
|
|
@@ -8,7 +8,7 @@ class Trigger(Identifiable):
|
|
|
8
8
|
def __init__(self, parent: ARObject, short_name: str):
|
|
9
9
|
super().__init__(parent, short_name)
|
|
10
10
|
|
|
11
|
-
self.swImplPolicy = None
|
|
11
|
+
self.swImplPolicy: SwImplPolicyEnum = None
|
|
12
12
|
self.triggerPeriod = None # type: MultidimensionalTime
|
|
13
13
|
|
|
14
14
|
def getSwImplPolicy(self):
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
3
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
|
|
4
|
-
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARNumerical
|
|
4
|
+
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARNumerical, RefType
|
|
5
5
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import ARElement
|
|
6
6
|
from ....M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARLiteral
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
class ValueSpecification(ARObject, metaclass=ABCMeta):
|
|
9
10
|
'''
|
|
10
11
|
Base class for expressions leading to a value which can be used to initialize a data object.
|
|
11
|
-
|
|
12
|
+
|
|
12
13
|
Base : ARObject
|
|
13
14
|
Subclasses : AbstractRuleBasedValueSpecification, ApplicationValueSpecification, CompositeValueSpecification,
|
|
14
|
-
ConstantReference, NotAvailableValueSpecification, NumericalValueSpecification, ReferenceValueSpecification,
|
|
15
|
+
ConstantReference, NotAvailableValueSpecification, NumericalValueSpecification, ReferenceValueSpecification,
|
|
15
16
|
TextValueSpecification
|
|
16
17
|
'''
|
|
18
|
+
|
|
17
19
|
def __init__(self):
|
|
18
|
-
if type(self)
|
|
19
|
-
raise NotImplementedError(
|
|
20
|
-
|
|
20
|
+
if type(self) is ValueSpecification:
|
|
21
|
+
raise NotImplementedError(
|
|
22
|
+
"ValueSpecification is an abstract class.")
|
|
23
|
+
|
|
21
24
|
super().__init__()
|
|
22
25
|
|
|
23
26
|
self.shortLabel = None
|
|
@@ -28,21 +31,25 @@ class ValueSpecification(ARObject, metaclass = ABCMeta):
|
|
|
28
31
|
def setShortLabel(self, value):
|
|
29
32
|
self.shortLabel = value
|
|
30
33
|
return self
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class CompositeValueSpecification(ValueSpecification, metaclass=ABCMeta):
|
|
33
37
|
'''
|
|
34
38
|
This abstract meta-class acts a base class for ValueSpecifications that have a composite form.
|
|
35
39
|
|
|
36
40
|
Base : ARObject, ValueSpecification
|
|
37
41
|
Subclasses : ArrayValueSpecification, RecordValueSpecification
|
|
38
|
-
'''
|
|
42
|
+
'''
|
|
43
|
+
|
|
39
44
|
def __init__(self):
|
|
40
|
-
if type(self)
|
|
41
|
-
raise NotImplementedError(
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
if type(self) is CompositeValueSpecification:
|
|
46
|
+
raise NotImplementedError(
|
|
47
|
+
"CompositeValueSpecification is an abstract class.")
|
|
48
|
+
|
|
49
|
+
super().__init__()
|
|
50
|
+
|
|
44
51
|
|
|
45
|
-
class CompositeRuleBasedValueArgument(ARObject, metaclass
|
|
52
|
+
class CompositeRuleBasedValueArgument(ARObject, metaclass=ABCMeta):
|
|
46
53
|
'''
|
|
47
54
|
This meta-class has the ability to serve as the abstract base class for ValueSpecifications that can be
|
|
48
55
|
used for compound primitive data types.
|
|
@@ -50,12 +57,15 @@ class CompositeRuleBasedValueArgument(ARObject, metaclass = ABCMeta):
|
|
|
50
57
|
Base : ARObject
|
|
51
58
|
Subclasses : ApplicationRuleBasedValueSpecification, ApplicationValueSpecification
|
|
52
59
|
'''
|
|
60
|
+
|
|
53
61
|
def __init__(self):
|
|
54
|
-
if type(self)
|
|
55
|
-
raise NotImplementedError(
|
|
56
|
-
|
|
62
|
+
if type(self) is CompositeRuleBasedValueArgument:
|
|
63
|
+
raise NotImplementedError(
|
|
64
|
+
"CompositeRuleBasedValueArgument is an abstract class.")
|
|
65
|
+
|
|
57
66
|
super().__init__()
|
|
58
67
|
|
|
68
|
+
|
|
59
69
|
class ApplicationValueSpecification(CompositeRuleBasedValueArgument, ValueSpecification):
|
|
60
70
|
'''
|
|
61
71
|
This meta-class represents values for DataPrototypes typed by ApplicationDataTypes (this includes in
|
|
@@ -63,10 +73,11 @@ class ApplicationValueSpecification(CompositeRuleBasedValueArgument, ValueSpecif
|
|
|
63
73
|
For further details refer to ASAM CDF 2.0. This meta-class corresponds to some extent with
|
|
64
74
|
SW-INSTANCE in ASAM CDF 2.0.
|
|
65
75
|
|
|
66
|
-
Base ARObject, CompositeRuleBasedValueArgument, ValueSpecification
|
|
76
|
+
Base ARObject, CompositeRuleBasedValueArgument, ValueSpecification
|
|
67
77
|
'''
|
|
78
|
+
|
|
68
79
|
def __init__(self):
|
|
69
|
-
|
|
80
|
+
|
|
70
81
|
CompositeRuleBasedValueArgument.__init__(self)
|
|
71
82
|
ValueSpecification.__init__(self)
|
|
72
83
|
|
|
@@ -99,9 +110,10 @@ class ApplicationValueSpecification(CompositeRuleBasedValueArgument, ValueSpecif
|
|
|
99
110
|
class RecordValueSpecification(CompositeValueSpecification):
|
|
100
111
|
'''
|
|
101
112
|
Specifies the values for a record.
|
|
102
|
-
|
|
113
|
+
|
|
103
114
|
Base : ARObject, CompositeValueSpecification, ValueSpecification
|
|
104
115
|
'''
|
|
116
|
+
|
|
105
117
|
def __init__(self):
|
|
106
118
|
super().__init__()
|
|
107
119
|
|
|
@@ -112,7 +124,8 @@ class RecordValueSpecification(CompositeValueSpecification):
|
|
|
112
124
|
|
|
113
125
|
def getFields(self) -> List[ValueSpecification]:
|
|
114
126
|
return self.fields
|
|
115
|
-
|
|
127
|
+
|
|
128
|
+
|
|
116
129
|
class TextValueSpecification(ValueSpecification):
|
|
117
130
|
def __init__(self):
|
|
118
131
|
super().__init__()
|
|
@@ -131,13 +144,14 @@ class NumericalValueSpecification(ValueSpecification):
|
|
|
131
144
|
def __init__(self):
|
|
132
145
|
super().__init__()
|
|
133
146
|
|
|
134
|
-
self.value = None
|
|
147
|
+
self.value: ARNumerical = None
|
|
135
148
|
|
|
136
|
-
def getValue(self):
|
|
149
|
+
def getValue(self) -> ARNumerical:
|
|
137
150
|
return self.value
|
|
138
151
|
|
|
139
|
-
def setValue(self, value):
|
|
140
|
-
|
|
152
|
+
def setValue(self, value: ARNumerical):
|
|
153
|
+
if value is not None:
|
|
154
|
+
self.value = value
|
|
141
155
|
return self
|
|
142
156
|
|
|
143
157
|
|
|
@@ -145,7 +159,8 @@ class ArrayValueSpecification(ValueSpecification):
|
|
|
145
159
|
def __init__(self):
|
|
146
160
|
super().__init__()
|
|
147
161
|
|
|
148
|
-
|
|
162
|
+
# type: List[ValueSpecification]
|
|
163
|
+
self.element = []
|
|
149
164
|
self.intendedPartialInitializationCount = None
|
|
150
165
|
|
|
151
166
|
def getIntendedPartialInitializationCount(self):
|
|
@@ -161,6 +176,7 @@ class ArrayValueSpecification(ValueSpecification):
|
|
|
161
176
|
def getElements(self) -> List[ValueSpecification]:
|
|
162
177
|
return self.element
|
|
163
178
|
|
|
179
|
+
|
|
164
180
|
class ConstantSpecification(ARElement):
|
|
165
181
|
def __init__(self, parent, short_name):
|
|
166
182
|
super().__init__(parent, short_name)
|
|
@@ -179,7 +195,7 @@ class ConstantReference(ValueSpecification):
|
|
|
179
195
|
def __init__(self):
|
|
180
196
|
super().__init__()
|
|
181
197
|
|
|
182
|
-
self.constantRef = None
|
|
198
|
+
self.constantRef: RefType = None
|
|
183
199
|
|
|
184
200
|
def getConstantRef(self):
|
|
185
201
|
return self.constantRef
|
|
@@ -122,11 +122,11 @@ class Identifiable(MultilanguageReferrable, CollectableElement, metaclass=ABCMet
|
|
|
122
122
|
MultilanguageReferrable.__init__(self, parent, short_name)
|
|
123
123
|
CollectableElement.__init__(self)
|
|
124
124
|
|
|
125
|
-
self.annotations
|
|
126
|
-
self.adminData = None
|
|
127
|
-
self.category = None
|
|
128
|
-
self.introduction = None
|
|
129
|
-
self.desc = None
|
|
125
|
+
self.annotations: List[Annotation] = []
|
|
126
|
+
self.adminData: AdminData = None
|
|
127
|
+
self.category: CategoryString = None
|
|
128
|
+
self.introduction: DocumentationBlock = None
|
|
129
|
+
self.desc: MultiLanguageOverviewParagraph = None
|
|
130
130
|
|
|
131
131
|
def getAdminData(self):
|
|
132
132
|
return self.adminData
|
armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/PrimitiveTypes.py
CHANGED
|
@@ -34,7 +34,8 @@ class ARNumerical(ARType):
|
|
|
34
34
|
def __init__(self) -> None:
|
|
35
35
|
super().__init__()
|
|
36
36
|
|
|
37
|
-
self.
|
|
37
|
+
self.shortLabel: str = None
|
|
38
|
+
self._text: str = None
|
|
38
39
|
|
|
39
40
|
def _convertStringToNumberValue(self, value: str) -> int:
|
|
40
41
|
try:
|
|
@@ -75,7 +76,18 @@ class ARNumerical(ARType):
|
|
|
75
76
|
return self._text
|
|
76
77
|
else:
|
|
77
78
|
return str(self._value)
|
|
79
|
+
|
|
80
|
+
def getValue(self):
|
|
81
|
+
return self.value
|
|
78
82
|
|
|
83
|
+
def setShortLabel(self, val: str):
|
|
84
|
+
if val is not None:
|
|
85
|
+
self.shortLabel = val
|
|
86
|
+
return self
|
|
87
|
+
|
|
88
|
+
def getShortLabel(self) -> str:
|
|
89
|
+
return self.shortLabel
|
|
90
|
+
|
|
79
91
|
|
|
80
92
|
class ARFloat(ARNumerical):
|
|
81
93
|
def __init__(self) -> None:
|
|
@@ -236,8 +248,8 @@ class ARBoolean(ARType):
|
|
|
236
248
|
self._value = self._convertNumberToBoolean(val)
|
|
237
249
|
self._text = str(val)
|
|
238
250
|
elif isinstance(val, str):
|
|
239
|
-
self.
|
|
240
|
-
self.
|
|
251
|
+
self._value = self._convertStringToBoolean(val.strip())
|
|
252
|
+
self._text = val.strip()
|
|
241
253
|
else:
|
|
242
254
|
raise ValueError("Unsupported Type <%s>", type(val))
|
|
243
255
|
|