Requirements#
Result Library Requirements
|
status: valid
security: YES
safety: ASIL_B
|
||||
Functional Requirements#
Result-Based Error Handling
|
status: valid_inspected
security: YES
safety: ASIL_B
|
||||
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_inspected
security: YES
safety: ASIL_B
|
||||
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_inspected
security: YES
safety: ASIL_B
|
||||
The Result library shall support user-defined error domains and error codes. |
|||||
Type-Safe Error Handling
|
status: valid_inspected
security: YES
safety: ASIL_B
|
||||
The Result library shall enforce compile-time type safety for error handling operations. |
|||||
Standard Library Integration
|
status: valid_inspected
security: YES
safety: ASIL_B
|
||||
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. |
|||||
Future C++ Library Integration
|
status: valid_inspected
security: YES
safety: ASIL_B
|
||||
The Result library shall provide conversion utilities to transform Result objects into score::cpp::expected objects with the same value and error types and vice versa, and to transform a Result object’s value into a score::cpp::optional<T>. The conversion to score::cpp::optional<T> 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_inspected
security: YES
safety: ASIL_B
|
||||
The Result library shall provide deterministic behavior with no dynamic memory allocation. |
|||||
Exception-Free Operation
|
status: valid_inspected
security: YES
safety: ASIL_B
|
||||
The Result library shall operate without throwing C++ exceptions. |
|||||
Assumptions of Use (AoU)#
Error Domain Implementation
|
status: valid_inspected
security: NO
safety: ASIL_B
|
||||
The user shall implement error domain classes and error code enumerations according to the library’s interface specification. |
|||||
Result Value Handling
|
status: valid_inspected
security: NO
safety: ASIL_B
|
||||
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_inspected
security: NO
safety: ASIL_B
|
||||
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_inspected
security: NO
safety: ASIL_B
|
||||
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_inspected
security: NO
safety: ASIL_B
|
||||
The user shall ensure that error domain objects and referenced resources remain valid throughout the entire lifetime of any dependent Result or Error objects. |
|||||