DEENESPTFRRUARHIKOZHNL

класс ara::per::WriteAccessor

[SWS_PER_00595] Upstream: RS_PER_00004, RS_AP_00122, RS_AP_00146

class WriteAccessor final :              public virtual FileAccessor {...};

WriteAccessor is used to write file data. It provides the WriteBinary and WriteText methods featuring a Result for controlled, unformatted writing, and the operator<< method for simple formatted writing. It also provides SyncToFile() to flush the buffer of the operating system to the physical storage.

Header-Datei#include "ara/per/write_accessor.h"
Forwarding-Header#include "ara/per/per_fwd.h"
Scopenamespace ara::per
Basisklasse(n)FileAccessor

Руководство пользователяСОЗДАНО ИИ

Служит для буферизованной записи бинарных и текстовых файлов, а также их синхронизации с физическим накопителем.
СОЗДАНО ИИ не проверено Модель: gemini-3.8-flash-medium · Усилие: medium · Температура: не регулируется · Промпт: fd57dd10b948 Происхождение Открытые вопросы (1)
переведено с немецкого руководстваgemini-3.8-flash-low · 2026-10-13 · Немецкий оригинал

Служит для буферизованной записи бинарных и текстовых файлов, а также их синхронизации с физическим накопителем.

Класс ara::per::WriteAccessor обеспечивает запись бинарного или текстового содержимого файлов в модуле персистентности и предоставляет методы для неформатированного доступа на запись, а также форматированный оператор потока [SWS_PER_00423]. Поскольку операции записи сначала могут буферизоваться в операционной системе, вызов SyncToFile() принудительно выполняет окончательный сброс данных на физический накопитель [SWS_PER_00122]. Все методы являются безопасными к исключениям, однако не являются потокобезопасными, в связи с чем параллельный доступ должен защищаться приложением.

Контекст

ara::per::WriteAccessor является финальным классом модуля персистентности (per) платформы AUTOSAR Adaptive Platform и виртуально наследуется от FileAccessor. Класс предоставляет операции записи для содержимого файлов. Он предлагает методы для неформатированной контролируемой записи с обработкой ошибок через ara::core::Result, а также перегруженный оператор потока для форматированной записи. В качестве партнеров по взаимодействию выступают вызывающее приложение, внутренний файловый буфер операционной системы и физический носитель данных.

Жизненный цикл

Конструктор по умолчанию WriteAccessor явно удален и не должен использоваться [SWS_PER_00596]. (Интерпретация: экземпляры WriteAccessor, вероятно, создаются и предоставляются фабричными методами вышестоящих сущностей управления персистентностью, таких как File-Storage.) Вопрос Q-af92be8494274611 (открытый)

Уничтожение выполняется через виртуальный деструктор ~WriteAccessor() [SWS_PER_00597]. Класс и его методы специфицированы как безопасные к исключениям («exception safe») и объявлены как noexcept. В отношении многопоточности WriteAccessor не является потокобезопасным («not thread-safe») [SWS_PER_00597]; параллельный доступ к одному и тому же экземпляру должен защищаться приложением извне.

Путь использования

Стандартная процедура включает запись данных в неформатированном или форматированном режиме, опциональную корректировку размера файла и заключительное персистентное сохранение:

  • Запись бинарных данных: с помощью WriteBinary() диапазон байтов (ara::core::Span<const ara::core::Byte>) записывается в файл [SWS_PER_00423].
  • Запись текстовых данных: с помощью WriteText() строки передаются через ara::core::StringView [SWS_PER_00166]. Дополнительно доступен operator<< как удобная функция для некритичных сценариев использования, при этом возникающие ошибки негласно игнорируются [SWS_PER_00125].
  • Принудительное сохранение: момент фактической физической записи зависит от реализации персистентности; SyncToFile() гарантированно сбрасывает буфер операционной системы на носитель данных [SWS_PER_00122], [SWS_PER_00423], [SWS_PER_00166].
  • Изменение размера файла: с помощью SetFileSize() файл может быть усечен, в результате чего выступающее содержимое удаляется; позиция в файле остается без изменений либо устанавливается на последнюю допустимую позицию или 0 [SWS_PER_00428].
