DEENESPTFRRUARHIKOZHNL

classe 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

Guia do utilizadorGERADO POR IA

Serve para a escrita com memória intermédia de ficheiros binários e de texto, bem como para a sua sincronização com o armazenamento físico.
GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: fd57dd10b948 Procedência Perguntas em aberto (1)
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

Serve para a escrita com memória intermédia de ficheiros binários e de texto, bem como para a sua sincronização com o armazenamento físico.

A classe ara::per::WriteAccessor permite a escrita de conteúdos de ficheiros binários ou textuais no módulo de persistência e disponibiliza métodos para acessos de escrita não formatados, bem como um operador de fluxo formatado [SWS_PER_00423]. Dado que as operações de escrita podem ser inicialmente colocadas em memória intermédia no sistema operativo, a chamada de SyncToFile() força a escrita permanente (flush) no armazenamento físico [SWS_PER_00122]. Todos os métodos são seguros contra exceções, mas não seguros para threads, razão pela qual os acessos concorrentes devem ser protegidos pela aplicação.

Contexto

ara::per::WriteAccessor é uma classe final do módulo de persistência (per) da AUTOSAR Adaptive Platform e deriva virtualmente de FileAccessor. A classe disponibiliza operações de escrita para conteúdos de ficheiros. Oferece métodos para escrita não formatada e controlada com tratamento de erros através de ara::core::Result, bem como um operador de fluxo sobrecarregado para escrita formatada. Como parceiros de interação atuam a aplicação chamadora, a memória intermédia interna de ficheiros do sistema operativo e o suporte de armazenamento físico.

Ciclo de vida

O construtor padrão de WriteAccessor está explicitamente eliminado e não pode ser utilizado [SWS_PER_00596]. (Interpretação: as instâncias de WriteAccessor deverão ser criadas e disponibilizadas através de métodos de fábrica de entidades de gestão de persistência de nível superior, como o armazenamento de ficheiros.) Pergunta Q-af92be8494274611 (aberta)

A destruição ocorre através do destruidor virtual ~WriteAccessor() [SWS_PER_00597]. A classe e os seus métodos estão especificados como seguros contra exceções (“exception safe”) e declarados como noexcept. No que diz respeito à concorrência, WriteAccessor não é seguro para threads (“not thread-safe”) [SWS_PER_00597]; os acessos paralelos à mesma instância têm de ser protegidos externamente pela aplicação.

Caminho de utilização

O fluxo regular inclui a escrita de dados em modo não formatado ou formatado, o ajuste opcional do tamanho do ficheiro e o armazenamento persistente final:

  • Escrever dados binários: através de WriteBinary(), um intervalo de bytes (ara::core::Span<const ara::core::Byte>) é escrito no ficheiro [SWS_PER_00423].
  • Escrever dados de texto: através de WriteText(), as cadeias de carateres são passadas através de um ara::core::StringView [SWS_PER_00166]. Complementarmente, operator<< está disponível como função de conveniência para casos de utilização não críticos, sendo os erros ocorridos ignorados silenciosamente [SWS_PER_00125].
  • Forçar persistência: o momento do armazenamento físico depende da implementação da persistência; SyncToFile() descarrega (flashes) a memória intermédia do sistema operativo de forma vinculativa para o suporte de armazenamento [SWS_PER_00122], [SWS_PER_00423], [SWS_PER_00166].
  • Ajustar tamanho do ficheiro: com SetFileSize(), o ficheiro pode ser truncado, sendo os conteúdos excedentes removidos; a posição no ficheiro permanece inalterada ou é definida para a última posição válida ou 0 [SWS_PER_00428].
Fluxo típico na gravação e sincronização de conteúdos de arquivosAplicaçãoWriteAccessorSpeichermediumWriteBinary(b) / WriteText(s)ara::core::Result<void>SyncToFile()Betriebssystem-Puffer flashenStatus / confirmaçãoara::core::Result<void>

