DEENESPTFRRUARHIKOZHNL

class ara::core::Bitset::reference

[SWS_CORE_01759]

class reference {...};

Implements std::bitset::reference type from [bitset]

Header-Datei#include "ara/core/bitset.h"
Forwarding-Header#include "ara/core/core_fwd.h"
Scopeclass ara::core::Bitset

User GuideAI-GENERATED

Serves as a proxy object for write access and the inversion of individual bits in a bitset.
AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 9b7177bcd0af Provenance Open questions (3)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Serves as a proxy object for write access and the inversion of individual bits in a bitset.

The helper class ara::core::Bitset::reference acts as a proxy type for lvalue-like access to individual bits of a ara::core::Bitset. It enables the targeted modification of the referenced bit value, in particular its inversion via member function flip() according to [SWS_CORE_01712]. By declaring flip() as noexcept, the operation is guaranteed to be exception-safe [SWS_CORE_01712]. As an essential constraint, the proxy object, according to interpretation, remains valid only during the lifetime of the enclosing container.

Context

Within module core of the AUTOSAR Adaptive Platform, the nested helper class ara::core::Bitset::reference acts as a proxy object for accessing individual bits in a ara::core::Bitset. Since individual bits do not have an independent memory address in the C++ type system and thus cannot be represented directly as a native reference (bool&), reference implements the concept of std::bitset::reference from the C++ standard [bitset]. The class serves as an intermediary between the calling code and the internal bit storage of the container ara::core::Bitset. It allows developers to treat an individual bit syntactically and semantically like a modifiable reference by directly mapping operations on the proxy to the underlying bit in the bitset. An essential component of this interface is the member function flip() according to [SWS_CORE_01712], which provides a direct state inversion of the addressed bit.

Lifecycle

Instances of ara::core::Bitset::reference typically have a short-lived character. According to interpretation, creation does not occur as a free-standing object by the application developer, but is initiated internally by the non-const access mechanisms of the container ara::core::Bitset when an lvalue access to a specific bit position is requested. The created proxy object logically binds to the specific bit position and the underlying memory region of the container. The lifetime of the reference instance is thus strictly coupled to the existence of the enclosing Bitset object: If the referenced Bitset is destroyed or its memory becomes invalid, subsequent access via the proxy object presumably leads to undefined behavior (dangling reference). Question Q-44ce3478c9a2d987 (open) After completing operations such as bit inversion via flip() according to [SWS_CORE_01712], the temporary object is usually discarded immediately. Regarding concurrency, it should be noted that concurrent write accesses to different or identical bits of the same container via separate reference instances without external synchronization are presumably not thread-safe.

Usage Path

The primary use case of ara::core::Bitset::reference consists in the targeted querying and modification of individual bit values. In the typical sequence, a caller accesses a bit position in ara::core::Bitset via the subscript operator, returning a temporary reference object. Modifying operations can now be performed on this reference. Specifically for inverting the bit value, the class provides the member function flip(), which is specified according to [SWS_CORE_01712]. This method inverts the current state of the referenced bit (0 becomes 1, 1 becomes 0) and returns an lvalue reference to the proxy object itself (reference&). This allows chaining of further calls or direct further use of the modified result.

Inversion of a bit via reference::flipAnwenderara::core::Bitsetara::core::Bitset::referenceoperator[](pos)reference-Instanzflip()Invert state of the bit at position posreference& (*this)

Sequence diagram: Typical sequence of bit inversion via the proxy object reference. Sources: [SWS_CORE_01712]

Error Scenarios

The class ara::core::Bitset::reference is characterized by a design geared toward robustness and performance. For the central member function flip(), the exception safety "exception safe" as well as the identifier [SWS_CORE_01712] are explicitly specified according to noexcept. This means that calling flip() is guaranteed not to throw any C++ exceptions. Error states or exception handling thus do not occur during this call; the precondition for error-free execution is the validity of the underlying reference to the container object.

This guide was created by an AI based on the AUTOSAR specification for the Adaptive Platform (Release R25-11).

UML class diagram

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

G nara__core__Bitset__reference533 reference + flip()

Methods

flip function

≙ [bitset]

reference & ara::core::Bitset< N >::reference::flip () noexcept;

Method documentation

function flip [SWS_CORE_01712] Upstream: RS_AP_00130

reference & ara::core::Bitset< N >::reference::flip () noexcept;

As per corresponding usage in [bitset]

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 717c5ca36cdd Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The synchronous member function flip of the proxy class ara::core::Bitset::reference serves to invert the currently referenced bit [SWS_CORE_01712]. It is declared via the header file ara/core/bitset.h. The call is parameterless directly on an existing reference instance. As return value, the function returns a reference to the modified reference object (reference&). Interpretation: According to the specification statement “As per corresponding usage in [bitset]”, the behavior is likely to correspond to that of std::bitset::reference::flip, whereby the bit value is negated and *this is returned. Question Q-23d82576a1b93125 (open)

Error Handling and Exception Safety

The interface is declared as noexcept and specified as exception safe (exception safe) [SWS_CORE_01712]. Specific error states or error codes do not occur, since no parameters are passed and no range checks are required.

Interplay in the module

Within ara::core::Bitset, the function complements the other inversion operations of the module:

  • ara::core::Bitset::reference::flip specifically flips the single bit addressed via the reference [SWS_CORE_01712].
  • ara::core::Bitset::flip() synchronously inverts all bits of the entire bitset without parameters and returns a reference to the bitset [SWS_CORE_01730].
  • ara::core::Bitset::flip(std::size_t pos) inverts the bit at index position pos and returns a Result, which fails with IsoStdOutOfRangeViolation if the index is invalid [SWS_CORE_01731].

This text was created and curated by an AI.

Header-Datei#include "ara/core/bitset.h"
Scopeclass ara::core::Bitset::reference
Exception-Sicherheitexception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01712
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01712@rel:R25-11#aa62487c
Content hash
aa62487c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01712
Status: valid/unmigrated Version: rel:R25-11#aa62487c 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_CORE_01712@rel:R25-11#aa62487c
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