Типичная последовательность записи и синхронизации содержимого файлаПриложениеWriteAccessorSpeichermediumWriteBinary(b) / WriteText(s)ara::core::Result<void>SyncToFile()Betriebssystem-Puffer flashenСтатус / подтверждениеara::core::Result<void>

Диаграмма последовательности: операции записи с последующей синхронизацией с физическим носителем. Источники: [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122]

Сценарии ошибок

Методы WriteBinary(), WriteText(), SyncToFile() и SetFileSize() возвращают ara::core::Result<void>, содержащий при сбоях специфические коды ошибок:

  • PerErrc::kPhysicalStorageFailure: сбой доступа к физическому носителю данных [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122], [SWS_PER_00428]. Состояние файла неизвестно и он может быть полностью поврежден (семантика отката отсутствует).
  • PerErrc::kOutOfStorageSpace: недостаточно физического дискового пространства [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122]. При записи превышающая часть отбрасывается, а позиция устанавливается в конец файла (семантика отката отсутствует).
  • PerErrc::kQuotaExceeded: файл превысил бы сконфигурированный максимальный размер (AllowedSize) [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122] (семантика отката).
  • PerErrc::kEncryptionFailed: сбой шифрования или расшифрования [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122], [SWS_PER_00428]. Хотя буфер и позиция обновляются, файл не может быть сохранен и отражает на накопителе более старую версию (семантика отката).
  • PerErrc::kAuthenticationFailed: сбой вычисления или проверки MAC [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122], [SWS_PER_00428] (семантика отката).
  • PerErrc::kValidationFailed: невозможно гарантировать валидность сохраненных данных [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00428] (семантика отката).
  • PerErrc::kInvalidSize: новый размер файла при SetFileSize() больше текущего размера файла [SWS_PER_00428] (семантика отката).

Данное руководство было сгенерировано ИИ на основе спецификации AUTOSAR R25-11.

Карта членов

Конструкторы и деструктор

2

Операторы

1

Диаграмма классов

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

G nara__per__WriteAccessor940 WriteAccessor + WriteAccessor() + ~WriteAccessor() + SetFileSize() + SyncToFile() + WriteBinary() + WriteText() + operator<<() nara__per__FileAccessor932 FileAccessor nara__per__WriteAccessor940->nara__per__FileAccessor932 nara__per__ReadWriteAccessor483 ReadWriteAccessor nara__per__ReadWriteAccessor483->nara__per__WriteAccessor940

Подробный вид

Выберите элемент в оглавлении.

Конструкторы и деструктор

WriteAccessor функция

The default constructor for WriteAccessor shall not be used.

WriteAccessor ()=delete;
~WriteAccessor функция

Destructor for WriteAccessor.

~WriteAccessor () override noexcept;

Методы

SetFileSize функция

Reduces the size of the file to ’size’, effectively removing the current content of the file beyond this size. The current file position is unchanged if it is lower than ’size’, or set to the last valid position in the file otherwise. If ’size’ is 0, the current file position will also be set to 0.

ara::core::Result< void > SetFileSize (std::uint64_t size) noexcept;
SyncToFile функция

Flushes the current file content to the physical storage.

ara::core::Result< void > SyncToFile () noexcept;
WriteBinary функция

Writes the content of a Span of Byte to the file. The time when the content is persisted depends on the implementation of Persistency. SyncTo File can be used to force Persistency to persist the file content. In case of an error, the file content might be corrupted, and the current position might or might not have changed. The expected state of the file for each supported error can be expected to be as follows: • kPhysicalStorageFailure: The state of the file is unknown. It could have been entirely destroyed. • kEncryptionFailed: The content of the file and the current position will have been updated, but could not be persisted. The persisted file will reflect an older version of the file. • kOutOfStorageSpace: The content of the file will have been updated, but the part of the operation that exceeded the quota will have been discarded. The current position will be at the end of the file.

ara::core::Result< void > WriteBinary (ara::core::Span< const ara::core::Byte > b) noexcept;
WriteText функция

