Skip to content

Restructure access to members of Configuration - #868

Draft
SebSparrowHawk wants to merge 9 commits into
eclipse-score:mainfrom
SebSparrowHawk:ssp_configuration_update
Draft

Restructure access to members of Configuration#868
SebSparrowHawk wants to merge 9 commits into
eclipse-score:mainfrom
SebSparrowHawk:ssp_configuration_update

Conversation

@SebSparrowHawk

Copy link
Copy Markdown
Contributor

Currently a Configuration provides direct access to its member variables (of type std::unordered_map) for service types and service instances.
With this PR the access to these members would be limited, but on the other side the public API of Configuration has been extended so that the necessary information can be retrieved directly and the Configuration can validate itself. (Consumers of a configuration can now call these methods directly, instead of accessing the underlying data and extracting the relevant information. )
With this stricter encapsulation we want to gain the possibility to update configurations after they have been initially loaded.

Comment thread score/mw/com/impl/configuration/configuration.cpp Fixed
Comment thread score/mw/com/impl/plumbing/binding_runtime_factory.cpp Fixed
Comment thread score/mw/com/runtime.cpp
void InitializeRuntime(const std::int32_t argc, score::StringLiteral argv[])
// NOLINTNEXTLINE(modernize-avoid-c-arrays):C-style array tolerated for command line arguments. This API is deprecated
// and it will be removed.
void InitializeRuntime(const std::int32_t argc, const char* argv[])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Change was actually not part of this PR, fixed with rebase

std::vector<safecpp::zstring_view> command_line_arguments{};
for (std::int32_t arg_idx = 0U; arg_idx < argc; arg_idx++)
{
auto argument = std::string_view{argv[arg_idx]};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Change was actually not part of this PR, fixed with rebase

for (std::int32_t arg_idx = 0U; arg_idx < argc; arg_idx++)
{
auto argument = std::string_view{argv[arg_idx]};
command_line_arguments.push_back(safecpp::zstring_view{argument.data(), argument.size()});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Change was actually not part of this PR, fixed with rebase

Moved external validation functions inside Configuration so that following object-oriented design
a Configuration can call its own validation methods.
This is a preparation step for our goal to limit access to the Configuration's data elements.
Public API has been added to Configuration to check if it contains any LoLa services.
Adapted BindingRuntimeFactory so that it will use this method instead of iterating over
all services types to check if LoLa services are defined.
Public API has been added to Configuration to get names of ServiceIdentifierTypes of all
configured services. Adapted TracingFilterConfigParser to use this method instead of
accessing list of service types and calculating service names this way.
Public API has been added to Configuration to get names of all service elements
of a specific type for a specific service.
During tracing config parsing this method will be called instead of the free floating
function.
Public API has been added to Configuration to get information of all
allowed users of all service instances for a specific ASIL level.
This functionality has previously been implemented in impl/runtime.cpp, which will
now call this method instead.
Public API has been added to query service instance identifiers for a given service type.
TracingFilterConfigParser has been adapted to call this method instead of having its own
implementation of this functionality.
…ethods

Users of Configuration shall not have direct access to the map of service type deployments and service instance deployments.
Instead  the newly added methods shall be used to find the necessary information and entities.
This will allow us in a later step to update existing configurations because access can be controlled this way.
Avoid concurrent access to the underlying maps using std::mutex.
Based on recent refactorings.
@SebSparrowHawk
SebSparrowHawk force-pushed the ssp_configuration_update branch from b3a4153 to 0a4322b Compare August 7, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants