DEENESPTFRRUARHIKOZHNL

class 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

User GuideKI-GENERIERT

Dient dem gepufferten Schreiben von Binär- und Textdateien sowie deren Synchronisation auf den physischen Speicher.
KI-GENERIERT ungeprüft Modell: gemini-3.8-flash-medium · Aufwand: medium · Temperatur: nicht steuerbar · Prompt: fd57dd10b948 Herkunft Offene Fragen (1)
KI-generiertgemini-3.8-flash-medium · 2026-10-13

Dient dem gepufferten Schreiben von Binär- und Textdateien sowie deren Synchronisation auf den physischen Speicher.

Die Klasse ara::per::WriteAccessor ermöglicht das Schreiben binärer oder textueller Dateiinhalte im Persistenzmodul und stellt Methoden für unformatierte Schreibzugriffe sowie einen formatierten Stream-Operator bereit [SWS_PER_00423]. Da Schreibvorgänge zunächst im Betriebssystem gepuffert werden können, erzwingt der Aufruf von SyncToFile() das dauerhafte Flashen auf den physischen Speicher [SWS_PER_00122]. Sämtliche Methoden sind ausnahmesicher, jedoch nicht threadsicher, weshalb nebenläufige Zugriffe durch die Anwendung geschützt werden müssen.

Kontext

ara::per::WriteAccessor ist eine finale Klasse des Persistenzmoduls (per) der AUTOSAR Adaptive Platform und leitet virtuell von FileAccessor ab. Die Klasse stellt Schreiboperationen für Dateiinhalte bereit. Sie bietet Methoden für unformatiertes, kontrolliertes Schreiben mit Fehlerbehandlung über ara::core::Result sowie einen überladenen Stream-Operator für formatiertes Schreiben. Als Interaktionspartner fungieren die aufrufende Anwendung, der interne Dateipuffer des Betriebssystems sowie das physische Speichermedium.

Lebenszyklus

Der Standardkonstruktor von WriteAccessor ist explizit gelöscht und darf nicht verwendet werden [SWS_PER_00596]. (Interpretation: Instanzen von WriteAccessor dürften über Fabrikmethoden übergeordneter Persistenz-Verwaltungseinheiten wie dem File-Storage erzeugt und bereitgestellt werden.) Frage Q-af92be8494274611 (offen)

Die Zerstörung erfolgt über den virtuellen Destruktor ~WriteAccessor() [SWS_PER_00597]. Die Klasse und ihre Methoden sind als ausnahmesicher („exception safe“) spezifiziert und als noexcept deklariert. Bezüglich der Nebenläufigkeit ist WriteAccessor nicht threadsicher („not thread-safe“) [SWS_PER_00597]; parallele Zugriffe auf dieselbe Instanz müssen von der Anwendung extern abgesichert werden.

Nutzungspfad

Der reguläre Ablauf umfasst das Schreiben von Daten in unformatiertem oder formatiertem Modus, das optionale Anpassen der Dateigröße und die abschließende persistente Speicherung:

  • Binärdaten schreiben: Über WriteBinary() wird ein Byte-Bereich (ara::core::Span<const ara::core::Byte>) in die Datei geschrieben [SWS_PER_00423].
  • Textdaten schreiben: Mittels WriteText() werden Zeichenketten über einen ara::core::StringView übergeben [SWS_PER_00166]. Ergänzend steht operator<< als Komfortfunktion für unkritische Anwendungsfälle zur Verfügung, wobei auftretende Fehler stillschweigend ignoriert werden [SWS_PER_00125].
  • Persistierung erzwingen: Der Zeitpunkt der physischen Speicherung hängt von der Persistenz-Implementierung ab; SyncToFile() flasht den Puffer des Betriebssystems verbindlich auf das Speichermedium [SWS_PER_00122], [SWS_PER_00423], [SWS_PER_00166].
  • Dateigröße anpassen: Mit SetFileSize() kann die Datei verkürzt werden, wodurch überstehende Inhalte entfernt werden; die Dateiposition bleibt unverändert oder wird auf die letzte gültige Position bzw. 0 gesetzt [SWS_PER_00428].
Typischer Ablauf beim Schreiben und Synchronisieren von DateiinhaltenAnwendungWriteAccessorSpeichermediumWriteBinary(b) / WriteText(s)ara::core::Result<void>SyncToFile()Betriebssystem-Puffer flashenStatus / Bestätigungara::core::Result<void>

Sequenzdiagramm: Schreiboperationen mit anschließender Synchronisation auf den physischen Speicher. Quellen: [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122]

