+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions docs/features/baselibs/docs/requirements/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
..
# *******************************************************************************
# 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
############

.. feat_req:: Core Software Utilities
:id: feat_req__baselibs__core_utilities
:reqtype: Functional
:security: NO
:safety: QM
:satisfies: stkh_req__functional_req__base_libraries
:status: valid

The base libraries shall include core software utilities and common infrastructure components needed by multiple platform modules.

.. feat_req:: Safety Relevance
:id: feat_req__baselibs__safety
:reqtype: Functional
:security: NO
:safety: ASIL_B
:satisfies: stkh_req__functional_req__base_libraries
:status: valid

The base libraries shall implement functionality necessary to support safety-relevant platform components up to ASIL-B.

.. feat_req:: Multi-Language APIs
:id: feat_req__baselibs__multi_language_apis
:reqtype: Functional
:security: NO
:safety: QM
:satisfies: stkh_req__functional_req__base_libraries, stkh_req__dev_experience__prog_languages
:status: valid

The base libraries shall provide APIs for C++, Rust, or both, depending on the requirements of consuming platform components.

.. feat_req:: Consistent APIs
:id: feat_req__baselibs__consistent_apis
:reqtype: Functional
:security: NO
:safety: QM
:satisfies: stkh_req__functional_req__base_libraries, stkh_req__dev_experience__prog_languages, stkh_req__overall_goals__reuse_of_app_soft
:status: valid

The base libraries shall provide consistent APIs while respecting language-specific idioms.

.. feat_req:: Maintainable Design
:id: feat_req__baselibs__maintainable_design
:reqtype: Non-Functional
:security: NO
:safety: QM
:satisfies: stkh_req__functional_req__base_libraries, stkh_req__overall_goals__reuse_of_app_soft
:status: valid

The base libraries shall be designed for maintainability and code reuse.

.. feat_req:: Security Robustness
:id: feat_req__baselibs__security
:reqtype: Non-Functional
:security: YES
:safety: QM
:satisfies: stkh_req__functional_req__base_libraries
:status: valid

The base libraries shall adhere to secure coding standards to prevent vulnerabilities across platform components.
147 changes: 147 additions & 0 deletions docs/features/baselibs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
..
# *******************************************************************************
# 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
# *******************************************************************************

.. _baselibs_feature:

Base Libraries
##############

.. document:: Base Libraries
:id: doc__baselibs
:status: valid
:safety: ASIL_B
:tags: feature_request


.. toctree::
:hidden:

docs/requirements/index.rst


Feature flag
============

To activate this feature, use the following feature flag:

``experimental_baselibs``

Abstract
========

This feature provides a set of base libraries for both C++ and Rust that can be used by S-CORE
components.
These libraries offer common functionality, ensuring consistent implementations, reducing code
duplication, and promoting interoperability between components.

The base libraries include utilities for bit manipulation, concurrency management, containers,
JSON processing, filesystem operations, memory handling, OS abstraction, error handling,
serialization, logging, and various other common utilities needed across the S-CORE system.

Motivation
==========

Base libraries are essential to ensure consistency, reduce code duplication, and improve quality
across S-CORE components.

Rationale
=========

A base library is developed only if it is required by at least two S-CORE components.
This ensures that the effort to create and maintain a base library is justified by real,
shared needs across the platform.

Each base library may provide an API for Rust, C++, or both, depending on the requirements of
the consuming components. When possible, a library should be implemented once in either Rust
or C++ and provide bindings to the other language to maximize maintainability and consistency.
However, if there are strong technical reasons (such as language-specific performance or safety
requirements), a library may be implemented separately in both Rust and C++.

Specification
=============

The base libraries feature consists of the following libraries, all of which are currently implemented in C++:

