Skip to content

GetParticipantName and GetRegistryUri#165

Open
KonradBreitsprecherBkd wants to merge 9 commits into
mainfrom
dev_participant_parameters
Open

GetParticipantName and GetRegistryUri#165
KonradBreitsprecherBkd wants to merge 9 commits into
mainfrom
dev_participant_parameters

Conversation

@KonradBreitsprecherBkd

@KonradBreitsprecherBkd KonradBreitsprecherBkd commented Jan 7, 2025

Copy link
Copy Markdown
Contributor

Add dedicated participant string getters

Summary

This change introduces two dedicated C-API functions:

  • SilKit_Participant_GetParticipantName(void* outParameterValue, size_t* inOutParameterValueSize, SilKit_Participant* participant)
  • SilKit_Participant_GetRegistryUri(void* outParameterValue, size_t* inOutParameterValueSize, SilKit_Participant* participant)

and their C++ equivalents in IParticipant

  • virtual auto GetParticipantName() const -> std::string = 0
  • virtual auto GetRegistryUri() const -> std::string = 0

In addition, string copy/size handling was centralized in the C-API layer and tests were updated/extended accordingly.
Further, the new API is used in the sil-kit-system-controller implementation to dynamically retrieve the participant name (set via command line and/or participant configuration). The name has to be added to the required participant names of the workflow configuration. Without the GetParticipantName functionality, passing a new name by config actually failed because there was no way to retrieve the name from the config programatically.

Motivation

The generic SilKit_Participant_GetParameter API in the first draft depended on an enum that looked like it could be expanded to non-string types but actually did not support this. The new design is more simple and exposes the only two relevant participant string parameters directly and clearly. Future parameter queries could be covered by more explicit getters or by retrieving the current participant configuration.

Further Notes

  • CapiParticipant.cpp | CopyStringToOutBuffer: string size query and nulltermination handling
  • ParameterProvider.hpp | QueryString(SilKit_Participant*, StringQueryFunction): Reusable helper to atomically obtain the string that might change between buffer allocation and query.
  • Unit and Integration tests are in place
  • Docs are still missing until API is stable

Comment thread SilKit/include/silkit/participant/IParticipant.hpp Outdated
Comment thread SilKit/include/silkit/capi/Participant.h Outdated
@KonradBreitsprecherBkd

This comment was marked as outdated.

Comment thread SilKit/include/silkit/detail/impl/participant/ParameterProvider.hpp
Comment thread SilKit/include/silkit/capi/Participant.h Outdated
@KonradBreitsprecherBkd KonradBreitsprecherBkd force-pushed the dev_participant_parameters branch 2 times, most recently from 34c3665 to a44c894 Compare September 15, 2025 13:06
Comment thread SilKit/include/silkit/participant/parameters.hpp Outdated
@KonradBreitsprecherBkd KonradBreitsprecherBkd force-pushed the dev_participant_parameters branch from a44c894 to bd6ae6a Compare June 19, 2026 09:57
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
@KonradBreitsprecherBkd KonradBreitsprecherBkd force-pushed the dev_participant_parameters branch from bd6ae6a to 0dc19b1 Compare June 19, 2026 10:44
@KonradBreitsprecherBkd KonradBreitsprecherBkd changed the title Participant parameters GetParticipantName and GetRegistryUri Jun 19, 2026
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
@KonradBreitsprecherBkd KonradBreitsprecherBkd requested review from VDanielEdwards and snps-fiodorov and removed request for VDanielEdwards June 19, 2026 13:42
@KonradBreitsprecherBkd KonradBreitsprecherBkd marked this pull request as ready for review June 19, 2026 13:44
@KonradBreitsprecherBkd KonradBreitsprecherBkd added the needs reviewer This issue is looking for a reviewer. label Jun 19, 2026
Comment thread SilKit/include/silkit/capi/Participant.h Outdated
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Comment thread SilKit/include/silkit/detail/impl/participant/ParameterProvider.hpp Outdated
Comment thread SilKit/include/silkit/capi/Participant.h Outdated
Comment thread SilKit/source/capi/CapiParticipant.cpp Outdated
Comment thread SilKit/source/core/mock/participant/MockParticipant.hpp
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
@MariusBgm

Copy link
Copy Markdown
Collaborator

i think we should consider this in a bigger context of providing somthing like service discovery. Not sure if we could add this to a SystemMonitor or some other new Service Entry point, e.g. something stably wrapping ServiceDiscovery.
At the very least, i can think of a SilKit_Participant_GetSimulationName

@KonradBreitsprecherBkd

Copy link
Copy Markdown
Contributor Author

i think we should consider this in a bigger context of providing somthing like service discovery. Not sure if we could add this to a SystemMonitor or some other new Service Entry point, e.g. something stably wrapping ServiceDiscovery. At the very least, i can think of a SilKit_Participant_GetSimulationName

The underlying problem is more general: The user currently cannot retreive it's actual (final) participant configuration merged from API calls and a passed Yaml config. Aside from the name and uri, this problem exists for all arguments of CreateController(...) calls that can be overwritten by config. This part is completely local, so I don't see this as part of the service discovery. I agree that this is not a general solution, but simply for uri and name. A general solution would be sth like auto config=participant.getConfiguration() and then work on the config object to extract the values. However for the central property of the participant name, I would expect the API to have a dedicated getter.

The SimulationName is another case, currently it's encoded in the URI, right?

@MariusBgm

Copy link
Copy Markdown
Collaborator

i think we should consider this in a bigger context of providing somthing like service discovery. Not sure if we could add this to a SystemMonitor or some other new Service Entry point, e.g. something stably wrapping ServiceDiscovery. At the very least, i can think of a SilKit_Participant_GetSimulationName

The underlying problem is more general: The user currently cannot retreive it's actual (final) participant configuration merged from API calls and a passed Yaml config. Aside from the name and uri, this problem exists for all arguments of CreateController(...) calls that can be overwritten by config. This part is completely local, so I don't see this as part of the service discovery. I agree that this is not a general solution, but simply for uri and name. A general solution would be sth like auto config=participant.getConfiguration() and then work on the config object to extract the values. However for the central property of the participant name, I would expect the API to have a dedicated getter.

First, I like easy APIs for easy stuff, like this.
However, that was intended by the original design: participants cannot get the current participant name or network name of controllers (think "portable, pre-built participant executables").
Would we add GetNetworkName to controllers, too?

The SimulationName is another case, currently it's encoded in the URI, right?

yes. but my point was, should we create a dedicated API to get the current values from a participant, like participant name, registry uri, simulation name?

Moving away from the old design of not allowing introspection:
a.) either, ad hoc additions of methods to the toplevel participant object, or
b.) create a dedicated, coherent API for introspection (like an enhanced public serviceDiscovery or systemMonitor with participant name, registry uri, simulation name etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Design Proposal needs reviewer This issue is looking for a reviewer. New API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants