函数 Allocate [SWS_CM_90438] Upstream: RS_CM_00201, RS_AP_00114, RS_AP_00115, RS_AP_00120
ara::com::SampleAllocateePtr< SampleType > Allocate ();
Allocating data for event transfer when Communication Management is responsible for the data.
当 Communication Management (ara::com) 负责数据管理时 ([SWS_CM_90438]),在 Skeleton 级别为事件调用方法 Allocate ([SWS_CM_90438]; AUTOSAR_AP_EXP_ARAComAPI §5.4.1 “Skeleton Class API’s”),以分配用于传输事件数据的内存。它返回一个类型为 ara::com::SampleAllocateePtr<SampleType> 的实例 ([SWS_CM_90438])。该指针类型在概念上表现得像一个 std::unique_ptr<T>,因此在任何时间点都只有一个参与方拥有该指针的所有权 (ARAComAPI §6 “Event Allocate/Send sample Binding implementer hint”)。
关于错误处理和异常安全性,Allocate 被指定为 not exception safe ([SWS_CM_90438])。规范定义了两种可能的违例(Violations):
SampleAllocationViolation:没有足够的内存资源来分配数据 ([SWS_CM_90438])。AllocateUsageViolation:通过用户自定义分配器进行了不允许的分配 ([SWS_CM_90438])。
Allocate 背后的概念主要旨在支持零拷贝机制,特别是在基于共享内存的 IPC 传输中,此时假定读取器和写入器之间存在严格同步 (ARAComAPI §6 “Event Allocate/Send sample Binding implementer hint”)。实现者必须注意,如果部署中的数据类型未配置为二进制兼容,或者识别逻辑排除了这一点,则序列化要求可能会破坏零拷贝 (ARAComAPI §6 “Event Allocate/Send sample Binding implementer hint”)。
在与发送事件的交互中,通过 Allocate 获取的内存指针被传递给 Send(ara::com::SampleAllocateePtr<SampleType> data) ([SWS_CM_90437])。在调用 Send 之后,一旦 Communication Management 将数据发送给所有订阅应用程序,服务应用程序便不得再访问该数据 ([SWS_CM_90437])。
本文由人工智能创建,完全基于 AUTOSAR R25-11 版本的规范文档。
实现者指南即将推出(复杂度 I2)
| Header-Datei | #include "<SiNamespaceDerivedDirectoryPath>/<SiShortname>_skeleton.h" |
|---|---|
| Scope | class <SI-Namespace>::skeleton:: events::<Event> |
| Exception-Sicherheit | not exception safe |
| Verletzungen (Violations) | SampleAllocation- Not enough memory resources can be allocated Violation AllocateUsageVio- The allocation was illegally done via custom allocator lation |
Rückgabewert
| Typ | Beschreibung |
|---|---|
| ara::com::Sample | A ara::com::SampleAllocateePtr to an event sample AllocateePtr< Sample Type > |
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/SWS_CM_90438- Status
- valid/unmigrated
- Version
AUTOSAR/AP/record/SWS_CM_90438@rel:R25-11#5d611e27- Content hash
5d611e27- Source
- https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_CommunicationManagement.pdf#nameddest=SWS_CM_90438
Status: valid/unmigrated
Version: rel:R25-11#3059e6d8
Versionshistorie & Revisions (1 transition, 8 revision)
- Current State
valid/unmigrated- Reason
- mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
- Campaign
2026-08-13-status-backfill- Active Version
AUTOSAR/AP/record/SWS_CM_90438@rel:R25-11#3059e6d8
Recorded Revisions (8):
- R25-11
rel:R25-11#b02a325f2026-09-30 - R19-11
rel:R19-11#b404edd72026-10-14 - R20-11
rel:R20-11#8f3783f62026-10-14 - R21-11
rel:R21-11#a234befb2026-10-14 - R22-11
rel:R22-11#340e44dd2026-10-14 - R23-11
rel:R23-11#340e44dd2026-10-14 - R24-11
rel:R24-11#2e4120f42026-10-14 - R25-11
rel:R25-11#3059e6d82026-10-14 active
Requirement Text as-of this release:
Curation Decisions:
Reachable Artifacts & Dependents:
| Date | Actor | Transition | Reason / Rationale | Campaign |
|---|---|---|---|---|
| 2026-08-13 | tool | none → valid/unmigrated | mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record | 2026-08-13-status-backfill |
gemini-3.8-flash-low· 2026-10-13 · 德文原文