Writes the content of a StringView to the file. The time when the content is persisted depends on the implementation of Persistency. SyncTo File can be used to force Persistency to persist the file content. In case of an error, the file content might be corrupted, and the current position might or might not have changed. The expected state of the file for each supported error can be expected to be as follows: • kPhysicalStorageFailure: The state of the file is unknown. It could have been entirely destroyed. • kEncryptionFailed: The content of the file and the current position will have been updated, but could not be persisted. The persisted file will reflect an older version of the file. • kOutOfStorageSpace: The content of the file will have been updated, but the part of the operation that exceeded the quota will have been discarded. The current position will be at the end of the file.

ara::core::Result< void > WriteText (ara::core::StringView s) noexcept;

Операторы

operator<< функция

Writes the content of a StringView to the file. This operator is just a comfort feature for non-safety critical Persistency users. If an error occurs during this operation, it is silently ignored.

WriteAccessor & operator<< (ara::core::StringView s) noexcept;

Документация методов

функция SetFileSize [SWS_PER_00428] Upstream: RS_PER_00001, RS_PER_00004, RS_AP_00119, RS_AP_00120, RS_ AP_00128, RS_AP_00127, RS_AP_00129, RS_AP_00135, RS_AP_00139, RS_AP_00159

ara::core::Result< void > SetFileSize (std::uint64_t size) noexcept;

Reduces the size of the file to ’size’, effectively removing the current content of the file beyond this size. The current file position is unchanged if it is lower than ’size’, or set to the last valid position in the file otherwise. If ’size’ is 0, the current file position will also be set to 0.

Header-Datei#include "ara/per/write_accessor.h"
Scopeclass ara::per::WriteAccessor
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe PerErrc::kPhysical no_rollback_semantics

Parameter (in)

ParameterBeschreibung
sizeNew size of the file.

Rückgabewert

TypBeschreibung
ara::core::Result< void >A Result of void. In case of an error, it contains any of the errors defined below, or a vendor specific error.

Fehler

FehlercodeBeschreibung
StorageFailureReturned if access to the physical storage fails.
PerErrc::kValidationFailedrollback_semantics Returned if the validity of stored data cannot be ensured.
PerErrc::kEncryptionFailedrollback_semantics Returned if the encryption or decryption of stored data fails.
PerErrc::kInvalidSizerollback_semantics Returned if the new size is larger than the current size.
PerErrc::kAuthenticationFailedrollback_semantics Returned if calculating or checking the MAC of stored data fails.

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

Record
AUTOSAR/AP/record/SWS_PER_00428
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00428@rel:R25-11#5035575e
Content hash
5035575e
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00428
Status: valid/unmigrated Version: rel:R25-11#ec5f6be0 Versionshistorie & Revisions (1 transition, 7 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_PER_00428@rel:R25-11#ec5f6be0
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#d8a624272026-09-30
  • R20-11rel:R20-11#695302e62026-10-14
  • R21-11rel:R21-11#aae1c4ab2026-10-14
  • R22-11rel:R22-11#3b63355b2026-10-14
  • R23-11rel:R23-11#4766ec6f2026-10-14
  • R24-11rel:R24-11#e7961eae2026-10-14
  • R25-11rel:R25-11#ec5f6be02026-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

функция SyncToFile [SWS_PER_00122] Upstream: RS_PER_00001, RS_PER_00004, RS_AP_00119, RS_AP_00120, RS_ AP_00128, RS_AP_00127, RS_AP_00129, RS_AP_00135, RS_AP_00139, RS_AP_00159

ara::core::Result< void > SyncToFile () noexcept;

Flushes the current file content to the physical storage.

СОЗДАНО ИИ не проверено Модель: gemini-3.8-flash-medium · Усилие: medium · Температура: не регулируется · Промпт: c625990570f3 Происхождение Открытые вопросы (1)
переведено с немецкого руководстваgemini-3.8-flash-low · 2026-10-13 · Немецкий оригинал

