类 ara::shwa::DeviceSelectorDiese Seite wurde vollständig KI-generiert auf Basis von SWS Safe Hardware Acceleration (R25-11) — kein offizieller AUTOSAR-Text und keine automatisch extrahierte API-Seite wie die übrigen Module. Als Interpretation gekennzeichnete Aussagen sind Schlussfolgerungen aus den Quellen.
[AP_SWS_SHWA_00401] 原文尚未导入 Upstream: RS_SHWA_00006
class DeviceSelector {...}; Die Spezifikation definiert diesen Klassentyp mit der gezeigten Schnittstelle.
Header-Datei #include "ara/shwa/device_selector.h" Scope namespace ara::shwa
用户指南人工智能生成 用作基于特定选择策略评估和选择设备的抽象接口。
AI 生成
未审核
模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 4c64c523c424
来源
未决问题(3)
摘要 详细
用作基于特定选择策略评估和选择设备的抽象接口。
抽象类 ara::shwa::DeviceSelector 定义了一个策略接口,用于在子系统 shwa 中评估和选择目标设备。它允许通过 SelectDevice() 直接确定最佳设备,并通过 operator() 对各个候选设备进行比较评估 [AP_SWS_SHWA_00403] 、[AP_SWS_SHWA_00404] 。虚默认析构函数保证了派生策略实例的安全销毁。关键约束条件包括调用不是线程安全的,并且在发生故障时不适用自动回滚语义。
更多 ›
上下文
类 ara::shwa::DeviceSelector 在模块 shwa 中提供了一个抽象接口,用于基于特定选择策略选择或评估硬件或功能设备(Device)。它充当上层控制应用程序与具体选择过程之间的解耦层。参与的交互对象包括调用方应用程序、选择策略的具体实现以及 Device 类型的目标对象。该接口定义了两个核心操作:通过 SelectDevice() [AP_SWS_SHWA_00403] 直接选择设备,以及通过函数调用运算符 operator() [AP_SWS_SHWA_00404] 对设备进行比较性单独评估。
DeviceSelectorKontext
Anwendung
Anwendung
DeviceSelector
DeviceSelector
Anwendung->DeviceSelector
使用
Device
Device
DeviceSelector->Device
selektiert / bewertet
上下文图:DeviceSelector 在应用程序与设备目标之间的嵌入。来源:[AP_SWS_SHWA_00403] 、[AP_SWS_SHWA_00404]
生命周期
作为包含纯虚方法的抽象基类,DeviceSelector 无法直接实例化。具体的选择策略应该实现为派生类并由应用程序组件创建。 问题 Q-4e22b2e57ef141e9 (未决) 所有权管理通常由应用程序负责,例如通过智能指针如 std::unique_ptr<DeviceSelector>。为了对特化类进行彻底的多态销毁,该接口声明了一个虚默认析构函数 ~DeviceSelector() [AP_SWS_SHWA_00402] 。该析构函数显式声明为 noexcept,从而在销毁实例时满足异常安全性(exception safe)要求 [AP_SWS_SHWA_00402] 。
在并发性和状态转换方面,接口操作被归类为非线程安全(not thread-safe)[AP_SWS_SHWA_00403] 、[AP_SWS_SHWA_00404] 。尽管成员函数带有 const 注解,但在没有外部同步的情况下,不得从不同线程对同一实例进行并发访问。此外,规范未对失败的调用规定自动回滚机制(no_rollback_semantics)[AP_SWS_SHWA_00403] 、[AP_SWS_SHWA_00404] 。
使用路径
典型的使用流程包括初始化具体策略实例,然后对候选设备进行评估或选择。这里存在两条主要调用路径:
直接设备选择: 应用程序调用无参数方法 SelectDevice() [AP_SWS_SHWA_00403] 。具体策略自主确定最合适的设备并返回 ara::core::Result<Device>。
迭代式单独评估: 在用于过滤或排序多个候选设备的算法中,应用程序将各个实例相继传递给 operator()(const Device &device) [AP_SWS_SHWA_00404] 。通过 operator() 进行的求值应该在内部分析所传递设备的相关属性或操作状态。 问题 Q-8ba0b9b900196d50 (未决) 在 ara::core::Result<int> 中返回的 int 值在此应该反映适用性指标或优先级,调用方据此做出选择决策。
设备评估与选择的调用序列 应用 DeviceSelector Use Case: 单个候选设备的评估 operator()(device) alt Erfolgreiche Auswertung Result<int> (Bewertungswert) Ressource belegt ShwaErrorCode::kResourceBusy Use Case: 直接设备选择 SelectDevice() alt Erfolgreiche Selektion Result<Device> 不支持的功能 ShwaErrorCode::kFeatureNotSupported
时序图:用于单独评估和直接选择的调用序列,包括错误处理。来源:[AP_SWS_SHWA_00403] 、[AP_SWS_SHWA_00404]
错误场景
两种选择方法均声明为 noexcept,且不抛出 C++ 异常(exception safe)。相反,它们通过 ara::core::Result 的错误通道发出失败信号。应用程序必须始终在访问结果之前检查返回值是否存在错误。为 SelectDevice() 和 operator() 定义了以下错误状态:
由于不存在回滚语义(no_rollback_semantics)[AP_SWS_SHWA_00403] 、[AP_SWS_SHWA_00404] ,发生错误时系统将保持在当前状态,调用方负责采取适当的补偿措施。此外,operator() 的先决条件是所传递的设备引用必须在整个调用期间保持有效。
本类指南基于 AUTOSAR Adaptive R25-11 规范(shwa 模块),并经过自动化整理。
分组依据 类别 历史
此版本没有元素数据
构造函数和析构函数 Die Spezifikation definiert diese Deklaration mit der in der Signatur ausgewiesenen Semantik.
virtual ~DeviceSelector () noexcept=default;
方法 Bewertet beziehungsweise selektiert ein Device entsprechend der Selektor-Strategie.
virtual ara::core::Result< Device > SelectDevice () const noexcept=0;
运算符 Bewertet beziehungsweise selektiert ein Device entsprechend der Selektor-Strategie.
virtual ara::core::Result< int > operator() (const Device &device) const noexcept=0;
点击条目以查看其关系。
基类 派生类 使用 被使用于 继承 自此版本起移除 用于 此类中无关联 函数 AI 评注 打开类页面 无法加载类页面。 调整顺序 调整宽度 调整大纲宽度 章节 阅读时间 SWS 引用 图表 放回中间 调整顺序或拖到标题栏 取消停靠 – 在内容中显示 移到中间栏 作为标签停靠到标题栏 元素 AI 模型 打开审计档案 档案 打开简短版本 打开中等版本 打开完整版本 恢复默认视图 已恢复默认视图 撤销 关闭详细视图 签名 基本信息 值 截至所选版本的最后一次更改 之后的下一次更改 单击:选择版本 无法放在此处:拖到标题栏可停靠,拖到中间栏可取消停靠。 新增 已更改 未更改 已移除 未包含 更改 内容无变化 首次出现于 移除于 没有可用的版本数据。 正在加载版本数据 … 文本 此版本未收录措辞 悬停或单击单元格:与所选版本比较 · 单击版本标题:选择版本 选择版本 属性 版本 元素 只有一个版本有措辞 PDF 中存在,原文尚未导入 首次采集原文 自 {rel} 起未更改 版本颜色 最早版本 最新版本
详细信息 virtual ~DeviceSelector () noexcept=default; Die Spezifikation definiert diese Deklaration mit der in der Signatur ausgewiesenen Semantik.
Scope class ara::shwa::DeviceSelector Exception Safety exception safe
Status: valid/unmigrated
Version: rel:R25-11#8e9d36b4
Versionshistorie & Revisions (1 transition)
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/AP_SWS_SHWA_00402@rel:R25-11#8e9d36b4
Point-in-Time History:
Release:
R25-11 (Current / Active) R20-11 R19-11
View Snapshot
Historical Snapshot:
× Back to current
🚫
Requirement entfallen: Dieses Element ist im gewählten Release nicht mehr enthalten.
Requirement Text as-of this release:
Reachable Artifacts & Dependents:
Date Actor Transition Reason / Rationale Campaign
2026-08-13 tool none → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record 2026-08-13-status-backfill
virtual ara::core::Result< Device > SelectDevice () const noexcept=0; Bewertet beziehungsweise selektiert ein Device entsprechend der Selektor-Strategie.
Scope class ara::shwa::DeviceSelector Thread Safety not thread-safe no_rollback_semantics ShwaErrorCode::k ResourceBusy The operation could not be performed because the resource is currently busy no_rollback_semantics Exception Safety exception safe Errors ShwaErrorCode::k FeatureNotSupported Used when a requested feature isn’t supported
Status: valid/unmigrated
Version: rel:R25-11#83b7e520
Versionshistorie & Revisions (1 transition)
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/AP_SWS_SHWA_00403@rel:R25-11#83b7e520
Point-in-Time History:
Release:
R25-11 (Current / Active) R20-11 R19-11
View Snapshot
Historical Snapshot:
× Back to current
🚫
Requirement entfallen: Dieses Element ist im gewählten Release nicht mehr enthalten.
Requirement Text as-of this release:
Reachable Artifacts & Dependents:
Date Actor Transition Reason / Rationale Campaign
2026-08-13 tool none → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record 2026-08-13-status-backfill
virtual ara::core::Result< int > operator() (const Device &device) const noexcept=0; Bewertet beziehungsweise selektiert ein Device entsprechend der Selektor-Strategie.
Scope class ara::shwa::DeviceSelector Thread Safety not thread-safe no_rollback_semantics ShwaErrorCode::k ResourceBusy The operation could not be performed because the resource is currently busy no_rollback_semantics Exception Safety exception safe Errors ShwaErrorCode::k FeatureNotSupported Used when a requested feature isn’t supported
Status: valid/unmigrated
Version: rel:R25-11#2bfa9942
Versionshistorie & Revisions (1 transition)
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/AP_SWS_SHWA_00404@rel:R25-11#2bfa9942
Point-in-Time History:
Release:
R25-11 (Current / Active) R20-11 R19-11
View Snapshot
Historical Snapshot:
× Back to current
🚫
Requirement entfallen: Dieses Element ist im gewählten Release nicht mehr enthalten.
Requirement Text as-of this release:
Reachable Artifacts & Dependents:
Date Actor Transition Reason / Rationale Campaign
2026-08-13 tool none → valid/unmigratedmechanically 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 · 德文原文