AUTOSAR AP的版本为: 19-11
因为pdf文档一共八百多页,只有13章的样子,因此基本平均每章都有一百多页,都很长,所以在这里将其拆分开来记录。
3 Application Design
3.1 Overview
本章描述了适用于在AUTOSAR自适应平台上创建应用程序软件的所有与设计相关的建模。这也扩展到AUTOSAR经典平台上使用的现有建模的扩展,例如引入属性类别的新值。
特别是,本节将重点介绍以下几个方面:
- AUTOSAR自适应平台SwComponentType专用子类的定义(section 3.2) 。
- AUTOSAR自适应平台专用数据类型的定义(section 3.3)。
- 服务接口是面向服务通信的关键要素 (section 3.4)。
- 服务接口映射作为内部和外部通信之间的中介 (section 3.5)。
- 服务接口元素映射作为内部和外部通信之间的中介 (section 3.6)。
- 持久接口作为与持久数据存储交互的基础(section 3.8)。
- 从软件组件内部看与“外部世界”交互的细粒度配置(section 3.13)。
- Executable作为最小可执行单元(section 3.14)。
- 转换属性的配置(section 3.16)。
3.2 Software Component
原则上,可以直接接管ApplicationSwComponentType的定义,以便在AUTOSAR自适应平台上使用。但是,这会使关于AUTOSAR自适应平台专有的模型元素(例如:数据类型,如第3.3节中所述)的存在的约束条件的制定变得复杂。因此,AdaptiveApplicationSwComponentType被定义为AUTOSAR自适应平台上软件组件的表示。
AdaptiveApplicationSwComponentType的存在提供了一种便捷的方法(请参见[constr_1492]),从而可以从AUTOSAR自适应平台上的使用中锁定为AUTOSAR经典平台定义的大多数软件组件。
相反方向的澄清(即AdaptiveApplicationSwComponentType的错误使用)不太明显。
换句话说,可以在系统中使用AdaptiveApplicationSwComponentType作为AUTOSAR经典平台和AUTOSAR自适应平台上软件的某种总体设计模型。
但是,到目前为止,这一方面还没有得到澄清,也没有限制AdaptiveApplicationSwComponentType出现在系统上下文中。本规范的较新版本可能会修复缺少的规则。
| Class | AdaptiveApplicationSwComponentType | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::ApplicationStructure | |||
| Note | 这个元类表示在AUTOSAR自适应平台上支持应用软件形式化建模的能力。因此,只能在AUTOSAR自适应平台上使用。 Tags: atp.Status = draft atp.recommendedPackage=AdaptiveApplicationSwComponentTypes | |||
| Base | ARElement, ARObject, AtpBlueprint, AtpBlueprintable, AtpClassifier, AtpType, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable, SwComponentType | |||
| Attribute | Type | Mult. | Kind | Note |
| internalBehavior | AdaptiveSwcInternal Behavior | 0..1 | aggr | 此聚合表示AUTOSAR自适应平台的 AdaptiveApplicationSwComponentType的内部行为。 Stereotypes: atpSplitable; atpVariation Tags: atp.Splitkey=internalBehavior, variationPoint.shortLabel atp.Status=draft vh.latestBindingTime=preCompileTime |
| Class | AdaptiveSwcInternalBehavior | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::AdaptiveInternalBehavior | |||
| Note | 这个元类表示定义AUTOSAR自适应平台上使用的AtomicSwComponentType的内部行为的能力 请注意,本例中的内部行为模型与AUTOSAR经典平台的情况形成鲜明对比,是非常小的 Tags: atp.Status = draft | |||
| Base | ARObject, Identifiable, MultilanguageReferrable, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| serviceDependency | SwcServiceDependency | * | aggr | 这表示AdaptiveInternalBehavior拥有的SwcServiceDependencys的集合 Tags: atp.Status=draft |
3.3 Data Type
3.3.1 Overview
AUTOSAR自适应平台上的数据类型规范遵循与AUTOSAR经典平台上的数据类型相同的模式:数据类型定义在不同的抽象级别上,这些抽象级别相互补充。在本文中,重点讨论ApplicationDataTypes和cpppimplementationdatatypes。
一般来说,关于数据类型定义的大多数概念可以从AUTOSAR经典平台上的现有规范中获得。但是,某些方面是AUTOSAR自适应平台特有的,因此在本文档的范围内进行了讨论,而不是AUTOSAR软件组件模板的规范[1]。
可以从AUTOSAR经典平台沿用的方面之一是初始值的定义。虽然初始值的效用在AUTOSAR自适应平台上肯定是有限的,但是在所谓的Fields的上下文中有机会利用初始值的定义(参见[TPS_MANI_01034])。
3.3.2 ApplicationDataType
AUTOSAR经典平台支持的ApplicationDataTypes的完整建模范围也可以直接用于AUTOSAR自适应平台。
除了AUTOSAR经典平台支持的ApplicationDataTypes之外,还有更多的ApplicationDataTypes(原则上也可以在AUTOSAR经典平台上使用)主要用于AUTOSAR自适应平台并为其设计。
| Class | ApplicationDataType (abstract) | |||
| Package | M2::AUTOSARTemplates::SWComponentTemplate::Datatype::Datatypes | |||
| Note | application data type从应用程序的角度定义数据类型。尤其是当“物理”受限时应该使用它。 ApplicationDataType代表在应用程序模型中看到的一组值,例如度量单位。 它不考虑实现细节,例如位大小,字节序等。 应该可以只使用ApplicationData类型对VFB系统的应用程序级方面进行建模。 | |||
| Base | ARElement, ARObject, AtpBlueprint, AtpBlueprintable, AtpClassifier, AtpType, AutosarDataType, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable | |||
| Subclasses | ApplicationCompositeDataType, ApplicationPrimitiveDataType | |||
| Attribute | Type | Mult. | Kind | Note |
| - | - | - | - | - |
3.3.2.1 String Data Type
虽然对于表示文本字符串的数据类型的处理与AUTOSAR经典平台和AUTOSAR自适应平台上ApplicationDataTypes的定义非常相似,但对于AUTOSAR自适应平台上cpppimplementationdatatypes的级别,有特殊的规定。
有关在cpppimplementationdatatype级别上对字符串数据类型建模的更多信息,请参阅第3.3.3.4节。
为了保持一致性,本章总结了ApplicationDataTypes的建模,以便对AUTOSAR自适应平台所涉及的表示文本字符串的数据类型进行建模。
用于定义类别STRING的ApplicationPrimitiveDataType的元类如图3.1所示。
请注意,由于使用的编程语言的数据类型比普通C语言更丰富,因此在AUTOSAR自适应平台上为给定的语言绑定预定义了类别字符串的ApplicationPrimitiveDataType的实现。
[TPS_MANI_01047]{DRAFT} 存在类别STRING的ApplicationPrimitiveDataType的SwRecordLayout:对于在AUTOSAR自适应平台上使用类别STRING的ApplicationPrimitiveDataType,存在applicationionPrimitiveDataType.swDataDefProps. 应忽略swRecordLayout。(RS_MANI_00016)
请注意**[TPS_MANI_01047]**故意不禁止SwRecordLayout的存在,是因为同一个类别STRING的ApplicationPrimitiveDataType可以在AUTOSAR自适应平台和AUTOSAR经典平台上都能正确地使用。
| Class | ApplicationPrimitiveDataType | |||
| Package | M2::AUTOSARTemplates::SWComponentTemplate::Datatype::Datatypes | |||
| Note | 基本数据类型定义了一组允许的值。 Tags:atp.recommendedPackage=ApplicationDataTypes | |||
| Base | ARElement, ARObject, ApplicationDataType, AtpBlueprint, AtpBlueprintable, AtpClassifier, AtpType, AutosarDataType, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| - | - | - | - | - |
| Class | SwTextProps | |||
| Package | M2::MSR::DataDictionary::DataDefProperties | |||
| Note | 这个元类表示适用于变量或校准参数中字符串的特定属性。 Tags:atp.recommendedPackage=ApplicationDataTypes | |||
| Base | ARObject | |||
| Attribute | Type | Mult. | Kind | Note |
| arraySizeSemantics | ArraySizeSemanticsEnum | 1 | attr | 此属性控制表示实现数据类型中字符串的数组的数组大小的语义。 它支持ApplicationDatatype和ImplementationDatatype之间的安全转换, 即使是需要的可变长度字符串,例如支持SAE J1939 |
| baseType | SwBaseType | 0..1 | ref | 这是字符串中一个字符的基类型。特别是,此baseType表示 ApplicationData类型级别上字符串中字符的预期编码 Tags:xml.sequenceOffset=30 |
| swFillCharacter | Integer | 0..1 | attr | 填充最大长度swMaxTextSize的文本参数的填充字符 该值将根据数据对象的相关基类型中指定的编码进行解释, 例如0x30(十六进制)表示ASCII字符零作为填充字符, 0(十进制)表示字符串的结束作为填充字符 填充字符的使用取决于数组化语义。 Tags:xml.sequenceOffset=40 |
| swMaxTextSize | Integer | 1 | attr | 指定最大文本大小(以字符为单位)。注意字节的大小取决于相应基类型中的编码。 Stereotypes:atpVariation Tags: vh.latestBindingTime=preCompileTime xml.sequenceOffset=20 |
3.3.2.2 Associative Map Data Type
[TPS_MANI_01027]{DRAFT} ApplicationAssocMapDataType的语义: ApplicationAssocMapDataType表示关联数据结构,即所谓的键(形式化为ApplicationAssocMapDataType.key,依次由ApplicationDataType键入)与值(形式化为ApplicationAssocMapDataType.value,也由ApplicationDataType键入)关联的数据结构。(RS_MANI_00016)
[constr_3349] {DRAFT}ApplicationAssocMapDataType的使用是受到限制的: ApplicationAssocMapDataType的使用仅限于在可执行文件上下文中定义的AdaptiveApplicationSwComponentTypes和CompositionSwComponentTypes的上下文,即此类数据类型不应在AUTOSAR classic平台上使用。
[constr_3349] 是一种形式化的方法,用于表示ApplicationAssocMapDataType只能在AUTOSAR自适应平台上使用。
[TPS_MANI_01016]{DRAFT}ApplicationAssocMapDataType 的类别:ApplicationAssocMapDataType.category 的值应设置为属性的关联映射(ASSOCIATIVE_MAP)。
图3.2描述了ApplicationAssocMapDataType的结构示例。
如图3.2所示,分类图的ApplicationDataType的概念不应与ApplicationAssocMapDataType混淆。
在运行时使用关联数据结构有许多技术含义,例如,在整个数据结构的上下文中,每个键的内容应是唯一的。另一方面,如果值端的内容包含重复项,则完全没有问题,例如,两个唯一键与具有完全相同内容的值相关联。但是,这些方面对ApplicationAssocMapDataType的形式化模型没有任何影响,因此本文档中不考虑这些方面。
ApplicationAssocMapDataType的建模有点简单,其动机主要是需要定义键和值的数据类型。
没有假设关联映射的实现的结构可能是什么样子的。例如,在C++(它是目前唯一支持的AutoSar自适应平台上的语言绑定)中,使用关联映射的直接方式是利用容器ara::core::Map(其中实现对客户端程序员不透明)。
| Class | ApplicationAssocMapDataType | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::ApplicationDataType | |||
| Note | 一种应用程序的数据类型,它是一个映射,由一个键和一个值组成。 Tags: atp.Status=draft atp.recommendedPackage=ApplicationDataTypes | |||
| Base | ARElement, ARObject, ApplicationCompositeDataType, ApplicationDataType, AtpBlueprint, Atp Blueprintable, AtpClassifier, AtpType, AutosarDataType, CollectableElement, Identifiable, Multilanguage Referrable, PackageableElement, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| key | ApplicationAssocMapElement | 1 | aggr | 用于唯一标识映射值的映射的键元素。 Tags:atp.Status=draft |
| value | ApplicationAssocMapElement | 1 | aggr | 存储与键关联的内容的映射的值元素。 Tags:atp.Status=draft |
| Class | ApplicationAssocMapElement | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::ApplicationDataType | |||
| Note | 描述应用程序映射数据类型的元素的属性。 Tags:atp.Status=draft | |||
| Base | ARObject, ApplicationCompositeElementDataPrototype, AtpFeature, AtpPrototype, DataPrototype, Identifiable, MultilanguageReferrable, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| - | - | - | - | - |
清单3.1提供了一个ApplicationAssocMapDataType的建模草图示例。
图3.4包含模型的相应图形表示。
<APPLICATION-ASSOC-MAP-DATA-TYPE>
<SHORT-NAME>MyAssociativeMap</SHORT-NAME>
<KEY>
<SHORT-NAME>MyKey</SHORT-NAME>
<TYPE-TREF DEST="APPLICATION-PRIMITIVE-DATA-TYPE">keyType</TYPE-TREF>
</KEY>
<VALUE>
<SHORT-NAME>MyValue</SHORT-NAME>
<TYPE-TREF DEST="APPLICATION-PRIMITIVE-DATA-TYPE">valueType</TYPE-TREF>
</VALUE>
</APPLICATION-ASSOC-MAP-DATA-TYPE>
<APPLICATION-PRIMITIVE-DATA-TYPE>
<SHORT-NAME>keyType</SHORT-NAME>
<CATEGORY>VALUE</CATEGORY>
</APPLICATION-PRIMITIVE-DATA-TYPE>
<APPLICATION-PRIMITIVE-DATA-TYPE>
<SHORT-NAME>valueType</SHORT-NAME>
<CATEGORY>VALUE</CATEGORY>
</APPLICATION-PRIMITIVE-DATA-TYPE>
但是,需要澄清ApplicationAssocMapDataType的初始化,因为它通常(使用RecordValueSpecification和ArrayValueSpecification的组合)在技术上可以定义多个语义相同的不同结构的ValueSpecifications。
为了使这种不确定因素不符合AUTOSAR标准,通过[constr_1488]阐明了由ApplicationAssocMapDataType类型化的DataPrototype的初始化。
[constr_1488]{DRAFT}初始化由ApplicationAssocMapDataType类型化的数据原型(DataPrototype): 由ApplicationAssocMapDataType类型化的数据原型(DataPrototype)只能由ApplicationAssocMapValueSpecification初始化。
如前所述,有一个语义需求,即关联映射的关键元素需要在一个关联映射容器的上下文中唯一。
显然,模型对运行时发生的事情没有影响。另一方面,对ApplicationAssocMapDataType的初始化有隐含潜在的影响,请参见[constr_1489]
[constr_1489]{DRAFT} ApplicationAssocMapValueSpecification.mapElementTuple.key 的唯一性: 在给定的ApplicationAssocMapValueSpecification上下文中,所有mapElementTuple.key元素的值都应该是唯一的。