Функция-член SyncToFile класса ara::per::WriteAccessor (определенная в #include "ara/per/write_accessor.h") синхронно переносит текущее содержимое файла в физическое хранилище [SWS_PER_00122]. Вызов не принимает входных параметров и возвращает ara::core::Result<void>, которое в случае успеха пусто или в случае ошибки содержит специфические коды ошибок модуля Persistency либо ошибки, специфичные для поставщика [SWS_PER_00122].

При выполнении могут возникать различные случаи ошибок, часть из которых обладает семантикой отката [SWS_PER_00122]:

  • StorageFailure: возникает, если сбой физического доступа к носителю данных (без семантики отката) [SWS_PER_00122].
  • PerErrc::kOutOfStorageSpace: возвращается, если физического объема хранилища для измененного файла недостаточно (без семантики отката) [SWS_PER_00122].
  • PerErrc::kQuotaExceeded: сообщается, если файл превышает сконфигурированный максимальный размер AllowedSize хранилища File Storage (с семантикой отката) [SWS_PER_00122].
  • PerErrc::kEncryptionFailed: сбой шифрования сохраненных данных (с семантикой отката) [SWS_PER_00122].
  • PerErrc::kAuthenticationFailed: сбой вычисления MAC для данных (с семантикой отката) [SWS_PER_00122].

С точки зрения безопасности выполнения метод объявлен как noexcept и специфицирован как exception safe [SWS_PER_00122]. Однако, поскольку он явно классифицирован как not thread-safe, одновременные вызовы для одного и того же экземпляра WriteAccessor, вероятно, должны синхронизироваться вызывающей стороной [SWS_PER_00122]. Вопрос Q-e4b139f136cdcd31 (открытый)

Это указание по использованию было автоматически сгенерировано на основе спецификации AUTOSAR R25-11.

Header-Datei#include "ara/per/write_accessor.h"
Scopeclass ara::per::WriteAccessor
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe PerErrc::kPhysical no_rollback_semantics

Rückgabewert

TypBeschreibung
ara::core::Result< void >A Result of void. In case of an error, it contains any of the errors defined below, or a vendor specific error.

Fehler

FehlercodeBeschreibung
StorageFailureReturned if access to the physical storage fails.
PerErrc::kEncryptionFailedrollback_semantics Returned if the encryption of stored data fails.
PerErrc::kOutOfStorageSpaceno_rollback_semantics Returned if the available physical storage space is insufficient for the changed file.
PerErrc::kQuotaExceededrollback_semantics Returned if the changed file would exceed the configured maximum AllowedSize of the File Storage.
PerErrc::kAuthenticationFailedrollback_semantics Returned if calculating the MAC of stored data fails.

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

Record
AUTOSAR/AP/record/SWS_PER_00122
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00122@rel:R25-11#b39efc98
Content hash
b39efc98
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00122
Status: valid/unmigrated Version: rel:R25-11#3cd97c20 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_PER_00122@rel:R25-11#3cd97c20
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#34b017482026-09-30
  • R19-11rel:R19-11#eb696f922026-10-14
  • R20-11rel:R20-11#a1c7cb002026-10-14
  • R21-11rel:R21-11#02cbbcfc2026-10-14
  • R22-11rel:R22-11#e11db5d22026-10-14
  • R23-11rel:R23-11#90ba1ab02026-10-14
  • R24-11rel:R24-11#3320747f2026-10-14
  • R25-11rel:R25-11#3cd97c202026-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

функция WriteAccessor [SWS_PER_00596] Upstream: RS_PER_00004, RS_AP_00120, RS_AP_00129, RS_AP_00146

WriteAccessor ()=delete;

The default constructor for WriteAccessor shall not be used.

Header-Datei#include "ara/per/write_accessor.h"
Scopeclass ara::per::WriteAccessor

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

Record
AUTOSAR/AP/record/SWS_PER_00596
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00596@rel:R25-11#4513528b
Content hash
4513528b
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00596
Status: valid/unmigrated Version: rel:R25-11#e4de44c4 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/SWS_PER_00596@rel:R25-11#e4de44c4
Point-in-Time History:
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

функция WriteBinary [SWS_PER_00423] Upstream: RS_PER_00001, RS_PER_00004, RS_AP_00119, RS_AP_00120, RS_ AP_00121, RS_AP_00127, RS_AP_00135, RS_AP_00139, RS_AP_00159

ara::core::Result< void > WriteBinary (ara::core::Span< const ara::core::Byte > b) noexcept;

Writes the content of a Span of Byte to the file. The time when the content is persisted depends on the implementation of Persistency. SyncTo File can be used to force Persistency to persist the file content. In case of an error, the file content might be corrupted, and the current position might or might not have changed. The expected state of the file for each supported error can be expected to be as follows: • kPhysicalStorageFailure: The state of the file is unknown. It could have been entirely destroyed. • kEncryptionFailed: The content of the file and the current position will have been updated, but could not be persisted. The persisted file will reflect an older version of the file. • kOutOfStorageSpace: The content of the file will have been updated, but the part of the operation that exceeded the quota will have been discarded. The current position will be at the end of the file.

СОЗДАНО ИИ не проверено Модель: gemini-3.8-flash-medium · Усилие: medium · Температура: не регулируется · Промпт: 65db1acb87c9 Происхождение
переведено с немецкого руководстваgemini-3.8-flash-low · 2026-10-13 · Немецкий оригинал

Функция WriteBinary класса ara::per::WriteAccessor записывает содержимое последовательности байтов (ara::core::Span<const ara::core::Byte>) в файл [SWS_PER_00423]. Момент фактического сохранения на носителе данных зависит от реализации Persistency; с помощью SyncToFile можно форсировать синхронное сохранение [SWS_PER_00423]. Функция объявлена как noexcept и считается безопасной относительно исключений [SWS_PER_00423].

В отношении конкурентности WriteBinary специфицирована как непотокобезопасная (not thread-safe) [SWS_PER_00423]. Параллельные обращения к одному и тому же аксессору должны синхронизироваться на уровне приложения.

В случае ошибки код ошибки возвращается в ara::core::Result<void>, при этом содержимое файла может быть повреждено, а текущая позиция может измениться [SWS_PER_00423]:

  • PerErrc::kPhysicalStorageFailure: состояние файла неизвестно и он может быть полностью разрушен (отсутствует семантика отката) [SWS_PER_00423].
  • PerErrc::kOutOfStorageSpace: недостаточно физической памяти; данные, выходящие за пределы квоты, отбрасываются, а позиция файла находится в конце [SWS_PER_00423].
  • PerErrc::kQuotaExceeded: операция записи превысила бы сконфигурированный максимальный размер AllowedSize [SWS_PER_00423].
  • PerErrc::kEncryptionFailed: сбой шифрования; содержимое файла и позиция обновляются, но не сохраняются (сохраненный файл сохраняет предыдущую версию) [SWS_PER_00423].
  • PerErrc::kAuthenticationFailed или PerErrc::kValidationFailed: сбой вычисления/проверки MAC либо валидность сохраненных данных не гарантируется [SWS_PER_00423].

Данное указание по использованию было сгенерировано автоматически на основе элемента спецификации [SWS_PER_00423].

Руководство разработчика реализации в подготовке (сложность I1)

Header-Datei#include "ara/per/write_accessor.h"
Scopeclass ara::per::WriteAccessor
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe PerErrc::kPhysical no_rollback_semantics

Parameter (in)

ParameterBeschreibung
bA Span of Byte containing the bytes to be written.

Rückgabewert

TypBeschreibung
ara::core::Result< void >A Result of void. In case of an error, it contains any of the errors defined below, or a vendor specific error.

Fehler

FehlercodeBeschreibung
StorageFailureReturned if access to the physical storage fails.
PerErrc::kValidationFailedrollback_semantics Returned if the validity of stored data cannot be ensured.
PerErrc::kEncryptionFailedrollback_semantics Returned if the encryption or decryption of stored data fails.
PerErrc::kOutOfStorageSpaceno_rollback_semantics Returned if the available physical storage space is insufficient for the changed file.
PerErrc::kQuotaExceededrollback_semantics Returned if the changed file would exceed the configured maximum AllowedSize of the File Storage.
PerErrc::kAuthenticationFailedrollback_semantics Returned if calculating or checking the MAC of stored data fails.

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

Record
AUTOSAR/AP/record/SWS_PER_00423
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00423@rel:R25-11#f7356cf1
Content hash
f7356cf1
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00423
Status: valid/unmigrated Version: rel:R25-11#6fdad6e9 Versionshistorie & Revisions (1 transition, 7 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_PER_00423@rel:R25-11#6fdad6e9
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#998ae4662026-09-30
  • R20-11rel:R20-11#e69bb1c32026-10-14
  • R21-11rel:R21-11#cbf9c5262026-10-14
  • R22-11rel:R22-11#1ed9b43a2026-10-14
  • R23-11rel:R23-11#a70520942026-10-14
  • R24-11rel:R24-11#7f59ce5a2026-10-14
  • R25-11rel:R25-11#6fdad6e92026-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

функция WriteText [SWS_PER_00166] Upstream: RS_PER_00001, RS_PER_00004, RS_AP_00119, RS_AP_00120, RS_ AP_00121, RS_AP_00127, RS_AP_00135, RS_AP_00136, RS_AP_00139, RS_AP_00159

ara::core::Result< void > WriteText (ara::core::StringView s) noexcept;

Writes the content of a StringView to the file. The time when the content is persisted depends on the implementation of Persistency. SyncTo File can be used to force Persistency to persist the file content. In case of an error, the file content might be corrupted, and the current position might or might not have changed. The expected state of the file for each supported error can be expected to be as follows: • kPhysicalStorageFailure: The state of the file is unknown. It could have been entirely destroyed. • kEncryptionFailed: The content of the file and the current position will have been updated, but could not be persisted. The persisted file will reflect an older version of the file. • kOutOfStorageSpace: The content of the file will have been updated, but the part of the operation that exceeded the quota will have been discarded. The current position will be at the end of the file.

СОЗДАНО ИИ не проверено Модель: gemini-3.8-flash-medium · Усилие: medium · Температура: не регулируется · Промпт: f24ce7c436f3 Происхождение Открытые вопросы (1)
переведено с немецкого руководстваgemini-3.8-flash-low · 2026-10-13 · Немецкий оригинал

Использование

Синхронный метод WriteText интерфейса ara::per::WriteAccessor записывает содержимое ara::core::StringView в открытый файл [SWS_PER_00166]. Функция специфицирована как исключениебезопасная (exception safe) и декларирует отсутствие генерации исключений C++ (noexcept) [SWS_PER_00166]. Точный момент физического сохранения зависит от реализации Persistency; немедленное сохранение на носитель данных может быть принудительно выполнено через SyncToFile [SWS_PER_00166].

Обработка ошибок

В качестве возвращаемого значения служит ara::core::Result<void>, сообщающее в случае ошибки коды ошибок из PerErrc или ошибки, специфичные для поставщика [SWS_PER_00166]. При сбое операции содержимое файла может быть повреждено, а позиция записи изменена [SWS_PER_00166]:

  • PerErrc::kPhysicalStorageFailure: сбой физического доступа к памяти; состояние файла неизвестно или файл поврежден [SWS_PER_00166].
  • PerErrc::kEncryptionFailed: сбой шифрования; содержимое файла и позиция в памяти обновляются, но не могут быть сохранены, из-за чего сохраняется более старая сохраненная версия [SWS_PER_00166].
  • PerErrc::kOutOfStorageSpace: недостаточно физического пространства памяти; данные сверх квоты отбрасываются, и позиция находится в конце файла [SWS_PER_00166].
  • PerErrc::kQuotaExceeded, PerErrc::kValidationFailed и PerErrc::kAuthenticationFailed: сообщают о превышении квоты (AllowedSize), а также об ошибках валидации или аутентификации с сохранением семантики отката (rollback) [SWS_PER_00166].

Параллелизм и ограничения

Операция классифицирована как непотокобезопасная (not thread-safe) [SWS_PER_00166]. При параллельном доступе к одному и тому же экземпляру WriteAccessor вызывающим сторонам, по-видимому, необходимо самостоятельно синхронизировать вызовы. Вопрос Q-73a6dbdb7d3df643 (открытый)

Это указание по использованию основано на спецификации AUTOSAR Adaptive Platform R25-11.

Руководство разработчика реализации в подготовке (сложность I1)

Header-Datei#include "ara/per/write_accessor.h"
Scopeclass ara::per::WriteAccessor
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe PerErrc::kPhysical no_rollback_semantics

Parameter (in)

ParameterBeschreibung
sA StringView containing the characters to be written.

Rückgabewert

TypBeschreibung
ara::core::Result< void >A Result of void. In case of an error, it contains any of the errors defined below, or a vendor specific error.

Fehler

FehlercodeBeschreibung
StorageFailureReturned if access to the physical storage fails.
PerErrc::kValidationFailedrollback_semantics Returned if the validity of stored data cannot be ensured.
PerErrc::kEncryptionFailedrollback_semantics Returned if the encryption or decryption of stored data fails.
PerErrc::kOutOfStorageSpaceno_rollback_semantics Returned if the available physical storage space is insufficient for the changed file.
PerErrc::kQuotaExceededrollback_semantics Returned if the changed file would exceed the configured maximum AllowedSize of the File Storage.
PerErrc::kAuthenticationFailedrollback_semantics Returned if calculating or checking the MAC of stored data fails.

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

Record
AUTOSAR/AP/record/SWS_PER_00166
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00166@rel:R25-11#1ec8de5c
Content hash
1ec8de5c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00166
Status: valid/unmigrated Version: rel:R25-11#4e3c0698 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_PER_00166@rel:R25-11#4e3c0698
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#d1e8d7c42026-09-30
  • R19-11rel:R19-11#b4195f8c2026-10-14
  • R20-11rel:R20-11#c28d17da2026-10-14
  • R21-11rel:R21-11#18edcb3e2026-10-14
  • R22-11rel:R22-11#c7bb41a02026-10-14
  • R23-11rel:R23-11#e3cd60ee2026-10-14
  • R24-11rel:R24-11#604776402026-10-14
  • R25-11rel:R25-11#4e3c06982026-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

функция operator<< [SWS_PER_00125] Upstream: RS_PER_00001, RS_PER_00004, RS_AP_00119, RS_AP_00120, RS_ AP_00121, RS_AP_00127, RS_AP_00159

WriteAccessor & operator<< (ara::core::StringView s) noexcept;

Writes the content of a StringView to the file. This operator is just a comfort feature for non-safety critical Persistency users. If an error occurs during this operation, it is silently ignored.

Header-Datei#include "ara/per/write_accessor.h"
Scopeclass ara::per::WriteAccessor
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Parameter (in)

ParameterBeschreibung
sThe StringView containing the characters to be written.

Rückgabewert

TypBeschreibung
WriteAccessor &The WriteAccessor object.

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

Record
AUTOSAR/AP/record/SWS_PER_00125
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00125@rel:R25-11#a4853073
Content hash
a4853073
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00125
Status: valid/unmigrated Version: rel:R25-11#916de40e 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_PER_00125@rel:R25-11#916de40e
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#8b2877cf2026-09-30
  • R19-11rel:R19-11#400a0ec52026-10-14
  • R20-11rel:R20-11#fe7ae1572026-10-14
  • R21-11rel:R21-11#fe7ae1572026-10-14
  • R22-11rel:R22-11#7a940c0b2026-10-14
  • R23-11rel:R23-11#01a269a42026-10-14
  • R24-11rel:R24-11#d4351b602026-10-14
  • R25-11rel:R25-11#916de40e2026-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

функция ~WriteAccessor [SWS_PER_00597] Upstream: RS_PER_00004, RS_AP_00120, RS_AP_00129, RS_AP_00134, RS_AP_00145, RS_AP_00159

~WriteAccessor () override noexcept;

Destructor for WriteAccessor.

Header-Datei#include "ara/per/write_accessor.h"
Scopeclass ara::per::WriteAccessor
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

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

Record
AUTOSAR/AP/record/SWS_PER_00597
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00597@rel:R25-11#01533cb0
Content hash
01533cb0
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00597
Status: valid/unmigrated Version: rel:R25-11#0c1fc20b 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/SWS_PER_00597@rel:R25-11#0c1fc20b
Point-in-Time History:
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