DEENESPTFRRUARHIKOZHNL

类 ara::phm::PhmErrorDomain

[SWS_PHM_01241] Upstream: RS_AP_00119

class PhmErrorDomain final :            public ara::core::ErrorDomain {...};

Defines the error domain for Platform Health Management.

Header-Datei#include "ara/phm/phm_error_domain.h"
Forwarding-Header#include "ara/phm/phm_fwd.h"
Scopenamespace ara::phm
Basisklasse(n)ara::core::ErrorDomain
Unique IDAs per ara::phm::PhmErrorDomain in [SWS_CORE_90023]

用户指南人工智能生成

定义 Platform Health Management 的错误域,用于分配消息并抛出异常。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 61c82c26ab31 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

定义 Platform Health Management 的错误域,用于分配消息并抛出异常。

该类用作 Platform Health Management 的领域特定错误域,并将数值错误代码转换为关联的文本消息 [SWS_PHM_01249]。在启用异常处理的情况下,它允许通过 ThrowAsException 定向抛出匹配的错误异常 [SWS_PHM_01250]。如果工具链中禁用了 C++ 异常,则该转换功能不可用,错误必须完全基于值进行处理 [SWS_PHM_01250]。

上下文

类 ara::phm::PhmErrorDomain 代表 AUTOSAR Adaptive Platform 内 Platform Health Management(PHM)的专用错误域。它公有继承自基础架构 ara::core::ErrorDomain 并声明为 final,从而防止进一步派生。其核心任务是封装 PHM 子系统的数值错误代码,将其嵌入到标准化上下文中,并提供与错误消息及错误处理类型的语义关联。通过方法 Name(),该类提供域的规范化标识符 [SWS_PHM_01248]。此外,它还定义了用于错误处理的标准化接口别名:Errc 用作底层枚举格式 PhmErrc [SWS_PHM_01245] 的类型别名,而 Exception 引用领域特定异常 PhmException 的基类型 [SWS_PHM_01246]。

生命周期

ara::phm::PhmErrorDomain 的实例化通过无参默认构造函数 PhmErrorDomain() [SWS_PHM_01247] 进行。该构造函数被限定为 noexcept,并按规范归类为异常安全(exception safe)和线程安全 [SWS_PHM_01247]。在典型的运行时场景中,错误域的实例通常应作为长寿命对象(单例)在进程范围内可用,以便应用程序和内部 PHM 组件共享同一个实例。 问题 Q-6b33f78e8f3b3e08 (未决)该类的所有无状态查询函数——尤其是 Name() 和 Message()——均声明为 const noexcept 且完全线程安全 [SWS_PHM_01248],[SWS_PHM_01249]。因此,可以从多个并行控制流中查询错误描述,而无需外部同步。

使用路径

如果在监视或管理系统状态时发生错误,PHM 子系统会生成相应的错误代码,该代码通常在引用 PhmErrorDomain 的情况下封装为 ara::core::ErrorCode 传递给调用方。接收方应用软件可以根据该域检查发生的错误是否来自健康管理。为了进行诊断和记录,它会调用方法 Message(errorCode),该方法针对传入的代码以 const char* 形式返回相关的文本消息 [SWS_PHM_01249]。如果应用程序通过异常处理来处理失败的操作,则会将 ara::core::ErrorCode 传递给 ThrowAsException(errorCode),以抛出关联的异常 [SWS_PHM_01250]。

通过 PhmErrorDomain 进行错误解析的流程应用PHM-DienstPhmErrorDomain调用监控函数()Erzeugt ara::core::ErrorCode (Errc)返回 ErrorCodeUse Case: Fehlertext ermittelnMessage(errorCode)Fehlermeldung (const char*)optExceptions aktiviertThrowAsException(errorCode)throw PhmException

时序图:通过 PhmErrorDomain 进行错误检查和异常抛出的典型流程。来源:[SWS_PHM_01245]、[SWS_PHM_01246]、[SWS_PHM_01249]、[SWS_PHM_01250]

错误场景

将错误代码显式转换为 C++ 异常是通过方法 ThrowAsException(errorCode) 实现的 [SWS_PHM_01250]。抛出的异常对应于类型 Exception,该类型映射到 PhmException [SWS_PHM_01246]。由于该函数按设计抛出异常,因此它在规范中被指明为非异常安全(not exception safe),但在调用方面仍保持线程安全 [SWS_PHM_01250]。对于没有异常处理的环境,存在一个重要的约束条件:如果在编译器中禁用了 C++ 异常,则 ThrowAsException 不参与重载解析 [SWS_PHM_01250]。在此模式下,调用方必须通过方法 Message() 和错误代码的返回值纯粹基于值来处理错误 [SWS_PHM_01249]。

本指南基于 Adaptive Platform Release R25-11 的 AUTOSAR 规范。

成员图

构造函数和析构函数

1

类型别名

2

类图

Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.

G nara__phm__PhmErrorDomain808 PhmErrorDomain + PhmErrorDomain() + Message() + Name() + ThrowAsException() nara__core__ErrorDomain335 ErrorDomain nara__phm__PhmErrorDomain808->nara__core__ErrorDomain335

详细视图

请在大纲中选择一个条目。

构造函数和析构函数

Creates a PhmErrorDomain instance.

PhmErrorDomain () noexcept;

方法

Message 函数

Returns the message associated with the error code.

const char * Message (CodeType errorCode) const noexcept override;
Name 函数

Returns the name of the error domain.

const char * Name () const noexcept override;

Throws the exception associated with the error code. As per [SWS_CORE_10304], this function does not participate in overload resolution when C++ exceptions are disabled in the compiler toolchain.

void ThrowAsException (const ara::core::ErrorCode &errorCode) const override;

类型别名

Errc 类型别名

Alias for the error code value enumeration.

using Errc = PhmErrc;
Exception 类型别名

Alias for the exception base class.

方法文档

函数 Message [SWS_PHM_01249] Upstream: RS_AP_00119, RS_AP_00159

const char * Message (CodeType errorCode) const noexcept override;

Returns the message associated with the error code.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 9377332e8cc7 来源 未决问题(1)
译自德文指南AI 生成gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::phm::PhmErrorDomain 的成员函数 Message 针对传入的类型为 CodeType 的错误编号 errorCode,将关联错误消息的文本描述作为 const char * 返回 [SWS_PHM_01249]。该函数通过头文件 ara/phm/phm_error_domain.h 提供,并作为虚方法(override)重写了用于错误解析的默认接口行为 [SWS_PHM_01249]。

对于调用上下文和执行语义,适用以下规定:

  • 同步执行和异常处理:该调用以同步方式进行,并声明为 noexcept;此外,该方法被规范定义为 exception safe,因此在执行期间不会抛出异常 [SWS_PHM_01249]。
  • 并发性:该函数明确声明为 thread-safe,可以安全地从并发线程中调用,而无需额外的外部同步 [SWS_PHM_01249]。
  • 内存管理:解释:返回的字符指针可能指向静态字符字面量,因此调用方无需执行内存释放。 问题 Q-dcdc593e3f9ded45 (未决)

在 Platform Health Management(PHM)中,该方法用于将 PhmErrorDomain 的数字错误码转换为人类可读的字符串,以用于日志记录或诊断目的 [SWS_PHM_01249]。

本文由 AI 生成,仅供参考。唯一具有约束力的是官方 AUTOSAR 规范。

Header-Datei#include "ara/phm/phm_error_domain.h"
Scopeclass ara::phm::PhmErrorDomain
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
errorCodeThe error code number.

Rückgabewert

TypBeschreibung
const char *The message associated with the error code.

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_PHM_01249
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PHM_01249@rel:R25-11#9b2415dd
Content hash
9b2415dd
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_PlatformHealthManagement.pdf#nameddest=SWS_PHM_01249
Status: valid/unmigrated Version: rel:R25-11#87e7affe Versionshistorie & Revisions (1 transition, 5 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_PHM_01249@rel:R25-11#87e7affe
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#29a23c2e2026-09-30
  • R22-11rel:R22-11#d28a09b52026-10-14
  • R23-11rel:R23-11#fb2533e82026-10-14
  • R24-11rel:R24-11#87e7affe2026-10-14
  • R25-11rel:R25-11#87e7affe2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 Name [SWS_PHM_01248] Upstream: RS_AP_00119, RS_AP_00159

const char * Name () const noexcept override;

Returns the name of the error domain.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: ae1e33120f1a 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::phm::PhmErrorDomain 的成员函数 Name 将错误域的名称作为字符串返回([SWS_PHM_01248])。该声明在模块 phm 中通过头文件 #include "ara/phm/phm_error_domain.h" 包含([SWS_PHM_01248])。