| Class | ApplicationAssocMapValueSpecification | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::ApplicationDataType | |||
| Note | 这个元类表示定义ApplicationAssocMapDataType初始化的能力。 Tags:atp.Status=draft | |||
| Base | ARObject, CompositeValueSpecification, ValueSpecification | |||
| Attribute | Type | Mult. | Kind | Note |
| mapElementTuple (ordered) | ApplicationAssocMapElementValueSpecification | * | aggr | 此聚合表示ApplicationAssocMapValueSpecification元素的初始值。 Tags:atp.Status=draft |
| Class | ApplicationAssocMapElementValueSpecification | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::ApplicationDataType | |||
| Note | 这个元类表示定义ApplicationAssocMapDataType的元素初始化的能力。 Tags:atp.Status=draft | |||
| Base | ARObject | |||
| Attribute | Type | Mult. | Kind | Note |
| key | ValueSpecification | 1 | aggr | 此聚合表示AssociationEventValueSpecification的键(key)部分的初始化。 Tags:atp.Status=draft |
| value | ValueSpecification | 1 | aggr | 此聚合表示AssociationEventValueSpecification的值(value)部分的初始化。 Tags:atp.Status=draft |
3.3.2.3 Attributes of SwDataDefProps
[constr_1478]{DRAFT}SwDataDefProps适用于AUTOSAR自适应平台专用的ApplicationDataTypes: 表3.10列出了给定类别允许的SwDataDefProps和其他属性及其多重性的完整列表。
[constr_1478]的一个结论是,表3.10仅显示了仅限于AUTOSAR自适应平台的类别值。有关AUTOSAR classic平台上也支持的所有其他类别值,请参阅软件组件模板规范中包含的类似表。
| Attributes of SwDataDefProps | Root Elem. | Attribute Existence per Category | |
| ApplicationAssocMapDataType | ApplicationAssocMapElement | ASSOCIATIVE_MAP | |
| additionalNativeTypeQualifier | |||
| annotation | x | x | * |
| baseType | |||
| compuMethod | |||
| dataConstr | |||
| displayFormat | x | x | 0..1 |
| implementationDataType | |||
| invalidValue | |||
| stepSize | |||
| swAddrMethod | |||
| swAlignment | |||
| swBitRepresentation | |||
| swCalibrationAccess | |||
| swCalprmAxisSet | |||
| swComparisonVariable | |||
| swDataDependency | |||
| swHostVariable | |||
| swImplPolicy | |||
| swIntendedResolution | |||
| swInterpolationMethod | |||
| swIsVirtual | |||
| swPointerTargetProps | |||
| swRecordLayout | |||
| swRefreshTiming | |||
| swTextProps | |||
| swValueBlockSize | |||
| unit | |||
| valueAxisDataType | |||
| Other Attributes below the Root Element | |||
| key: ApplicationAssocMapElement | x | 1 | |
| value: ApplicationAssocMapElement | x | 1 | |
3.3.3 CppImplementationDataType
3.3.3.1 Overview
在AUTOSAR标准中,数据类型代表了整个开发方法中最重要的资产。因此,AUTOSAR实现了一种多层次的数据类型建模方法。所谓的实现数据层(Implementation Data Level)是所描述的一个层次,其目标是在AUTOSAR自适应平台的客厅中(in the parlor of
the AUTOSAR adaptive platform不知道怎么翻译,肯定不能翻译为”客厅“)建立一个可以称为“语言绑定”的层次上的建模。
对于AUTOSAR经典平台,通过创建Implementation Data type来处理实现数据级别,该数据类型专门用于覆盖C编程语言的数据类型行为。
与AutoSar经典平台相比,AutoSar自适应平台目前不预见C语言的使用,相反(至少在可预见的将来)定义了与C++语言的语言绑定。
因此,有必要提供一种建模方法,在实现数据级的同时,对C++语言的能力进行适当的支持。虽然在技术上可行的是,将实现数据的语义扩展为C++语言绑定的支持,但这将大大降低实现数据的清晰度和表达能力。
因此,添加一个额外的元类系统似乎是合理的,特别是支持使用与C++语言绑定的数据类型。
[TPS_MANI_01166]{DRAFT}cpppimplementationdatatype的语义: 抽象元类cpppimplementationdatatype支持对支持C++语言绑定的数据类型进行专门建模。(RS_MANI_-00039)
[TPS_MANI_03197]{DRAFT}StdCppImplementationDataType 的语义: 元类STDCPPPACTION DATABATYPE支持将被映射到C++语言绑定中的C++标准库特征的数据类型的建模。(RS_MANI_00039)
请注意,为了简化起见,结构(category=STRUCTURE)和类型别名(category=type_REFERENCE)也被建模为StdCppImplementationDataTypes。
[TPS_MANI_03198]{DRAFT}CustomCppImplementationDataType的语义: 元类CustomCppImplementationDataType支持将映射到头文件中声明的C++语言绑定中自定义实现的数据类型的建模。
请注意,customcpppimplementationdatatype的category值受 [constr_1578] 限制。
这意味着只有StdCppImplementationDataTypes才能对原始数据类型和字符串进行建模。原因是AUTOSAR中为SOME/IP和DDS定义的序列化规则是基于标准库定义的数据类型。
| Class | CppImplementationDataType (abstract) | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::CppImplementationDataType | |||
| Note | 这个元类表示指定一个可重用的数据类型定义的方式,它是C++语言绑定的基础。 Tags:atp.Status=draft | |||
| Base | ARElement, ARObject, AbstractImplementationDataType, AtpBlueprint, AtpBlueprintable, AtpClassifier, AtpType, AutosarDataType, CollectableElement, CppImplementationDataTypeContextTarget, Identifiable, MultilanguageReferrable, PackageableElement, Referrable | |||
| SubClasses | CustomCppImplementationDataType,StdCppImplementationDataType | |||
| Attribute | Type | Mult. | Kind | Note |
| arraySize | PositiveInteger | 0..1 | attr | 如果封闭的CppImplementationDataType具有数组语义,则此属性可用于指定数组大小。 Stereotypes: atpVariation Tags: vh.latestBindingTime=preCompileTime |
| namespace(ordered) | SymbolProps | * | aggr | 此聚合允许定义为封闭的cpppimplementationdata类型提供自己的命名空间。 Tags:atp.Status=draft |
| subElement(ordered) | CppImplementationDataTypeElement | * | aggr | 这表示封闭cpppimplementationdatatype的子元素的集合 Tags:atp.Status=draft |
| templateArgument(ordered) | CppTemplateArgument | * | aggr | 此聚合允许指定模板参数的属性 Tags:atp.Status=draft |
| typeEmitter | NameToken | 0..1 | attr | 此属性可用于控制如何将相应的CppImplementationDataType贡献给语言绑定。 |
| typeReference | CppImplementationDataType | 0..1 | ref | 此引用应定义为定义类型引用(也称为typedef)。 Tags:atp.Status=draft |
| Class | StdCppImplementationDataType | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::CppImplementationDataType | |||
| Note | 该元类表示指定数据类型定义的方式,该数据类型定义是C++语言与C++标准库特征绑定的基础。 Tags: atp.Status=draft atp.recommendedPackage=CppImplementationDataTypes | |||
| Base | ARElement, ARObject, AbstractImplementationDataType, AtpBlueprint, AtpBlueprintable, AtpClassifier, AtpType, AutosarDataType, CollectableElement, CppImplementationDataType, CppImplementationData TypeContextTarget, Identifiable, MultilanguageReferrable, PackageableElement, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| - | - | - | - | - |
| Class | CustomCppImplementationDataType | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::CppImplementationDataType | |||
| Note | 该元类表示指定数据类型定义的方式,该数据类型定义是C++语言与在配置的头文件中声明的自定义实现绑定的基础。此customcpppimplementationdatatype的短名称定义自定义实现的类名(Class-Name) Tags: atp.Status=draft atp.recommendedPackage=CppImplementationDataTypes | |||
| Base | ARElement, ARObject, AbstractImplementationDataType, AtpBlueprint, AtpBlueprintable, AtpClassifier, AtpType, AutosarDataType, CollectableElement, CppImplementationDataType, CppImplementationData TypeContextTarget, Identifiable, MultilanguageReferrable, PackageableElement, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| headerFile | String | 1 | attr | 使用自定义类声明配置头文件。 |
[constr_1571]{DRAFT}CppImplementationDataType是受限制的: cpppimplementationdatatype的使用仅限于在可执行文件上下文中定义的AdaptiveApplicationSwComponentTypes和compositionswcomponenttypes的上下文。
[TPS_MANI_01167]{DRAFT}AbstractImplementationDataType : 元类CppImplementationDataType继承自抽象基类AbstractImplementationDataType,以便成为来自其他想要引用**“通用 ImplementationDataType”**的其他元类的特定引用的有效目标。(RS_MANI_00039)
| Class | AbstractImplementationDataType(abstract) | |||
| Package | M2::AUTOSARTemplates::CommonStructure::ImplementationDataTypes | |||
| Note | 这个元类表示不同类型ImplementationDataType的抽象基类 | |||
| Base | ARElement, ARObject, AtpBlueprint, AtpBlueprintable, AtpClassifier, AtpType, AutosarDataType, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| - | - | - | - | - |
在元类DataTypeMap中可以找到一个突出的例子来说明引用 “通用ImplementationDataType ” 的想法。DataTypeMap存在的目的是将ApplicationDataType映射到ImplementationDataType或cppplementationdatatype。
通过建立参考模型DataTypeMap.implementationDataType作为对AbstractImplementationDataType的引用,两个选项都可以在单个角色中使用。
与C语言相反,C++支持程序中命名空间的定义。这个特性也可以在AUTOSAR自适应平台上开发,因此需要在建模方法中表示出来。
[TPS_MANI_01168]{DRAFT}CppImplementationDataType的命名空间规范: 为CppImplementationDataType定义命名空间的能力是通过在角色命名空间中的CppImplementationDataType处聚合SymbolProps 来表示的。(RS_MANI_00039)
[constr_3443]{DRAFT}StdCppImplementationDataType的命名空间规范: 不允许为类别VALUE的StdCppImplementationDataType定义名称空间。 对于类别的此值,已使用StdCppImplementationDataType来假定std名称空间。
[TPS_MANI_01176]{DRAFT}属性CppImplementationDataType.typeEmitter 的标准值: AUTOSAR标准为属性CppImplementationDataType.typeEmitter保留以下值 :
- TYPE_EMITTER_ARA
最重要的是,AUTOSAR为数据类型定义保留了典型头文件的标准名称,作为CppImplementationDataType.typeEmitter的其他可能值(例如,在Adaptive Platform的平台类型规范中定义的CppImplementationDataTypes的Platform_Types.h)(RS_MANI_00039)
[TPS_MANI_01177]{DRAFT}属性CppImplementationDataType.typeEmitter 的语义: 以下规则适用于属性CppImplementationDataType.typeEmitter的使用:
- 如果属性typeEmitter设置为值TYPE_EMITTER_ARA ,则ARA生成器应生成相应的数据类型定义。
- 如果属性typeEmitter被设置为除TYPE_EMITTER_ARA之外的任何值,则ARA生成器将不自动生成相应的数据类型定义。
- 对于与基本数据类型float(参见 [SWS_APT_00043] )、double(参见 [SWS_APT_00046] )和bool(参见 [SWS_APT_00049] )相对应的CppImplementationDataTypes ,不应定义属性typeEmitter。
(RS_MANI_00039)
[TPS_MANI_01212]{DRAFT}在customcpppimplementationdatatype上下文中使用属性typeEmitter: 属性typeEmitter不必在customcpppimplementationdatatype的上下文中使用。如果使用typeEmitter,则属性的值应设置为包含相应customcpppimplementationdatatype的语言绑定的头文件的名称。(RS_MANI_00039)
[TPS_MANI_01169]{DRAFT}支持模板数据类型: 元类CppImplementationDataType 支持使用引用CppImplementationDataType.TimePlaGuess对C++程序中数据类型定义的模板的使用。模板中参数的顺序很重要,因此templateArgument被建模为有序集合。(RS_MANI_00039)
[TPS_MANI_01174]{DRAFT}角色CppTemplateArgument.templateType中的引用语义: 属性CppTemplateArgument.templateType指定要在语言绑定中模板的相应位置填充的数据类型。(RS_MANI_00039)
[TPS_MANI_01175]{DRAFT}CppTemplateArgument.allocator角色中的引用语义: 属性cpptTemplateArgument.allocator指定要在语言绑定中模板的相应位置填充的分配器类(allocator)的行为。(RS_MANI_00039)
[constr_1576]{DRAFT}CppTemplateArgument.templateType 和CppTemplateArgument.allocator的存在对比: 对于任何给定的CppTemplateArgument,最多只能存在一个引用
- CppTemplateArgument.templateType 或
- CppTemplateArgument.allocator
[TPS_MANI_01201]{DRAFT}属性CppTemplateArgument.category的标准化值: AUTOSAR为属性CppTemplateArgument.category保留以下值:
- ASSOC_MAP_KEY : 特定的CppTemplateArgument表示关联映射的键数据类型。
- ASSOC_MAP_VALUE :特定的CppTemplateArgument表示关联映射的值数据类型。
(RS_MANI_00039)
| Class | CppTemplateArgument | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::CppImplementationDataType | |||
| Note | 此元类具有为模板参数定义属性的能力 Tags: atp.Status=draft | |||
| Base | ARObject | |||
| Attribute | Type | Mult. | Kind | Note |
| allocator | Allocator | 0..1 | ref | 此引用标识适用的分配器。 Tags: atp.Status=draft |
| category | CategoryString | 0..1 | attr | 该属性将用于进一步阐明有关CppTemplateArgument的语义。 |
| inplace | Boolean | 0..1 | attr | 此属性指定是在代码生成中使用引用的templateType的shortName,还是在封闭的CppImplementationDataType之外定义类型声明(true),还是将类型定义嵌入在封闭的CppImplementationDataType内,并且忽略shortName(false) 。 |
| templateType | CppImplementationDataType | 0..1 | ref | 此引用标识语言绑定所需的特定模板参数的数据类型。 Tags: atp.Status=draft |
[TPS_MANI_01171]{DRAFT}结构化数据类型的建模: 元类CppImplementationDataType支持通过角色subElement中的CppImplementationDataTypeElement的聚合来创建嵌套数据类型。由于结构化数据类型中子元素的顺序很重要,因此将聚合子元素建模为有序集合。(RS_MANI_00039)
请注意,虽然结构的建模是使用cpppimplementationdatatype正式完成的,但实际上只有使用StdCppImplementationDataType才能实现此目的(请参见**[constr_1578]**)
| Class | CppImplementationDataTypeElement | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::CppImplementationDataType | |||
| Note | 声明一个在本地聚合的数据对象。 这样的元素只能在聚合的范围内使用。 CppImplementationDataTypeElement用于表示结构的元素,定义其类型。 Tags: atp.Status=draft | |||
| Base | ARObject, AbstractImplementationDataTypeElement, AtpClassifier, AtpFeature, AtpStructureElement,CppImplementationDataTypeContextTarget, Identifiable, MultilanguageReferrable, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| isOptional | Boolean | 0..1 | attr | 此属性表示将封闭的CppImplementationDataTypeElement声明为可选的能力。这意味着,在运行时, CppImplementationDataTypeElement可能有也可能没有有效值,因此应被忽略。 底层运行时软件提供了在通信的发送端将CppImplementationDataTypeElement设置为无效并在接收端确定其有效性的方法。 |
| typeReference | CppImplementationDataTypeElementQualifier | 0..1 | aggr | 此聚合定义CppImplementationDataTypeElement的类型,并确定在C ++中是否 CppImplementationDataTypeElement在封闭的CppImplementationDataType的内部或外部定义 Tags: atp.Status=draft |
请注意,没有支持支持结构化数据类型的“混合”建模的方法,这样C++级的结果数据类型将由C++中的数据类型和C子系统的数据类型组成。
虽然这在技术上在代码级是可能的,但在建模级却需要付出巨大的努力,而且普遍的共识是,对于这种“混合”数据类型没有真正的用例。
C++数据类型系统可以在AutoSar自适应平台的实现上完全取代C++中的“遗留”C数据类型。
[constr_1572]{DRAFT}CppImplementationDataType中SwDataDefProps.implementationDataType的用法: 在cpppimplementationdatatype的范围内,引用CppImplementationDataType.swDataDefProps.implementationDataType 不应存在。
这一方面也由 [Const_1579] 以更通用的形式表达。
由于 [constr_1572] ,类型引用必须在AUTOSAR自适应平台上以不同的方式进行。为此,可提供专门的参考资料。
[TPS_MANI_01172]{DRAFT}CppImplementationDataType范围内类型引用的说明: 引用CppImplementationDataType.typeReference可以用于创建从封闭的CppImplementationDataType到另一个CppImplementationDataType的类型引用。(RS_MANI_00039)
[TPS_MANI_01173]{DRAFT}CppImplementationDataTypeElement范围内类型引用的说明: CppImplementationDataTypeElement.typeReference可用于创建对CppImplementationDataType的引用,该引用应适用于封闭的CppImplementationDataTypeElement。(RS_MANI_00039)
请注意,CppImplementationDataTypeElement.typeReference是实现为允许将inplace属性添加到typeReference的关联类。
| Class | CppImplementationDataTypeElementQualifier | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::CppImplementationDataType | |||
| Note | 此元素将CppImplementationDataTypeElement的类型引用限定为CppImplementationDataType。 Tags: atp.Status=draft | |||
| Base | ARObject | |||
| Attribute | Type | Mult. | Kind | Note |
| inplace | Boolean | 0..1 | attr | 此属性定义C ++中CppImplementationDataTypeElement的成员类型是封闭结构内部的嵌入式类型元素(true)还是类型声明是在结构外部定义的 |
| typeReference | CppImplementationDataType | 1 | ref | 此引用定义类型引用。 Tags: atp.Status=draft |
[TPS_MANI_03196]{DRAFT}属性CppImplementationDataTypeElementQualifier.inplace 的语义: CppImplementationDataTypeElementQualifier.inplace属性定义C ++语言绑定中CppImplementationDataTypeElement的数据类型是否从引用的CppImplementationDataType的名称或属性派生。
具体而言,应遵循以下规则:
- 如果CppImplementationDataTypeElement.typeReference.inplace设置为False,则在C ++语言绑定中应使用在角色CppImplementationDataTypeElement.typeReference.typeReference中引用的CppImplementationDataType的shortName。
- 如果CppImplementationDataTypeElement.typeReference.inplace设置为True,则在C ++语言绑定中仅使用在角色CppImplementationDataTypeElement.typeReference.typeReference中引用的CppImplementationDataType的属性,而忽略shortName。
(RS_MANI_00039)
请注意,图3.13显示了一个结构示例,其中一个子元素的typeReference被分类为inplace。
[constr_1659]{DRAFT}使用CppImplementationDataTypeElementQualifier.inplace的限制: 仅当角色CppImplementationDataTypeElementQualifier.typeReference中引用的目标是StdCppImplementationDataType且属性类别设置为以下值中的任意一个时,属性CppImplementationDataTypeElementQualifier.inplace才存在。
- ARRAY
- VECTOR
- ASSOCIATIVE_MAP
- VARIANT
- STRUCTURE
- STRING
[constr_1659]存在的理由:通过应用排除原理,在三种情况下属性CppImplementationDataTypeElementQualifier.inplace不存在:
- 类别VALUE的StdCppImplementationDataType
- CustomCppImplementationDataType
- 类别TYPE_REFERENCE的CppImplementationDataType
它们都不能用作CppImplementationDataTypeElementQualifier.typeReference的目标,其中CppImplementationDataTypeElementQualifier.inplace被设置为True,因为在这些情况下,已经有一个有效的名称可直接用于语言绑定,并且通过using子句可能的间接寻址显然需要一个额外的名称,而该名称在模型中不可用。
毕竟,定义TYPE_REFERENCE的动机与使用属性CppImplementationDataTypeElementQualifier.inplace控制语言绑定的动机正好相反。 因此,这种情况也被排除在外。
[TPS_MANI_03201]{DRAFT}属性CppTemplateArgument.inplace 的语义: CppTemplateArgument.inplace属性定义C ++语言绑定中templateType引用的数据类型是否从引用的CppImplementationDataType的名称或属性派生。
具体来说,应遵循以下规则:
- 如果CppTemplateArgument.inplace设置为False,则在C ++语言绑定中应使用在角色CppTemplateArgument.templateType中引用的CppImplementationDataType的shortName。
- 如果CppTemplateArgument.inplace设置为True,则在C ++语言绑定中只能使用在角色CppTemplateArgument.templateType中引用的CppImplementationDataType的属性,而忽略shortName。
(RS_MANI_00039)
[constr_1660]{DRAFT}CppTemplateArgument.inplace的使用限制: 仅当角色CppTemplateArgument.templateType中引用的目标是StdCppImplementationDataType且属性类别设置为以下值中的任意一个时,属性CppTemplateArgument.inplace才存在。
- ARRAY
- VECTOR
- ASSOCIATIVE_MAP
- VARIANT
- STRUCTURE
- STRING
[constr_1660]存在的理由:通过应用排除原理,在三种情况下属性CppTemplateArgument.inplace将不存在:
- 类别VALUE的StdCppImplementationDataType
- CustomCppImplementationDataType
- 类别TYPE_REFERENCE的CppImplementationDataType
它们都不能用作CppTemplateArgument.templateType的目标,其中CppTemplateArgument.inplace设置为True,因为在这些情况下,已经有一个有效的名称可直接用于语言绑定,并且通过using子句可能的间接寻址显然需要模型中不可用的附加名称。
毕竟,定义TYPE_REFERENCE的动机与使用属性CppTemplateArgument.inplace控制语言绑定的动机直接相反。 因此,这种情况也被排除在外。
请注意,对于引用类别STRUCTURE的StdCppImplementationDataType的CppTemplateArgument.templateType而言,属性CppTemplateArgument.inplace的值问题由**[constr_3462]**规范。
[constr_1708]{DRAFT}CppImplementationDataTypeElement.isopolatial和CppImplementationDataTypeElementQualifier.inplace的组合: 如果使用类别STRUCTURE的CppImplementationDataType键入CppImplementationDataTypeElement,则属性的组合
将CppImplementationDataTypeElement.isOptional设置为True,不允许将CppImplementationDataTypeElement.typeReference.inplace设置为True。
[constr_1708]存在的理由:“可选”语义是通过模板实现的,不可能将“ inplace”结构作为模板参数传递。
[constr_3462]{DRAFT}对类别STRUCTURE和inplace标志的StdCppImplementationDataType的CppTemplateArgument.templateType引用: 指向类别STRUCTURE的StdCppImplementationDataType的CppTemplateArgument.templateType必须将inplace属性设置为false。
[constr_3462]的原因是ISO C ++ 11/14/17不允许将未命名结构用作模板参数。
[constr_3446]{DRAFT}带有分配器引用和inplace标志的CppTemplateArgument: 一个带有分配引用的CppTemplateArgument 不应给inplace标志设置一个值。
| Class | Allocator | |||
| Package | M2::AUTOSARTemplates::AdaptivePlatform::ApplicationDesign::CppImplementationDataType | |||
| Note | 这个元类表示能够影响对象在内存中的分配方式,例如,可以控制对象是在堆上还是在堆栈上分配。 Tags: atp.Status=draft atp.recommendedPackage=Allocators | |||
| Base | ARElement, ARObject, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable | |||
| Attribute | Type | Mult. | Kind | Note |
| namespace(ordered) | SymbolProps | * | aggr | 此聚合允许定义分配器的命名空间。 Tags: atp.Status=draft |
[TPS_MANI_01100]{DRAFT}Allocator 的语义: 元类Allocator具有定义内存分配属性的能力。内存分配的一般方法是通过属性类别来表示的。
AUTOSAR对以下Allocator.category值进行了标准化:
- MAX_SIZE_HEAP :使用此分配器时,有意在堆上分配固定大小的块。 该分配器为ara :: core :: Vector的默认分配器的语义增加了定义最大元素数的能力。
- MAX_SIZE_STACK :使用这个分配器时,打算在堆栈上分配一个固定大小的块。堆栈上的内存总是需要根据最大大小进行限制。换句话说,几乎没有任何情况下应该在堆栈上分配无限量的内存。
- MAX_SIZE_DATASEGMENT: 当使用这个分配器时,打算在数据段中分配一个固定大小的块。
(RS_MANI_00016)
[constr_1578]{DRAFT}适用的数据类别: 表3.19定义了适用的类别与元类。
- AADT: ApplicationArrayDataType
- ARDT: ApplicationRecordDataType
- APDT: ApplicationPrimitiveDataType
- ARE: ApplicationRecordElement
- AAE: ApplicationArrayElement
- AVS: ApplicationValueSpecification
- SCDT: StdCppImplementationDataType
- CCDT: CustomCppImplementationDataType
| Category | Applicable to ... | Description | |||||||
| AADT | ARDT | APDT | ARE | AAE | AVS | SCDT | CCDT | ||
| VALUE | x | x | x | x | x | 包含单个值。另见[TPS_MANI_03192]。 | |||
| TYPE_REFERENCE | x | 该元素是通过引用另一种数据类型(通过CppImplementationDataType.typeReference来定义的)。 | |||||||
| STRUCTURE | x | x | x | x | 包含一个或几个其他元素,这些元素可以具有不同的AutosarDataType。 另请参阅[TPS_MANI_03180] | ||||
| VARIANT | x | x | 可以容纳不同数据类型的值。 它与STRUCTURE类似,不同之处在于其所有成员均始于内存中的同一位置 VARIANT数据原型一次只能包含其元素之一,并且代表类型安全的联合。 VARIANT的大小至少是最大成员的大小。 另请参阅[TPS_MANI_03189]。 | ||||||
| ARRAY | x | x | x | x | x | 固定大小的相同类型子元素数组。 另请参阅[TPS_MANI_03169]。 | |||
| VECTOR | x | x | 一系列元素的数组,同时可以在运行时增加长度的数据结构,另请参阅[TPS_MANI_03174]。 | ||||||
| ASSOCIATIVE_MAP | x | x | 键值对的关联数组。 另请参阅[TPS_MANI_03183] | ||||||
| STRING | x | x | x | x | x | 包含一个文本字符串。 另请参阅[TPS_MANI_03178] | |||
| BOOLEAN | x | x | x | x | 包含一个布尔状态。 根据CPU的不同,单个位的直接寻址可能不可用。 所以一个字节或一个字只能用来存储一个逻辑状态。 | ||||
3.3.3.2 Attributes of SwDataDefProps
[constr_1579]{DRAFT}适用于AUTOSAR自适应平台专有的CppImplementationDataTypes的SwDataDefProps: 表3.20列出了给定类别允许的SwDataDefProps和其他属性及其多重性的完整列表。
[Const_1578]的一个结论是,表3.20仅显示了仅限于AUTOSAR自适应平台的类别值。有关AUTOSAR classic平台上也支持的所有其他类别值,请参阅软件组件模板规范[1]中包含的类似表。
- CIDT: CppImplementationDataType
- VAL: VALUE
- TR: TYPE_REFERENCE
- ST: STRUCTUR
- VAR: VARIANT
- AR: ARRAY
- VEC: VECTOR
- AMAP: ASSOCIATIVE_MAP
- STR: STRING
- d/c: don’t care
| Attributes of SwDataDefProps | RootElement | Attribute Existence per Category | |||||||
|---|---|---|---|---|---|---|---|---|---|
| CIDT | VAL | TR | ST | VAR | AR | VEC | AMAP | STR | |
| additionalNativeTypeQualifier | |||||||||
| annotation | x | * | * | * | * | * | * | * | * |
| baseType | |||||||||
| compuMethod | x | 0..1 | 0..1 | ||||||
| dataConstr.dataConstrRule.physConstrs | x | d/c | d/c | d/c | d/c | ||||
| dataConstr.dataConstrRule.internalConstrs | x | 0..1 | 0..1 | 0..1 | 0..1 | ||||
| displayFormat | x | 0..1 | 0..1 | 0..1 | 0..1 | 0..1 | 0..1 | 0..1 | |
| implementationDataType | |||||||||
| invalidValue | x | 0..1 | 0..1 | 0..1 | |||||
| stepSize | |||||||||
| swAddrMethod | |||||||||
| swAlignment | |||||||||
| swBitRepresentation | |||||||||
| swCalibrationAccess | |||||||||
| swCalprmAxisSet | |||||||||
| swComparisonVariable | |||||||||
| swDataDependency | |||||||||
| swHostVariable | |||||||||
| swImplPolicy | |||||||||
| swIntendedResolution | |||||||||
| swInterpolationMethod | |||||||||
| swIsVirtual | |||||||||
| swPointerTargetProps | |||||||||
| swPointerTargetProps.swDataDefProps | |||||||||
| swPointerTargetProps.functionPointerSignature | |||||||||
| swRecordLayout | |||||||||
| swRefreshTiming | x | 0..1 | 0..1< | 0..1< | 0..1< | 0..1< | 0..1< | 0..1< | 0..1< |
| swTextProps | |||||||||
| swValueBlockSize | |||||||||
| unit | |||||||||
| valueAxisDataType | |||||||||
| Other Attributes | |||||||||
| subElement:CppImplementationDataTypeElement | x | 1..* | |||||||
| templateArgument | x | 1..* | 1 | 1..* | 2..* | 0..1 | |||
| typeReference | x | 1 | |||||||
3.3.3.3 Primitive Data Types
[TPS_MANI_03192]{DRAFT}类别VALUE的CppImplementationDataType: 基本数据类型,如布尔型、固定宽度整数数据类型和浮点数据类型被描述为类别VALUE的cpppimplementationdatatypes。(RS_MANI_00039)
[TPS_MANI_03193]{DRAFT}类别TYPE_REFERENCE的CppImplementationDataType: 类别TYPE_REFERENCE的CppImplementationDataType的定义为typeReference引用的另一个CppImplementationDataType创建别名。(RS_MANI_00039)
3.3.3.4 String Data Type
[TPS_MANI_03178]{DRAFT}类别STRING的StdCppImplementationDataType: 类别STRING的StdCppImplementationDataType表示字符序列的容器数据类型。
AUTOSAR要求类别STRING的StdCppImplementationDataType的C ++绑定由ara :: core :: String实现。(RS_MANI_00039)
[constr_1674]{DRAFT}支持类别STRING的StdCppImplementationDataType的编码: 在元模型的级别(以及扩展为语言绑定)上,类别STRING唯一支持的StdCppImplementationDataType编码为UTF-8。
请注意,尽管如此,仍然可以使用不同的编码,例如在SOME/IP消息级别上使用UTF-16。此行为可以通过apsomeipttransformationprops配置。因此,可能必须在线上的字符串表示与软件中的字符串表示之间进行转码。
[TPS_MANI_03179]{DRAFT}类别STRING的StdCppImplementationDataTypes的C ++语言绑定: 类别STRING的CppImplementationDataType应实现为ara::core::String。(RS_MANI_00039)
[TPS_MANI_03179]的表述为以后支持其他存储格式的扩展留出了空间。
图3.8中描述的示例包含ApplicationDataType的定义以及相应的CppImplementationDataType的定义。
显然,由于就C ++语言绑定而言,类别STRING的CppImplementationDataType必须仅基于ara::core::String来实现,因此后者的建模显然要轻得多。
图3.8中示例的另一方面是,它在ApplicationPrimitiveDataType的范围内定义了建模数据类型的预期编码。
[TPS_MANI_03188]{DRAFT}类别STRING的StdCppImplementationDataType的分配器的用法: 允许将类别为STRING的StdCppImplementationDataType聚合一个CppTemplateArgument,该CppTemplateArgument引用具有分配器引用的分配器。(RS_MANI_00039)
3.3.3.5 Array Data Type
[TPS_MANI_03169]{DRAFT}具有固定大小的数组语义的CppImplementationDataType: 类别ARRAY的CppImplementationDataType表示封装固定大小数组的容器数据类型。
[TPS_MANI_03170]{DRAFT}类别ARRAY的CppImplementationDataType: 对于C ++绑定,类别ARRAY的CppImplementationDataType可以实现为:
- 如果使用StdCppImplementationDataType子类,则为:ara::core::Array
- 如果使用CustomCppImplementationDataType子类,则使用自定义命名空间中的数组类型(例如my :: array)(前提是可以使用可用的建模功能配置自定义命名空间中的类型)
(RS_MANI_00039)
[TPS_MANI_03171]{DRAFT}类别ARRAY的CppImplementationDataType的值类型: 类别ARRAY的CppImplementationDataType中包含的元素类型由聚合的templateArgument和定义了CppTemplateArgument数据类型的相应templateType定义。(RS_MANI_00039)
[constr_3433]{DRAFT}汇总ARRAY的templateArguments: 归纳为ara::core::Array的ARRAY类别的CppImplementationDataType应该精确地聚合一个templateArgument,该模板定义定义ARRAY类别的CppImplementationDataType中包含的元素的类型。
[TPS_MANI_03172]{DRAFT}类别ARRAY的CppImplementationDataType的大小: 类别ARRAY的CppImplementationDataType的原始属性arraySize将用于定义数组的大小。(RS_MANI_00039)
图3.9显示了一个元素类型为uint16的一维数组的示例,其中arraySize = 5。
[TPS_MANI_03173]{DRAFT}多维数组的定义: 类别ARRAY的多维CppImplementationDataType包含类别ARRAY的嵌套CppImplementationDataTypes。代表外部数组的类别ARRAY的CppImplementationDataType将通过聚合templateArgument引用代表内部数组的类别ARRAY的CppImplementationDataType。 这样的定义描述了二维数组。 因此,仅嵌套类别ARRAY的更多CppImplementationDataTypes即可描述具有更大尺寸的类型。
数组元素本身由最里面的CppImplementationDataType指定,其类别不同于ARRAY。(RS_MANI_00039)
图3.10显示了一个多维数组的示例,其中arraySize= 5的类别ARRAY的CppImplementationDataType具有一个templateArgument,它指向角色templateType中类别为ARRAY的内部CppImplementationDataType。
内部的CppImplementationDataType具有templateArgument,该参数最终将templateType引用指向原始类型。
由于外部数组的CppTemplateArgument.inplace标志设置为true,所以这样的模型将映射为以下C ++代码:
using ArrayRectangularImpl = ara::core::Array<ara::core::Array<uint16_t,10>, 5>;
3.3.3.6 Vector Data Type
[TPS_MANI_03174]{DRAFT}具有可变大小数组语义的cpppimplementationdatatype: 类别VECTOR的CppImplementationDataType表示封装可变大小数组的容器数据类型。(RS_MANI_00039)
[TPS_MANI_03175]{DRAFT}类别VECTOR的CppImplementationDataType: 对于C++绑定,类别VECTOR的CppImplementationDataType 可以实现为:
- 如果使用StdCppImplementationDataType子类,则为ara::core::Vector。
- 如果使用CustomCppImplementationDataType子类,则为自定义命名空间中的vector类型(例如my::vector)(前提是可以使用可用的建模功能来配置自定义命名空间中的类型)
(RS_MANI_00039)
[TPS_MANI_03176]{DRAFT}类别VECTOR的CppImplementationDataType的值类型: 类别VECTOR的CppImplementationDataType中包含的元素类型由聚合的templateArgument和定义CppTemplateArgument的数据类型的相应templateType定义。(RS_MANI_00039)
[constr_3434]{DRAFT}VECTOR的templateArguments 聚合: 归结为ara::core::Vector的类别VECTOR的CppImplementationDataType 应该聚合:
- 一个templateArgument,它使用templateType引用定义类别VECTOR的CppImplementationDataType中包含的元素类型。
- 可选地,一个附加的templateArgument定义一个引用Alloctor的分配器。
[TPS_MANI_03186]{DRAFT}Vector使用arraySize的用法: 如果类别VECTOR的CppImplementationDataType聚合了定义带有Allocator引用的分配器的templateArgument,则允许使用定义向量的最大大小的属性arraySize。(RS_MANI_00039)
图3.11显示了元素类型为uint16的一维Vector的示例。
[TPS_MANI_03177]{DRAFT}多维Vector的定义: 类别VECTOR的多维CppImplementationDataType包含类别VECTOR的嵌套CppImplementationDataTypes。代表外部Vector的类别VECTOR的CppImplementationDataType将通过聚合templateArgument引用代表内部Vector的类别VECTOR的CppImplementationDataType。这样的定义描述了二维Vector。 因此,通过嵌套更多类别为VECTOR的CppImplementationDataTypes来描述具有更大维数的类型。Vector元素本身由最里面的CppImplementationDataType指定,其类别不同于VECTOR。(RS_MANI_00039)
图3.12显示了一个多维Vector的示例,其中类别VECTOR的CppImplementationDataType具有一个templateArgument,它指向角色templateType中类别VECTOR的内部CppImplementationDataType。 内部的CppImplementationDataType具有templateArgument,该参数最终指向对原始类型的templateType引用。
由于没有为内部Vector设置CppTemplateArgument.inplace标志,因此这种模型将映射为以下C ++代码:
using templateArgumentDim1 = ara::core::Vector<uint16_t>;
using DynamicDataArrayImplRectangular = ara::core::Vector<templateArgumentDim1>;
请注意,元模型支持创建对类别VECTOR的CppImplementationDataType的特定元素(通过索引标识)的引用。
但是,如果特定元素在相应的时间点不存在,则这可能会导致运行时出现问题。使用这种数据类型的任何软件都需要为Vector元素的潜在不存在做好准备。或者,可以选择避免类别VECTOR的CppImplementationDataType的元素成为模型中引用目标的情况。
3.3.3.7 Struct Data Type
[TPS_MANI_03180]{DRAFT}Structures 的定义: 类别STRUCTURE的StdCppImplementationDataType表示一种数据类型,用于保存任意数据类型的变量的有序集合。(RS_MANI_00039)
[TPS_MANI_03181]{DRAFT}类别STRUCTURE的StdCppImplementationDataType中的成员定义: 类别STRUCTURE的StdCppImplementationDataType中的成员由有序CppImplementationDataTypeElement定义,这些CppImplementationDataTypeElement 以封闭的类别STRUCTURE的StdCppImplementationDataType的形式聚合在角色subElement中。每个成员的名称由CppImplementationDataTypeElement的shortName定义。每个成员的类型由对CppImplementationDataType的typeReference定义。(RS_MANI_00039)
请注意,[TPS_MANI_03196]中记录了能够对CppImplementationDataTypeElement.typeReference进行分类的inplace标志。
图3.13中描述的示例显示了一个结构的定义,该结构称为MyStruct,它具有两个成员。 带有shortName为ArrayElement的subElements的typeReference使用inplace = True进行分类,并且在该模型之外生成以下struct声明:
struct MyStruct
{
ara::core::uint8_t PrimitiveElement;
ara::core::Array<uint8_t,5> ArrayElement;
};
如果将数组的typeReference中的inplace属性设置为False,则该模型将需要在MyStruct之外使用“using”声明ArrayDataType。
using ArrayDataType = ara::core::Array<uint8_t,5>;
struct MyStruct
{
std::uint8_t PrimitiveElement;
ArrayDataType ArrayElement;
};

