Requirements#

Scope Exit Requirements
status: draft
security: YES
safety: ASIL_B
tags: requirements, scope_exit
version: 1

Functional Requirements#

Invoke Callback On Destruction
status: valid
security: YES
safety: ASIL_B

The Scope Exit component shall invoke its stored callback exactly once when the wrapper is destroyed, unless the wrapper has been released or moved from.

Release Suppresses Callback
status: valid
security: YES
safety: ASIL_B

The Scope Exit component shall provide a release operation that, once invoked on a wrapper, suppresses invocation of that wrapper’s stored callback when it is subsequently destroyed.

Move Transfers Callback Ownership
status: valid
security: YES
safety: ASIL_B

The Scope Exit component shall transfer ownership of the stored callback to the destination wrapper on move construction and move assignment, without invoking the callback on the moved-from wrapper during the transfer.

Move Assignment Invokes Previous Destination Callback
status: valid
security: YES
safety: ASIL_B

When move-assigned and the destination wrapper already owns an active callback, the Scope Exit component shall invoke the destination’s previous callback before adopting the source wrapper’s callback.