Diagrama de sequência: operações de escrita com subsequente sincronização com o armazenamento físico. Fontes: [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122]

Cenários de erro

Os métodos WriteBinary(), WriteText(), SyncToFile() e SetFileSize() retornam um ara::core::Result<void> que, em caso de falha, contém códigos de erro específicos:

Este guia foi gerado por uma IA com base na especificação AUTOSAR R25-11.

Mapa de membros

Diagrama de classes

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

Vista de detalhes

Selecione uma entrada no índice.

Construtores e destrutor

WriteAccessor função

The default constructor for WriteAccessor shall not be used.

WriteAccessor ()=delete;

Destructor for WriteAccessor.

~WriteAccessor () override noexcept;

Métodos

SetFileSize função

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 função

Flushes the current file content to the physical storage.

ara::core::Result< void > SyncToFile () noexcept;
WriteBinary função

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 função

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;

Operadores

operator<< função

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;

Documentação dos métodos

função 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#05099c55
Content hash
05099c55
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

função 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.

GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: c625990570f3 Procedência Perguntas em aberto (1)
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

A função-membro SyncToFile da classe ara::per::WriteAccessor (definida em #include "ara/per/write_accessor.h") transfere o conteúdo atual do ficheiro sincronamente para o armazenamento físico [SWS_PER_00122]. A chamada não recebe parâmetros de entrada e devolve um ara::core::Result<void> que, em caso de sucesso, está vazio ou, em caso de erro, contém códigos de erro específicos do módulo Persistency ou erros específicos do fabricante [SWS_PER_00122].

Durante a execução podem ocorrer diferentes casos de erro, alguns dos quais possuem semântica de rollback [SWS_PER_00122]:

  • StorageFailure: ocorre quando o acesso físico ao meio de armazenamento falha (sem semântica de rollback) [SWS_PER_00122].
  • PerErrc::kOutOfStorageSpace: é devolvido caso o espaço de armazenamento físico seja insuficiente para o ficheiro modificado (sem semântica de rollback) [SWS_PER_00122].
  • PerErrc::kQuotaExceeded: é reportado quando o ficheiro excede o tamanho máximo configurado AllowedSize do File Storage (com semântica de rollback) [SWS_PER_00122].
  • PerErrc::kEncryptionFailed: se a encriptação dos dados armazenados falhar (com semântica de rollback) [SWS_PER_00122].
  • PerErrc::kAuthenticationFailed: se o cálculo do MAC para os dados falhar (com semântica de rollback) [SWS_PER_00122].

No que diz respeito à segurança de execução, o método está declarado como noexcept e especificado como exception safe [SWS_PER_00122]. No entanto, como está expressamente classificado como not thread-safe, chamadas simultâneas na mesma instância de WriteAccessor devem provavelmente ser sincronizadas pelo chamador [SWS_PER_00122]. Pergunta Q-e4b139f136cdcd31 (aberta)

Esta nota de uso foi gerada automaticamente com base na especificação 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#e5645710
Content hash
e5645710
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

função 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#e67f4e25
Content hash
e67f4e25
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

função 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.

GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: 65db1acb87c9 Procedência
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

A função WriteBinary da classe ara::per::WriteAccessor escreve o conteúdo de uma sequência de bytes (ara::core::Span<const ara::core::Byte>) num ficheiro [SWS_PER_00423]. O momento da persistência efetiva no meio de armazenamento depende da implementação do Persistency; através de SyncToFile pode forçar-se a persistência síncrona [SWS_PER_00423]. A função está declarada como noexcept e é considerada segura contra exceções [SWS_PER_00423].

No que diz respeito à concorrência, WriteBinary está especificado como não seguro para threads (not thread-safe) [SWS_PER_00423]. Acessos paralelos ao mesmo acessor têm de ser sincronizados ao nível da aplicação.

Em caso de erro, é devolvido um código de erro em ara::core::Result<void>, podendo o conteúdo do ficheiro ficar danificado e a posição atual ter-se alterado [SWS_PER_00423]:

  • PerErrc::kPhysicalStorageFailure: o estado do ficheiro é desconhecido e este pode estar completamente destruído (sem semântica de rollback) [SWS_PER_00423].
  • PerErrc::kOutOfStorageSpace: espaço físico insuficiente; os dados que excedam a quota são descartados e a posição do ficheiro fica no fim [SWS_PER_00423].
  • PerErrc::kQuotaExceeded: a operação de escrita excederia o tamanho máximo configurado AllowedSize [SWS_PER_00423].
  • PerErrc::kEncryptionFailed: a encriptação falha; o conteúdo e a posição do ficheiro são atualizados, mas não persistidos (o ficheiro persistido mantém a versão anterior) [SWS_PER_00423].
  • PerErrc::kAuthenticationFailed ou PerErrc::kValidationFailed: o cálculo/verificação do MAC falha ou a validade dos dados armazenados não é garantida [SWS_PER_00423].

Esta nota de utilização foi gerada de forma automatizada com base no elemento de especificação [SWS_PER_00423].

Guia do implementador em breve (complexidade 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#c2f44dda
Content hash
c2f44dda
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

função 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.

GERADO POR IA não revisado Modelo: gemini-3.8-flash-medium · Esforço: medium · Temperatura: não controlável · Prompt: f24ce7c436f3 Procedência Perguntas em aberto (1)
traduzido do guia alemãogemini-3.8-flash-low · 2026-10-13 · Original em alemão

usar

O método síncrono WriteText da interface ara::per::WriteAccessor escreve o conteúdo de uma ara::core::StringView no ficheiro aberto [SWS_PER_00166]. A função está especificada como segura contra exceções (exception safe) e não declara o lançamento de exceções C++ (noexcept) [SWS_PER_00166]. O momento exato do armazenamento físico depende da implementação do Persistency; uma gravação imediata no meio de armazenamento pode ser forçada através de SyncToFile [SWS_PER_00166].

Tratamento de erros

Como valor de retorno serve um ara::core::Result<void>, que em caso de erro reporta códigos de erro de PerErrc ou erros específicos do fabricante [SWS_PER_00166]. Se a operação falhar, o conteúdo do ficheiro pode ficar corrompido e a posição de escrita pode ter sido alterada [SWS_PER_00166]:

  • PerErrc::kPhysicalStorageFailure: falha no acesso ao armazenamento físico; o estado do ficheiro é desconhecido ou o ficheiro está destruído [SWS_PER_00166].
  • PerErrc::kEncryptionFailed: a encriptação falha; o conteúdo do ficheiro e a posição na memória são atualizados, mas não podem ser persistidos, permanecendo uma versão persistida mais antiga [SWS_PER_00166].
  • PerErrc::kOutOfStorageSpace: espaço de armazenamento físico insuficiente; os dados além da quota são descartados e a posição fica no fim do ficheiro [SWS_PER_00166].
  • PerErrc::kQuotaExceeded, PerErrc::kValidationFailed e PerErrc::kAuthenticationFailed: reportam excessos de quota (AllowedSize), bem como erros de validação ou de autenticação, mantendo a semântica de rollback [SWS_PER_00166].

Simultaneidade e restrições

A operação está classificada como não segura para threads (not thread-safe) [SWS_PER_00166]. Em caso de acessos paralelos à mesma instância de WriteAccessor, os chamadores terão provavelmente de sincronizar as chamadas de forma autónoma. Pergunta Q-73a6dbdb7d3df643 (aberta)

Esta nota de uso baseia-se na especificação AUTOSAR Adaptive Platform R25-11.

Guia do implementador em breve (complexidade 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#cb3040e5
Content hash
cb3040e5
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

função 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#d46dea4c
Content hash
d46dea4c
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

função ~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#a989b585
Content hash
a989b585
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