函数 RegisterGetHandler [SWS_CM_00114] Upstream: RS_CM_00218, RS_AP_00114, RS_AP_00120, RS_AP_00127, RS_AP_00128, RS_AP_00138
void RegisterGetHandler (std::function< ara::core::Future< FieldType >()> handler) noexcept;
Register a callback function to be invoked when a Get() request is received. The method exists only if the offered service contains a Field and Field.hasGetter ==TRUE
使用
方法 RegisterGetHandler 在服务器端于 Skeleton 的字段对象上调用([SWS_CM_00114])。仅当在相关字段的接口描述中配置了 Getter 时,它才会存在于生成的代码中(Field.hasGetter == TRUE)(EXP ARAComAPI §5.4.8.1 “Registering Getters”)。传入类型为 std::function<ara::core::Future<FieldType>()> 的回调 handler,当收到代理的 Get() 请求时,绑定实现将调用该回调。
注册此类 Handler 完全是可选的(EXP ARAComAPI §5.4.8.1 “Registering Getters”)。通常,服务实现不需要 Getter Handler,因为 Communication Management 会缓存最近通过 Update() 设置的值并自主响应代理请求。只有当确定字段值非常耗时或计算量很大,因此应在实际需要时才通过 Promise/Future 模式异步进行时,Handler 才尤为有意义。
错误处理与边界条件
该函数没有返回值,声明为 noexcept 并且是异常安全的(exception safe)([SWS_CM_00114])。如果传入的 Callable 不存在或为 null,则存在错误 InvalidHandlerViolation([SWS_CM_00114])。
相互作用
与 RegisterSetHandler(在存在 Setter 时必须调用 EXP ARAComAPI §5.4.8.2 “Registering Setters”)相反,RegisterGetHandler 完全是可选的。如果 Handler 要在特定执行上下文中异步处理,还可以使用带有 ExecutorT 的重载模板函数([SWS_CM_11360])。
本使用说明由 AI 基于 AUTOSAR R25-11 规范生成。
实现者指南即将推出(复杂度 I2)
| Header-Datei | #include "<SiNamespaceDerivedDirectoryPath>/<SiShortname>_skeleton.h" |
|---|---|
| Scope | class <SI-Namespace>::skeleton:: fields::<Field> |
| Exception-Sicherheit | exception safe |
| Verletzungen (Violations) | InvalidHandlerVio- Provided Callable handler does not exist or is null lation |
Parameter (in)
| Parameter | Beschreibung |
|---|---|
| handler | The callback function to be invoked to process the Field get request |
Rückgabewert
| Typ | Beschreibung |
|---|---|
| None |
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/SWS_CM_00114- Status
- valid/unmigrated
- Version
AUTOSAR/AP/record/SWS_CM_00114@rel:R25-11#ec2a9a8c- Content hash
ec2a9a8c- Source
- https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_CommunicationManagement.pdf#nameddest=SWS_CM_00114
Status: valid/unmigrated
Version: rel:R25-11#c6386380
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_00114@rel:R25-11#c6386380
Recorded Revisions (8):
- R25-11
rel:R25-11#417163c72026-09-30 - R19-11
rel:R19-11#f07f56a32026-10-14 - R20-11
rel:R20-11#cdd125c72026-10-14 - R21-11
rel:R21-11#cdd125c72026-10-14 - R22-11
rel:R22-11#6a153b112026-10-14 - R23-11
rel:R23-11#23956e7c2026-10-14 - R24-11
rel:R24-11#5d29d0102026-10-14 - R25-11
rel:R25-11#c63863802026-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 · 德文原文