对于实际使用和运行时行为,适用以下规定:

  • 使用和签名:该方法具有签名 const char * Name () const noexcept override;([SWS_PHM_01248])。它以同步方式执行,并且不需要传递任何参数。返回的 const char * 类型指针符合来自 [SWS_CORE_90023] 的 ara::phm::PhmErrorDomain 规定。
  • 错误处理:该函数声明为 noexcept,并具备异常安全级别 exception safe([SWS_PHM_01248])。它在运行时不抛出异常,也不生成错误消息。
  • 并发性:该方法被规范定义为线程安全的(thread-safe)([SWS_PHM_01248])。可以通过相同或不同的实例执行并发调用,而无需额外的同步机制。

在架构交互中,该操作重写了上级错误域接口的虚拟名称查询,并根据 [SWS_CORE_90023] 为 ara::phm::PhmErrorDomain 提供特定名称([SWS_PHM_01248])。

本使用说明基于 AUTOSAR 规范 R25-11 自动生成。

Header-Datei#include "ara/phm/phm_error_domain.h"
Scopeclass ara::phm::PhmErrorDomain
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
const char *As per ara::phm::PhmErrorDomain in [SWS_CORE_90023]

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_PHM_01248
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PHM_01248@rel:R25-11#ca1179f2
Content hash
ca1179f2
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_PlatformHealthManagement.pdf#nameddest=SWS_PHM_01248
Status: valid/unmigrated Version: rel:R25-11#87eea56a Versionshistorie & Revisions (1 transition, 5 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_PHM_01248@rel:R25-11#87eea56a
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#08e28bf82026-09-30
  • R22-11rel:R22-11#3d1a89cc2026-10-14
  • R23-11rel:R23-11#13db17322026-10-14
  • R24-11rel:R24-11#0999648f2026-10-14
  • R25-11rel:R25-11#87eea56a2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 PhmErrorDomain [SWS_PHM_01247] Upstream: RS_AP_00119, RS_AP_00159

PhmErrorDomain () noexcept;

Creates a PhmErrorDomain instance.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 0eccae6e5543 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

默认构造函数 PhmErrorDomain() 用于创建错误域 ara::phm::PhmErrorDomain 的实例 [SWS_PHM_01247]。该调用通过头文件 ara/phm/phm_error_domain.h 以同步方式执行且不带输入参数 [SWS_PHM_01247]。

在执行安全性方面,该构造被规范定义为 exception safe 并声明为 noexcept,因此不会引发异常 [SWS_PHM_01247]。此外,实例化是线程安全的 [SWS_PHM_01247]。

所创建的域构成了 PHM 错误的上下文,并提供了诸如 Name() [SWS_PHM_01248]、Message() [SWS_PHM_01249] 以及 ThrowAsException() [SWS_PHM_01250] 等成员函数,同时引入了类型别名 Errc [SWS_PHM_01245] 和 Exception [SWS_PHM_01246]。对于对错误域的常规访问,提供了自由函数 GetPhmDomain(),该函数返回对全局对象的引用 [SWS_PHM_01251]。因此,在应用代码中通常不需要通过构造函数进行单独的手动实例化。 问题 Q-63be3bb534ef1fa9 (未决)

本使用说明基于来自 AUTOSAR Adaptive R25-11 的规范数据自动生成。

实现者指南即将推出(复杂度 I1)

Header-Datei#include "ara/phm/phm_error_domain.h"
Scopeclass ara::phm::PhmErrorDomain
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_PHM_01247
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PHM_01247@rel:R25-11#489b29f0
Content hash
489b29f0
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_PlatformHealthManagement.pdf#nameddest=SWS_PHM_01247
Status: valid/unmigrated Version: rel:R25-11#e616a447 Versionshistorie & Revisions (1 transition, 5 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_PHM_01247@rel:R25-11#e616a447
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#c16054342026-09-30
  • R22-11rel:R22-11#1e02ca242026-10-14
  • R23-11rel:R23-11#6c11e67c2026-10-14
  • R24-11rel:R24-11#e616a4472026-10-14
  • R25-11rel:R25-11#e616a4472026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 ThrowAsException [SWS_PHM_01250] Upstream: RS_AP_00119

void ThrowAsException (const ara::core::ErrorCode &errorCode) const override;

