Requirements#

Result Library Requirements
status: draft
security: YES
safety: ASIL_B
tags: requirements, result_library

Functional Requirements#

Result-Based Error Handling
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Functional

The Result library shall provide an error handling mechanism that enables functions to return either successful values (“Get Value”) or error information (“Get Error”) without using C++ exceptions.

Set Result
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Functional

The Result library shall provide a “Set Result” operation that accepts either a successful value of type T or an Error object.

Domain-Specific Error Information
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Functional

The Result library shall support user-defined error domains and error codes.

Type-Safe Error Handling
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Functional

The Result library shall enforce compile-time type safety for error handling operations.

Standard Library Integration
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Functional

The Result library shall provide conversion utilities to transform Result objects into std::optional<T> types. The conversion shall require explicit handling of error cases before discarding error information, ensuring that errors cannot be silently ignored.

Non-Functional Requirements#

Deterministic Behavior
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Non-Functional

The Result library shall provide deterministic behavior with no dynamic memory allocation.

Exception-Free Operation
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Non-Functional

The Result library shall operate without throwing C++ exceptions.

Assumptions of Use (AoU)#

Error Domain Implementation
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Functional

The user shall implement error domain classes and error code enumerations according to the library’s interface specification.

Result Value Handling
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Functional

The user shall check and handle both successful and error states of Result objects before accessing contained values to prevent undefined behavior.

Error Reaction and Safe State
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Functional

The user shall implement error reaction mechanisms that transition the system to a safe state when error conditions are detected in Result objects.

Thread Safety
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Non-Functional

The user shall implement external synchronization mechanisms (e.g., mutexes, atomic operations, or locks) when accessing or modifying Result objects from multiple threads concurrently, as the library provides no internal thread safety guarantees.

Resource Lifetime
status: valid
security: NO
safety: ASIL_B
tags: inspected, baselibs, result_library
reqtype: Non-Functional

The user shall ensure that error domain objects and referenced resources remain valid throughout the entire lifetime of any dependent Result or Error objects.