3.3.3.8 Enumeration Data Type
[TPS_MANI_03187]{DRAFT}enumeration 类型的定义: 在AUTOSAR元模型中,枚举不是通过具有自有类别的cpppimplementationdatatype实现的。以作为类别TYPE_REFERENCE 的单个基本CppImplementationDataType的结构描述,它可以归结为类别VALUE的CppImplementationDataType 。通过附有类别TEXTTABLE的CompuMethod,将整数映射到枚举定义范围内的标签视为语义定义的一部分,而不是结构描述的一部分。(RS_MANI_00039)
在类别TEXTTABLE中使用CompuMethod的规则与AUTOSAR Classic Platform中的规则相同,并在软件组件模板中进行了描述。
总而言之,可以在CompuConst的vt中、CompuMethod的适用CompuScale的shortLabel或符号中以文本值的形式提供类别为TEXTTABLE的CompuMethod中的枚举值。
每个CompuScale都应在CompuMethod中定义为compuInternalToPhys计算,并且应包含upperLimit和lowerLimit。
下面的示例演示如何使用computeMethod指定枚举。
<COMPU-METHOD>
<SHORT-NAME>cylinders</SHORT-NAME>
<CATEGORY>TEXTTABLE</CATEGORY>
<COMPU-INTERNAL-TO-PHYS>
<COMPU-SCALES>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">0</UPPER-LIMIT>
<COMPU-CONST>
<VT>Cylinder1</VT>
</COMPU-CONST>
</COMPU-SCALE>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">1</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">1</UPPER-LIMIT>
<COMPU-CONST>
<VT>Cylinder2</VT>
</COMPU-CONST>
</COMPU-SCALE>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">2</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">2</UPPER-LIMIT>
<COMPU-CONST>
<VT>Cylinder3</VT>
</COMPU-CONST>
</COMPU-SCALE>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">3</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">3</UPPER-LIMIT>
<COMPU-CONST>
<VT>Cylinder4</VT>
</COMPU-CONST>
</COMPU-SCALE>
</COMPU-SCALES>
</COMPU-INTERNAL-TO-PHYS>
</COMPU-METHOD>
3.3.3.9 Map Data Type
[TPS_MANI_03183]{DRAFT}类别ASSOCIATIVE_MAP 的CppImplementationDataType: 类别ASSOCIATIVE_MAP的cpppimplementationdatatype表示包含具有唯一键的键值对的容器。(RS_MANI_00039)
[TPS_MANI_03184]{DRAFT}类别ASSOCIATIVE_MAP 的CppImplementationDataType: 对于C ++绑定,类别ASSOCIATIVE_MAP的CppImplementationDataType可以实现为:
- 如果使用StdCppImplementationDataType子类,则为:ara::core::Map
- 如果使用CustomCppImplementationDataType子类,则使用自定义命名空间中的map类型(例如my :: map)(前提是可以使用可用的建模功能配置自定义命名空间中的类型)
(RS_MANI_00039)
[TPS_MANI_03185]{DRAFT}类别ASSOCIATIVE_MAP的CppImplementationDataType的结构: 归类为ara::core::Map的ASSOCIATIVE_MAP类别的CppImplementationDataType应聚合以下CppTemplateArguments:
- 第一个CppTemplateArgument应引用具有templateType引用的CppImplementationDataType。此cpptTemplateArgument表示与ApplicationAssocMapDataType.key对应的角色,并定义相应的数据类型详细信息。
- 第二个CppTemplateArgument应引用具有templateType引用的CppImplementationDataType。此cpptTemplateArgument表示与ApplicationAssocMapDataType.value对应的角色,并定义相应的数据类型详细信息。
- 可选的第三个CppTemplateArgument应引用具有Allocator引用的分配器。
(RS_MANI_00039)
图3.14中所示的示例显示了一个ASSOCIATIVE_MAP的定义,该定义具有两个CppTemplateArguments,一个用于键,一个用于值。
请注意,CppImplementationDataType的CppTemplateArguments在ARXML中排序的,并且该顺序在对象图中不可见。
3.3.3.10 Variant Data Type
[TPS_MANI_03189]{DRAFT}类别VARIANT的CppImplementationDataType定义: 类别VARIANT的CppImplementationDataType表示一个类型安全的联合。(RS_MANI_00039)
[TPS_MANI_03190]{DRAFT}类别VARIANT的CppImplementationDataType: 对于C ++绑定,类别VARIANT的CppImplementationDataType可以实现为:
- 如果使用StdCppImplementationDataType子类,则为:ara::core::Variant
- 如果使用CustomCppImplementationDataType子类,则使用自定义命名空间中的map类型(例如my::variant)(前提是可以使用可用的建模功能配置自定义命名空间中的类型)
(RS_MANI_00039)
[TPS_MANI_03191]{DRAFT}存储在VARIANT中的类型替代项的定义: 存储在类别VARIANT中的CppImplementationDataType中的类型替代项由聚合的templateArgument和定义CppTemplateArgument的数据类型的相应templateType定义。(RS_MANI_00039)
[constr_3429]{DRAFT}类别VARIANT的CppImplementationDataTypes没有使用分配器: 类别VARIANT的CppImplementationDataType不允许聚合包含指向Allocator的分配器角色的templateArgument。
图3.15中描述的示例显示了具有两个CppTemplateArguments的VARIANT的定义。 每个代表一种替代类型。
请注意,CppImplementationDataType的CppTemplateArguments在ARXML中排序,并且该顺序在对象图中不可见。
3.3.3.11 Bitfield Data Type
[TPS_MANI_03202]{DRAFT}bitfield 类型的定义: 在AUTOSAR元模型中,bitfield 不是通过具有自有类别的cpppimplementationdatatype实现的。bitfield是在类别TYPE_REFERENCE的StdCppImplementationDataType原语的上下文中定义的,该原语可以归结为类别VALUE的StdCppImplementationDataType。类别BITFIELD_TEXTTABLE 的CompuMethod用于为原始StdCppImplementationDataType的每一位指定特殊含义。(RS_MANI_00039)
在类别BITFIELD_TEXTTABLE的CompuMethod中具有掩码的CompuScales定义了隔离的部分,这些部分在与掩码匹配的数据的语义方面可以彼此独立。
使用类别为BITFIELD_TEXTTABLE的CompuMethod的规则与AUTOSAR Classic Platform中的规则相同,并在软件组件模板中进行了描述。
3.3.4 Compatibility of ApplicationDataType and CppImplementationDataType
ApplicationDataTypes的使用意味着在某个时间点上也存在相应的cpppimplementationdatatype。在ServiceInterface中使用CppImplementationDataTypes是生成ara::com proxies和skeletons的基础,也是在网络绑定中序列化有效负载的基础。
[TPS_MANI_03223]{DRAFT}CppImplementationDataType的存在: 在为ServiceInterface生成Service头文件的方法步骤之前,不需要存在CppImplementationDataTypes。在方法论中达到这一步之前,只使用ApplicationDataTypes来描述ServiceInterfaces的语义是完全可行的。(RS_MANI_00003)
因此,有必要定义兼容性规则,明确阐明ApplicationDataType与cpppimplementationdatatype的一致性,反之亦然。
有几个规则取决于数据类型的类别:
- 通常,如果类型映射将类别TYPE_REFERENCE的CppImplementationDataType作为目标,则下面给出的所有规则都将应用于CppImplementationDataType,它在解析所有此类引用之后才最终有效。并非所有规则都重复此步骤。 例如,如果文档指出可以将给定的ApplicationDataType映射到类别VALUE的CppImplementationDataType,则这应包括映射到引用另一个类别VALUE的CppImplementationDataType的类别TYPE_REFERENCE的CppImplementationDataType的可能性。
- [constr_5033]{DRAFT}数据类型与类别VALUE的兼容性: 类别VALUE的ApplicationDataType只能映射到也具有类别VALUE的cpppimplementationdatatype。在这种情况下,由CppImplementationDataType生成的C ++数据类型应能够表示ApplicationDataType所需的所有数值。如果C++数据类型可以表示的数值范围至少覆盖ApplicationDataType.swDataDefProps.dataConstr中的极限定义的范围,则满足此条件(通过CompuMethod转换的内部限制或物理限制,也必须由ApplicationDataType提供)。 如果C ++数据类型涵盖CompuMethod中定义的枚举范围,则也满足该条件。
- [constr_5034]{DRAFT}数据类型与类别BOOLEAN的兼容性: 类别BOOLEAN的ApplicationDataType只能映射到类别VALUE的CppImplementationDataType。
- [constr_5035]{DRAFT}数据类型与类别STRING的兼容性: 类别STRING的ApplicationDataType只能映射到类别STRING的CppImplementationDataType。
- [constr_5036]{DRAFT}数据类型与类别ARRAY的兼容性: 类别ARRAY的ApplicationDataType只能映射到:
- 类别ARRAY的CppImplementationDataType ,或者
- 类别VECTOR的CppImplementationDataType
在这种情况下,CppImplementationDataType的数组大小和数组元素的类型应确保可以按顺序将它们按1:1映射/传输到相应的应用程序数据,反之亦然。
[constr_5037]{DRAFT}数据类型与具有variableSize的类别ARRAY的兼容性: 类别ARRAY的ApplicationDataType包含一个在一个定义维度中将arraySizeSemantics设置为variableSize的ApplicationArrayElement,其应该映射为:
- 类别VECTOR的CppImplementationDataType
[constr_5038]{DRAFT}数据类型与具有fixedSize的类别ARRAY的兼容性: 类别ARRAY的ApplicationDataType只包含一个在所有定义维度中将arraySizeSemantics设置为fixedSize的ApplicationArrayElement,其应该映射为:
- 类别ARRAY的CppImplementationDataType
[constr_5039]{DRAFT}数据类型与类别STRUCTURE的兼容性: 类别STRUCTURE的ApplicationDataType只能映射到类别STRUCTURE的cpppimplementationdatatype。这意味着,相应的元素对也应具有兼容的类型。
[constr_5040]{DRAFT}表示可选元素结构的ApplicationRecordDataType和cpppimplementationdatatype的兼容性表示可选元素结构的ApplicationRecordDataType只能映射到表示可选元素结构的类别STRUCTURE的cpppimplementationdatatype,前提是对应的元素对具有相同的isOptional属性值。
[constr_5041]{DRAFT}数据类型与类别ASSOCIATIVE_MAP的兼容性: 类别ASSOCIATIVE_MAP的ApplicationDataType只能映射到类别ASSOCIATIVE_MAP的CppImplementationDataType。
[constr_5042]{DRAFT}没有数据类型映射到类别VARIANT的CppImplementationDataType: ApplicationDataType绝不能映射到类别VARIANT的CppImplementationDataType。
[constr_5043]{DRAFT}禁止映射到CppImplementationDataType的数据类型: AUTOSAR自适应平台不支持类别为COM_AXIS,RES_AXIS,CURVE,MAP,CUBOID,CUBE_4,CUBE_5的ApplicationDataType,因此无法将其映射到CppImplementationDataType。
请注意,[constr_5043]中列出的类别不受支持,因为在Adaptive Platform中没有相关用法的用例。
在AUTOSAR经典平台上,不需要在DataTypeMap中考虑复合数据类型的元素。 之所以制定此规则,是因为以下事实:AUTOSAR经典平台上的复合数据类型的元素不一定具有对ImplementationDataType的引用。
在AUTOSAR自适应平台上,情况有所不同。 CppImplementationDataTypeElement始终需要对形式化CppImplementationDataType的引用。
如果在DataTypeMap中提到所有相关的数据类型,则数据类型定义的处理变得更加容易,这就是[constr_5044]的存在的动机。
[constr_5044]{DRAFT}用于复合数据类型的DataTypeMap: 在给定ServiceInterface的上下文中,在事件,字段,方法的上下文中使用的ApplicationCompositeDataType的定义的上下文中使用的所有成对的ApplicationDataType和CppImplementationDataType必须在包含在其中一个DataTypeMappingSet中的DataTypeMap中进行描述 在PortInterfaceToDataTypeMapping中引用,该接口还引用了提到的ServiceInterface。