Fehlerszenarien

Die Methoden WriteBinary(), WriteText(), SyncToFile() und SetFileSize() geben ein ara::core::Result<void> zurück, das bei Fehlschlägen spezifische Fehlercodes enthält:

Dieser Leitfaden wurde durch eine KI auf Basis der AUTOSAR-Spezifikation R25-11 generiert.

Mitgliederkarte

Klassendiagramm

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

Detailansicht

Wähle in der Gliederung einen Eintrag aus.

Konstruktoren und Destruktor

WriteAccessor function

The default constructor for WriteAccessor shall not be used.

WriteAccessor ()=delete;

Destructor for WriteAccessor.

~WriteAccessor () override noexcept;

Methoden

SetFileSize function

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 function

Flushes the current file content to the physical storage.

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

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 function

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;

Operatoren

operator<< function

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;

Dokumentation der Methoden

function 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#d8a62427
Content hash
d8a62427
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

function 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.

KI-GENERIERT ungeprüft Modell: gemini-3.8-flash-medium · Aufwand: medium · Temperatur: nicht steuerbar · Prompt: c625990570f3 Herkunft Offene Fragen (1)
KI-generiertgemini-3.8-flash-medium · 2026-10-13

Die Memberfunktion SyncToFile der Klasse ara::per::WriteAccessor (definiert in #include "ara/per/write_accessor.h") überträgt den aktuellen Dateiinhalt synchron auf den physischen Speicher [SWS_PER_00122]. Der Aufruf nimmt keine Übergabeparameter entgegen und gibt ein ara::core::Result<void> zurück, das im Erfolgsfall leer ist oder im Fehlerfall spezifische Fehlercodes des Persistency-Moduls bzw. herstellerspezifische Fehler enthält [SWS_PER_00122].

Bei der Durchführung können unterschiedliche Fehlerfälle auftreten, die teilweise Rollback-Semantik besitzen [SWS_PER_00122]:

  • StorageFailure: Tritt auf, wenn der physische Zugriff auf das Speichermedium fehlschlägt (keine Rollback-Semantik) [SWS_PER_00122].
  • PerErrc::kOutOfStorageSpace: Wird zurückgegeben, falls der physische Speicherplatz für die geänderte Datei unzureichend ist (keine Rollback-Semantik) [SWS_PER_00122].
  • PerErrc::kQuotaExceeded: Wird gemeldet, wenn die Datei die konfigurierte Maximalgröße AllowedSize des File Storage überschreitet (mit Rollback-Semantik) [SWS_PER_00122].
  • PerErrc::kEncryptionFailed: Scheitert die Verschlüsselung der gespeicherten Daten (mit Rollback-Semantik) [SWS_PER_00122].
  • PerErrc::kAuthenticationFailed: Schlägt die Berechnung des MAC für die Daten fehl (mit Rollback-Semantik) [SWS_PER_00122].

Hinsichtlich der Ausführungssicherheit ist die Methode als noexcept deklariert und als exception safe spezifiziert [SWS_PER_00122]. Da sie jedoch ausdrücklich als not thread-safe eingestuft ist, müssen gleichzeitige Aufrufe auf derselben WriteAccessor-Instanz vermutlich durch den Aufrufer synchronisiert werden [SWS_PER_00122]. Frage Q-e4b139f136cdcd31 (offen)

Dieser Nutzungshinweis wurde automatisiert auf Basis der Spezifikation AUTOSAR R25-11 generiert.

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#34b01748
Content hash
34b01748
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

function 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#e4de44c4
Content hash
e4de44c4
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

function 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.

KI-GENERIERT ungeprüft Modell: gemini-3.8-flash-medium · Aufwand: medium · Temperatur: nicht steuerbar · Prompt: 65db1acb87c9 Herkunft
KI-generiertgemini-3.8-flash-medium · 2026-10-13

Die Funktion WriteBinary der Klasse ara::per::WriteAccessor schreibt den Inhalt einer Byte-Sequenz (ara::core::Span<const ara::core::Byte>) in eine Datei [SWS_PER_00423]. Der Zeitpunkt der tatsächlichen Persistierung auf dem Speichermedium hängt von der Implementierung von Persistency ab; über SyncToFile kann das synchrone Persistieren forciert werden [SWS_PER_00423]. Die Funktion ist als noexcept deklariert und gilt als ausnahmesicher [SWS_PER_00423].

In Bezug auf Nebenläufigkeit ist WriteBinary als nicht threadsicher (not thread-safe) spezifiziert [SWS_PER_00423]. Parallele Zugriffe auf denselben Accessor müssen auf Anwendungsebene synchronisiert werden.

Im Fehlerfall wird ein Fehlercode in ara::core::Result<void> zurückgegeben, wobei der Dateiinhalt beschädigt sein und sich die aktuelle Position verändert haben kann [SWS_PER_00423]:

  • PerErrc::kPhysicalStorageFailure: Zustand der Datei ist unbekannt und kann vollständig zerstört sein (keine Rollback-Semantik) [SWS_PER_00423].
  • PerErrc::kOutOfStorageSpace: Unzureichender physischer Speicher; über die Quote hinausgehende Daten werden verworfen und die Dateiposition steht am Ende [SWS_PER_00423].
  • PerErrc::kQuotaExceeded: Der Schreibvorgang würde die konfigurierte Maximalgröße AllowedSize überschreiten [SWS_PER_00423].
  • PerErrc::kEncryptionFailed: Verschlüsselung schlägt fehl; Dateiinhalt und Position werden aktualisiert, aber nicht persistiert (persistierte Datei behält Vorversion) [SWS_PER_00423].
  • PerErrc::kAuthenticationFailed bzw. PerErrc::kValidationFailed: MAC-Berechnung/-Prüfung schlägt fehl oder die Validität gespeicherter Daten ist nicht gewährleistet [SWS_PER_00423].

Dieser Nutzungshinweis wurde automatisiert auf Basis von Spezifikationselement [SWS_PER_00423] generiert.

Implementer's Guide folgt (Komplexität 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#998ae466
Content hash
998ae466
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

function 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.

KI-GENERIERT ungeprüft Modell: gemini-3.8-flash-medium · Aufwand: medium · Temperatur: nicht steuerbar · Prompt: f24ce7c436f3 Herkunft Offene Fragen (1)
KI-generiertgemini-3.8-flash-medium · 2026-10-13

Verwendung

Die synchrone Methode WriteText der Schnittstelle ara::per::WriteAccessor schreibt den Inhalt eines ara::core::StringView in die geöffnete Datei [SWS_PER_00166]. Die Funktion ist als ausnahmesicher (exception safe) spezifiziert und deklariert kein Werfen von C++-Ausnahmen (noexcept) [SWS_PER_00166]. Der exakte Zeitpunkt der physischen Speicherung hängt von der Persistency-Implementierung ab; eine unmittelbare Sicherung auf das Speichermedium kann über SyncToFile forciert werden [SWS_PER_00166].

Fehlerbehandlung

Als Rückgabewert dient ein ara::core::Result<void>, das im Fehlerfall Fehlercodes aus PerErrc oder herstellerspezifische Fehler meldet [SWS_PER_00166]. Schlägt die Operation fehl, kann der Dateiinhalt beschädigt sein und die Schreibposition verändert worden sein [SWS_PER_00166]:

  • PerErrc::kPhysicalStorageFailure: Physischer Speicherzugriff fehlgeschlagen; der Dateizustand ist unbekannt oder die Datei zerstört [SWS_PER_00166].
  • PerErrc::kEncryptionFailed: Verschlüsselung schlägt fehl; Dateiinhalt und Position im Speicher werden aktualisiert, können aber nicht persistiert werden, wodurch ein älterer persistierter Stand verbleibt [SWS_PER_00166].
  • PerErrc::kOutOfStorageSpace: Unzureichender physischer Speicherplatz; Daten über die Quote hinaus werden verworfen und die Position liegt am Dateiende [SWS_PER_00166].
  • PerErrc::kQuotaExceeded, PerErrc::kValidationFailed und PerErrc::kAuthenticationFailed: Melden Quotenüberschreitungen (AllowedSize) sowie Validierungs- oder Authentifizierungsfehler unter Wahrung von Rollback-Semantik [SWS_PER_00166].

Nebenläufigkeit und Einschränkungen

Die Operation ist als nicht threadsicher (not thread-safe) eingestuft [SWS_PER_00166]. Bei parallelen Zugriffen auf dieselbe Instanz von WriteAccessor müssen Aufrufer die Aufrufe vermutlich eigenständig synchronisieren. Frage Q-73a6dbdb7d3df643 (offen)

Dieser Nutzungshinweis basiert auf der Spezifikation AUTOSAR Adaptive Platform R25-11.

Implementer's Guide folgt (Komplexität 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#d1e8d7c4
Content hash
d1e8d7c4
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

function 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#8b2877cf
Content hash
8b2877cf
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

function ~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#0c1fc20b
Content hash
0c1fc20b
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