- **bitmanipulation**: Utilities for bit manipulation.
- **concurrency**: Provides a generic interface to execute any C++ callable in a parallel context,
supporting various execution strategies (e.g., thread pool, timed execution), thread safety,
interruption handling, and periodic/delayed task execution.
- **containers**: Offers a ``DynamicArray`` (fixed-size array with dynamic construction-time size)
and an intrusive linked list implementation conforming to the
`P0406R1 proposal <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0406r1.html>`_.
- **json**: JSON abstraction layer that can switch between different parsers/serializers under the hood.
- **filesystem**: Filesystem manipulation library similar to ``std::filesystem``.
- **futurecpp**: Extends the C++14 Standard Library with features from newer C++ standards up to C++26,
as well as selected proposals for the C++ Standard Library.
- **safecpp/aborts_upon_exception**: Globally prevents creation of exception objects by calling ``std::abort()``
immediately.
- **safecpp/coverage_termination_handler**: Helper library to enable collective code coverage information in
GTest death tests.
- **safecpp/safe_math**: Provides safe implementations for arithmetic and related operations for
signed/unsigned integral types and floating point types.
- **safecpp/scoped_function**: Allows developers to consciously limit when an enclosed callable
(function) can be invoked.
- **memory**: Utility library for memory handling, including an abstraction layer for shared memory.
- **os**: OS Abstraction Layer (OSAL) to interface with different POSIX-like operating systems such
as Linux and QNX.
- **result**: Provides a unified approach to error handling without exceptions, conforming to C++23
``std::expected``.
- **static_reflection_with_serialization**: A header-only library for binary serialization,
deserialization, and compile-time type reflection of heterogenuous C++ data structures with focus
on compile-time safety and efficiency of serialization, as well as efficiency of filtering by
content during deserialization.
- **mw::log**: Logging library.
- **utils**: Provides a collection of small, reusable utilities that do not fit into the other
base libraries.

Backwards Compatibility
=======================

As this is a new feature, there are no backwards compatibility concerns.

Security Impact
===============

Base libraries present varying security risks as vulnerabilities could affect multiple components
simultaneously.
Each library requires individual security impact analysis based on its functionality and usage patterns.

Safety Impact
=============

- Due to wide usage of the base libraries throughout the platform, extra care is needed in design,
implementation, and testing to minimize safety impact.
- Libraries are developed at various integrity levels from QM (non-safety) up to ASIL-B,
depending on their intended use cases.

License Impact
==============

The base libraries are licensed under Apache License 2.0.

How to Teach This
=================

Each library is expected to have a user manual that includes an API reference and usage examples
where necessary.

Rejected Ideas
==============

There are no rejected ideas related to the base libraries feature at this time.

Open Issues
===========

There are currently no open issues related to the base libraries feature.
11 changes: 11 additions & 0 deletions docs/requirements/stakeholder/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ Functional requirements
The platform shall support safe computation.


.. stkh_req:: Base Libraries
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we need a stakeholder requirements for this. Do the stakeholders care? I think it is a mere design decision and could be linked to existing stkh_req__quality__assumptions_and_dd.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not sure about this one. I added this stakeholder requirement for two reasons:

  • Some of the base libs could be exposed to S-CORE users, e.g. a JSON lib could be used by applications.
  • It's in interests of the user to limit code duplication and reduce effort for safety qualification. The base libs have even gotten an own swimlane in the S-CORE architecture diagram.

I'm also fine with removing stkh_req__functional_req__base_libraries and relinking the feature requirements to the stkh_req__quality__assumptions_and_dd. Will tracing of safety and security flags work fine? In the stkh_req__quality__assumptions_and_dd, these are QM and NO.

:id: stkh_req__functional_req__base_libraries
:reqtype: Functional
:security: YES
:safety: ASIL_B
:rationale: Common libraries reduce duplication, improve consistency and quality across components.
:status: valid

The software platform shall provide a set of base libraries offering common functionality for platform components.


.. stkh_req:: Hardware Accelerated Computation
:id: stkh_req__functional_req__hardware_comput
:reqtype: Functional
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载