Throws the exception associated with the error code. As per [SWS_CORE_10304], this function does not participate in overload resolution when C++ exceptions are disabled in the compiler toolchain.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 2438d348b5ed 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

成员函数 ThrowAsException 是错误域类 ara::phm::PhmErrorDomain 的一个方法,通过头文件 ara/phm/phm_error_domain.h 提供([SWS_PHM_01250])。其目的在于同步抛出与传入错误码关联的 C++ 异常([SWS_PHM_01250])。为此,该函数接收对 const ara::core::ErrorCode & 类型的错误对象 errorCode 的引用作为输入参数([SWS_PHM_01250])。由于在错误执行时控制流通过异常继续,因此该方法没有返回值(void)([SWS_PHM_01250])。

并发性与执行安全性

关于并行调用时的行为,ThrowAsException 被声明为线程安全([SWS_PHM_01250])。因此,可以安全地跨多个线程并发调用它。相比之下,关于异常安全性,该接口在规范中被明确归类为“not exception safe”([SWS_PHM_01250])。

编译器限制与重载解析

[SWS_CORE_10304] 定义了使用时的一项重要约束条件:如果在所使用的编译器工具链中停用了 C++ 异常,则 ThrowAsException 不参与重载解析([SWS_PHM_01250])。因此,在针对无异常支持的平台或配置进行软件构建时,该函数不供编译器用于重载解析([SWS_PHM_01250])。

本使用说明由自动生成,基于 AUTOSAR Adaptive R25-11 规范。

Header-Datei#include "ara/phm/phm_error_domain.h"
Scopeclass ara::phm::PhmErrorDomain
Exception-Sicherheitnot exception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
errorCodeThe error to throw.

Rückgabewert

TypBeschreibung
None

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_PHM_01250
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PHM_01250@rel:R25-11#4ff7bd0f
Content hash
4ff7bd0f
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_PlatformHealthManagement.pdf#nameddest=SWS_PHM_01250
Status: valid/unmigrated Version: rel:R25-11#7f33d0e7 Versionshistorie & Revisions (1 transition, 5 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_PHM_01250@rel:R25-11#7f33d0e7
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#98735c902026-09-30
  • R22-11rel:R22-11#ca4e4bdf2026-10-14
  • R23-11rel:R23-11#1075311f2026-10-14
  • R24-11rel:R24-11#7f33d0e72026-10-14
  • R25-11rel:R25-11#7f33d0e72026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

类型别名文档

类型别名 Errc [SWS_PHM_01245] Upstream: RS_AP_00119, RS_AP_00127

using Errc = PhmErrc;

Alias for the error code value enumeration.

Header-Datei#include "ara/phm/phm_error_domain.h"
Scopeclass ara::phm::PhmErrorDomain
SymbolErrc

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_PHM_01245
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PHM_01245@rel:R25-11#20551af0
Content hash
20551af0
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_PlatformHealthManagement.pdf#nameddest=SWS_PHM_01245
Status: valid/unmigrated Version: rel:R25-11#69dedf2e Versionshistorie & Revisions (1 transition, 5 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_PHM_01245@rel:R25-11#69dedf2e
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#82e44aca2026-09-30
  • R22-11rel:R22-11#86c185582026-10-14
  • R23-11rel:R23-11#69dedf2e2026-10-14
  • R24-11rel:R24-11#69dedf2e2026-10-14
  • R25-11rel:R25-11#69dedf2e2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

类型别名 Exception [SWS_PHM_01246] Upstream: RS_AP_00119, RS_AP_00127

using Exception = PhmException;

Alias for the exception base class.

Header-Datei#include "ara/phm/phm_error_domain.h"
Scopeclass ara::phm::PhmErrorDomain
SymbolException

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_PHM_01246
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PHM_01246@rel:R25-11#fcdcfddd
Content hash
fcdcfddd
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_PlatformHealthManagement.pdf#nameddest=SWS_PHM_01246
Status: valid/unmigrated Version: rel:R25-11#3b0710ff Versionshistorie & Revisions (1 transition, 5 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_PHM_01246@rel:R25-11#3b0710ff
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#e2b0390c2026-09-30
  • R22-11rel:R22-11#c46a9c8a2026-10-14
  • R23-11rel:R23-11#3b0710ff2026-10-14
  • R24-11rel:R24-11#3b0710ff2026-10-14
  • R25-11rel:R25-11#3b0710ff2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill