.. # ******************************************************************************* # Copyright (c) 2025 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. # # This program and the accompanying materials are made available under the # terms of the Apache License Version 2.0 which is available at # https://www.apache.org/licenses/LICENSE-2.0 # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* Requirements ############ .. document:: Result Library Requirements :id: doc__result_lib_requirements :status: draft :safety: ASIL_B :realizes: wp__requirements_comp :tags: requirements, result_library Functional Requirements ======================= .. comp_req:: Result-Based Error Handling :id: comp_req__result__error_handling :reqtype: Functional :security: NO :safety: ASIL_B :satisfies: feat_req__baselibs__core_utilities, feat_req__baselibs__result_library, feat_req__baselibs__safety :status: valid :tags: inspected The Result library shall provide an error handling mechanism that enables functions to return either successful values or error information without using C++ exceptions. .. comp_req:: Domain-Specific Error Information :id: comp_req__result__domain_error_information :reqtype: Functional :security: NO :safety: ASIL_B :satisfies: feat_req__baselibs__core_utilities, feat_req__baselibs__result_library, feat_req__baselibs__safety :status: valid :tags: inspected The Result library shall support user-defined error domains and error codes. .. comp_req:: Type-Safe Error Handling :id: comp_req__result__type_safety :reqtype: Functional :security: NO :safety: ASIL_B :satisfies: feat_req__baselibs__consistent_apis, feat_req__baselibs__safety :status: valid :tags: inspected The Result library shall enforce compile-time type safety for error handling operations. .. comp_req:: Standard Library Integration :id: comp_req__result__std_integration :reqtype: Functional :security: NO :safety: ASIL_B :satisfies: feat_req__baselibs__consistent_apis, feat_req__baselibs__safety :status: valid :tags: inspected The Result library shall provide conversion utilities to transform Result objects into standard library optional type, with enforced error handling. Non-Functional Requirements =========================== .. comp_req:: Deterministic Behavior :id: comp_req__result__deterministic_behavior :reqtype: Non-Functional :security: NO :safety: ASIL_B :satisfies: feat_req__baselibs__core_utilities, feat_req__baselibs__safety :status: valid :tags: inspected The Result library shall provide deterministic behavior with no dynamic memory allocation. .. comp_req:: Exception-Free Operation :id: comp_req__result__exception_free_operation :reqtype: Non-Functional :security: NO :safety: ASIL_B :satisfies: feat_req__baselibs__core_utilities, feat_req__baselibs__safety :status: valid :tags: inspected The Result library shall operate without throwing C++ exceptions. Assumptions of Use (AoU) ======================== .. aou_req:: Error Domain Implementation :id: aou_req__result__error_domain_implementation :reqtype: Functional :security: NO :safety: ASIL_B :status: valid :tags: inspected The user shall implement error domain classes and error code enumerations according to the library's interface specification. .. aou_req:: Result Value Handling :id: aou_req__result__value_handling :reqtype: Functional :security: NO :safety: ASIL_B :status: valid :tags: inspected The user shall check and handle both successful and error states of Result objects before accessing contained values to prevent undefined behavior. .. aou_req:: Thread Safety :id: aou_req__result__thread_safety :reqtype: Non-Functional :security: NO :safety: ASIL_B :status: valid :tags: inspected The user shall ensure appropriate synchronization mechanisms when using Result objects in multi-threaded environments, as the library provides no internal thread safety guarantees. .. aou_req:: Resource Lifetime :id: aou_req__result__resource_lifetime :reqtype: Non-Functional :security: NO :safety: ASIL_B :status: valid :tags: inspected The user shall ensure that error domain objects and referenced resources remain valid throughout the entire lifetime of any dependent Result or Error objects. .. needextend:: "__result__" in id :+tags: baselibs .. needextend:: "result" in id :+tags: result_library