diff --git a/SilKit/IntegrationTests/CMakeLists.txt b/SilKit/IntegrationTests/CMakeLists.txt index d0170b6d3..5a095edf7 100644 --- a/SilKit/IntegrationTests/CMakeLists.txt +++ b/SilKit/IntegrationTests/CMakeLists.txt @@ -127,6 +127,10 @@ add_silkit_test_to_executable(SilKitIntegrationTests SOURCES ITest_SimTask.cpp ) +add_silkit_test_to_executable(SilKitIntegrationTests + SOURCES ITest_GetParameter.cpp +) + add_silkit_test_to_executable(SilKitFunctionalTests SOURCES FTest_WallClockCoupling.cpp ) diff --git a/SilKit/IntegrationTests/Hourglass/MockCapi.cpp b/SilKit/IntegrationTests/Hourglass/MockCapi.cpp index 0ab83ff4b..a1945b06e 100644 --- a/SilKit/IntegrationTests/Hourglass/MockCapi.cpp +++ b/SilKit/IntegrationTests/Hourglass/MockCapi.cpp @@ -770,6 +770,15 @@ extern "C" return globalCapi->SilKit_Participant_GetLogger(outLogger, participant); } + SilKit_ReturnCode SilKitCALL SilKit_Participant_GetParameter(char* outParameterValue, + size_t* inOutParameterValueSize, + SilKit_Parameter parameter, + SilKit_Participant* participant) + { + return globalCapi->SilKit_Participant_GetParameter(outParameterValue, inOutParameterValueSize, parameter, + participant); + } + // ParticipantConfiguration SilKit_ReturnCode SilKitCALL SilKit_ParticipantConfiguration_FromString( diff --git a/SilKit/IntegrationTests/Hourglass/MockCapi.hpp b/SilKit/IntegrationTests/Hourglass/MockCapi.hpp index a348cd3e0..893f3a052 100644 --- a/SilKit/IntegrationTests/Hourglass/MockCapi.hpp +++ b/SilKit/IntegrationTests/Hourglass/MockCapi.hpp @@ -415,6 +415,10 @@ class MockCapi MOCK_METHOD(SilKit_ReturnCode, SilKit_Participant_GetLogger, (SilKit_Logger * *outLogger, SilKit_Participant* participant)); + + MOCK_METHOD(SilKit_ReturnCode, SilKit_Participant_GetParameter, + (char* outParameterValue, size_t* outParameterValueSize, SilKit_Parameter parameter, + SilKit_Participant* participant)); // ParticipantConfiguration diff --git a/SilKit/IntegrationTests/ITest_GetParameter.cpp b/SilKit/IntegrationTests/ITest_GetParameter.cpp new file mode 100644 index 000000000..23b8b119d --- /dev/null +++ b/SilKit/IntegrationTests/ITest_GetParameter.cpp @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: 2023 Vector Informatik GmbH +// +// SPDX-License-Identifier: MIT + +#include +#include + +#include "gtest/gtest.h" +#include "silkit/vendor/CreateSilKitRegistry.hpp" +#include "silkit/SilKit.hpp" + +namespace { + +struct ITest_GetParameter : public testing::Test +{ + + void checkGetParameterValues(SilKit::IParticipant* participant, std::unordered_map expectedParameters) + { + for (auto it : expectedParameters) + { + std::string parameterValue = participant->GetParameter(it.first); + std::string expectedValue = it.second; + EXPECT_EQ(expectedValue, parameterValue); + } + } + + const std::string _registryUriAnyPort = "silkit://127.0.0.1:0"; +}; + +// Check that GetParameter return the values set via api +TEST_F(ITest_GetParameter, get_parameter_set_by_api) +{ + const std::string participantNameByApi = "P1"; + + auto emptyParticipantConfig = SilKit::Config::ParticipantConfigurationFromString(""); + + auto registry = SilKit::Vendor::Vector::CreateSilKitRegistry(emptyParticipantConfig); + auto registryUriByApi = registry->StartListening(_registryUriAnyPort); + + auto participant = SilKit::CreateParticipant(emptyParticipantConfig, participantNameByApi, registryUriByApi); + + checkGetParameterValues(participant.get(), {{SilKit::Parameter::ParticipantName, participantNameByApi}, + {SilKit::Parameter::RegistryUri, registryUriByApi}}); +} + +// Config values take precedence over api values +// Check that GetParameter actually return the config values if both are set +TEST_F(ITest_GetParameter, get_parameter_set_by_config) +{ + const std::string participantNameByApi = "P2"; + const std::string registryUriByApi = "silkit://127.0.0.42:0"; + + const std::string participantNameByConfig = "P1"; + + auto emptyParticipantConfig = SilKit::Config::ParticipantConfigurationFromString(""); + + auto registry = SilKit::Vendor::Vector::CreateSilKitRegistry(emptyParticipantConfig); + auto registryUriByConfig = registry->StartListening(_registryUriAnyPort); + + std::ostringstream ss; + ss << R"({ "ParticipantName": ")" << participantNameByConfig << R"(", "Middleware": { "RegistryUri": ")" + << registryUriByConfig << R"(" }})"; + auto participantConfig = SilKit::Config::ParticipantConfigurationFromString(ss.str()); + + auto participant = SilKit::CreateParticipant(participantConfig, participantNameByApi, registryUriByApi); + + checkGetParameterValues(participant.get(), {{SilKit::Parameter::ParticipantName, participantNameByConfig}, + {SilKit::Parameter::RegistryUri, registryUriByConfig}}); + +} + +} //end namespace diff --git a/SilKit/include/silkit/capi/Parameters.h b/SilKit/include/silkit/capi/Parameters.h new file mode 100644 index 000000000..06063b504 --- /dev/null +++ b/SilKit/include/silkit/capi/Parameters.h @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2024 Vector Informatik GmbH +// +// SPDX-License-Identifier: MIT + +#pragma once +#include +#include "SilKitMacros.h" + +#pragma pack(push) +#pragma pack(8) + +SILKIT_BEGIN_DECLS + +/*! Internal parameter provider. */ +typedef struct SilKit_ParamterProvider SilKit_ParamterProvider; + +/*! A parameter set by an API call and/or the participant configuration. */ +typedef int16_t SilKit_Parameter; + +/*! An undefined parameter */ +#define SilKit_Parameter_Undefined ((SilKit_Parameter)0) +/*! The name of the participant */ +#define SilKit_Parameter_ParticipantName ((SilKit_Parameter)1) +/*! The registry URI */ +#define SilKit_Parameter_ReistryUri ((SilKit_Parameter)2) + +SILKIT_END_DECLS + +#pragma pack(pop) diff --git a/SilKit/include/silkit/capi/Participant.h b/SilKit/include/silkit/capi/Participant.h index f048b4294..ac06c0e50 100644 --- a/SilKit/include/silkit/capi/Participant.h +++ b/SilKit/include/silkit/capi/Participant.h @@ -25,6 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "silkit/capi/SilKitMacros.h" #include "silkit/capi/Types.h" #include "silkit/capi/Logger.h" +#include "silkit/capi/Parameters.h" #pragma pack(push) #pragma pack(8) @@ -80,6 +81,28 @@ SilKitAPI SilKit_ReturnCode SilKitCALL SilKit_Participant_GetLogger(SilKit_Logge typedef SilKit_ReturnCode(SilKitFPTR* SilKit_Participant_GetLogger_t)(SilKit_Logger** outLogger, SilKit_Participant* participant); + +/*! \brief Retrieve a parameter from a participant. + * + * \param outParameterValue A buffer to copy the null-terminated parameter value to. + Passing a nullptr is valid and indicates a size-check via inOutParameterValueSize to allocate the buffer. + * \param inOutParameterValueSize The size of the parameter including null-termination. + * \param parameter The parameter to get. + * \param participant The participant to get the parameter from. + * + * Returns the current value of the given parameter. + * Useful for parameters that are passed to the participant via the API and the participant configuration. + */ +SilKitAPI SilKit_ReturnCode SilKitCALL SilKit_Participant_GetParameter(char* outParameterValue, + size_t* inOutParameterValueSize, + SilKit_Parameter parameter, + SilKit_Participant* participant); + +typedef SilKit_ReturnCode(SilKitFPTR* SilKit_Participant_GetParameter_t)(char* outParameterValue, + size_t* inOutParameterValueSize, + SilKit_Parameter parameter, + SilKit_Participant* participant); + SILKIT_END_DECLS #pragma pack(pop) diff --git a/SilKit/include/silkit/capi/SilKit.h b/SilKit/include/silkit/capi/SilKit.h index 039021d99..1e864b8c1 100644 --- a/SilKit/include/silkit/capi/SilKit.h +++ b/SilKit/include/silkit/capi/SilKit.h @@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "silkit/capi/Version.h" #include "silkit/capi/NetworkSimulator.h" #include "silkit/capi/EventProducer.h" +#include "silkit/capi/Parameters.h" SILKIT_BEGIN_DECLS diff --git a/SilKit/include/silkit/detail/impl/participant/ParameterProvider.hpp b/SilKit/include/silkit/detail/impl/participant/ParameterProvider.hpp new file mode 100644 index 000000000..c3e07e061 --- /dev/null +++ b/SilKit/include/silkit/detail/impl/participant/ParameterProvider.hpp @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Vector Informatik GmbH +// +// SPDX-License-Identifier: MIT + +#pragma once + +#include +#include "silkit/capi/Parameters.h" + +namespace SilKit { +DETAIL_SILKIT_DETAIL_VN_NAMESPACE_BEGIN +namespace Impl { + +class ParameterProvider +{ +public: + inline ParameterProvider(); + + inline ~ParameterProvider() = default; + + inline auto GetParameter(SilKit_Participant* participant, Parameter parameter) -> std::string; + +}; + +} // namespace Impl +DETAIL_SILKIT_DETAIL_VN_NAMESPACE_CLOSE +} // namespace SilKit + + +// ================================================================================ +// Inline Implementations +// ================================================================================ + +#include "silkit/detail/impl/ThrowOnError.hpp" + +namespace SilKit { +DETAIL_SILKIT_DETAIL_VN_NAMESPACE_BEGIN +namespace Impl { + +ParameterProvider::ParameterProvider() +{ +} + +auto ParameterProvider::GetParameter(SilKit_Participant* participant, Parameter parameter) -> std::string +{ + std::vector buffer; + size_t size = 0; + SilKit_Parameter cParameter = static_cast(parameter); + { + const auto returnCode = SilKit_Participant_GetParameter(nullptr, &size, cParameter, participant); + ThrowOnError(returnCode); + } + while (size > buffer.size()) + { + buffer.resize(size); + const auto returnCode = SilKit_Participant_GetParameter(buffer.data(), &size, cParameter, participant); + ThrowOnError(returnCode); + } + buffer.resize(size); + + return std::string{buffer.data()}; +} + +} // namespace Impl +DETAIL_SILKIT_DETAIL_VN_NAMESPACE_CLOSE +} // namespace SilKit diff --git a/SilKit/include/silkit/detail/impl/participant/Participant.hpp b/SilKit/include/silkit/detail/impl/participant/Participant.hpp index a849ee248..19f596bf4 100644 --- a/SilKit/include/silkit/detail/impl/participant/Participant.hpp +++ b/SilKit/include/silkit/detail/impl/participant/Participant.hpp @@ -53,6 +53,8 @@ #include "silkit/detail/impl/netsim/NetworkSimulator.hpp" +#include "silkit/detail/impl/participant/ParameterProvider.hpp" + namespace SilKit { DETAIL_SILKIT_DETAIL_VN_NAMESPACE_BEGIN namespace Impl { @@ -100,6 +102,8 @@ class Participant : public SilKit::IParticipant inline auto GetLogger() -> SilKit::Services::Logging::ILogger* override; + inline auto GetParameter(SilKit::Parameter parameter) -> std::string override; + inline auto ExperimentalCreateNetworkSimulator() -> SilKit::Experimental::NetworkSimulation::INetworkSimulator*; inline auto ExperimentalCreateSystemController() @@ -141,6 +145,8 @@ class Participant : public SilKit::IParticipant std::unique_ptr _logger; std::unique_ptr _networkSimulator; + + std::unique_ptr _parameterProvider; }; } // namespace Impl @@ -160,6 +166,7 @@ Participant::Participant(SilKit_Participant* participant) : _participant{participant} { _logger = std::make_unique(_participant); + _parameterProvider = std::make_unique(); } Participant::~Participant() @@ -241,6 +248,12 @@ auto Participant::GetLogger() -> SilKit::Services::Logging::ILogger* return _logger.get(); } + +auto Participant::GetParameter(SilKit::Parameter parameter) -> std::string +{ + return _parameterProvider->GetParameter(_participant, parameter); +} + auto Participant::ExperimentalCreateSystemController() -> SilKit::Experimental::Services::Orchestration::ISystemController* { diff --git a/SilKit/include/silkit/participant/IParticipant.hpp b/SilKit/include/silkit/participant/IParticipant.hpp index bedb8ecfd..ef7f419c5 100644 --- a/SilKit/include/silkit/participant/IParticipant.hpp +++ b/SilKit/include/silkit/participant/IParticipant.hpp @@ -35,6 +35,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "silkit/services/rpc/RpcSpec.hpp" #include "silkit/services/rpc/RpcDatatypes.hpp" +#include "silkit/participant/parameters.hpp" + namespace SilKit { /*! \brief Communication interface to be used by SIL Kit participants @@ -99,6 +101,9 @@ class IParticipant //! \brief Return the ILogger at this SIL Kit participant. virtual auto GetLogger() -> Services::Logging::ILogger* = 0; + + //! \brief Get a parameter set by an API call and/or the participant configuration. + virtual auto GetParameter(SilKit::Parameter parameter) -> std::string = 0; }; } // namespace SilKit diff --git a/SilKit/include/silkit/participant/parameters.hpp b/SilKit/include/silkit/participant/parameters.hpp new file mode 100644 index 000000000..e440c366c --- /dev/null +++ b/SilKit/include/silkit/participant/parameters.hpp @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2024 Vector Informatik GmbH +// +// SPDX-License-Identifier: MIT + +#pragma once + +#include "silkit/capi/Parameters.h" + +namespace SilKit { + +// note: never reuse old numbers! +//! \brief Available parameters to query +enum class Parameter : SilKit_Parameter +{ + //! An undefined parameter + Undefined = SilKit_Parameter_Undefined, + //! The name of the participant + ParticipantName = SilKit_Parameter_ParticipantName, + //! The registry URI + RegistryUri = SilKit_Parameter_ReistryUri, +}; + +} // namespace SilKit diff --git a/SilKit/source/capi/CMakeLists.txt b/SilKit/source/capi/CMakeLists.txt index 08be2cf39..c55605649 100644 --- a/SilKit/source/capi/CMakeLists.txt +++ b/SilKit/source/capi/CMakeLists.txt @@ -65,4 +65,5 @@ add_silkit_test_to_executable(SilKitUnitTests SOURCES Test_CapiLin.cpp LIBS S_Si add_silkit_test_to_executable(SilKitUnitTests SOURCES Test_CapiSymbols.cpp LIBS S_SilKitImpl) add_silkit_test_to_executable(SilKitUnitTests SOURCES Test_CapiNetSim.cpp LIBS S_SilKitImpl I_SilKit_Core_Mock_Participant) add_silkit_test_to_executable(SilKitUnitTests SOURCES Test_CapiExceptions.cpp LIBS S_SilKitImpl) +add_silkit_test_to_executable(SilKitUnitTests SOURCES Test_CapiGetParameter.cpp LIBS S_SilKitImpl) diff --git a/SilKit/source/capi/CapiParticipant.cpp b/SilKit/source/capi/CapiParticipant.cpp index 86932177d..1f538e105 100644 --- a/SilKit/source/capi/CapiParticipant.cpp +++ b/SilKit/source/capi/CapiParticipant.cpp @@ -27,6 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "silkit/SilKit.hpp" #include "silkit/services/logging/ILogger.hpp" #include "silkit/services/orchestration/all.hpp" +#include "silkit/participant/parameters.hpp" #include "CapiImpl.hpp" #include "TypeConversion.hpp" @@ -36,7 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include - SilKit_ReturnCode SilKitCALL SilKit_Participant_Create(SilKit_Participant** outParticipant, SilKit_ParticipantConfiguration* participantConfiguration, const char* participantName, const char* registryUri) @@ -102,6 +102,40 @@ try } CAPI_CATCH_EXCEPTIONS +SilKit_ReturnCode SilKitCALL SilKit_Participant_GetParameter(char* outParameterValue, size_t* inOutParameterValueSize, + SilKit_Parameter parameter, + SilKit_Participant* participant) +try +{ + ASSERT_VALID_OUT_PARAMETER(inOutParameterValueSize); + ASSERT_VALID_POINTER_PARAMETER(participant); + + auto cppParticipant = reinterpret_cast(participant); + auto cppParameter = static_cast(parameter); + auto parameterValue = cppParticipant->GetParameter(cppParameter); + + // outParameterValue == nullptr indicates a size-check only, otherwise copy + if (outParameterValue != nullptr) + { + size_t sizeToCopy; + if (*inOutParameterValueSize >= parameterValue.size() + 1) + { + // Don't copy more than we actually have + sizeToCopy = parameterValue.size(); + } + else + { + // Don't copy more than the given size + sizeToCopy = *inOutParameterValueSize - 1; + } + parameterValue.copy(outParameterValue, sizeToCopy); + outParameterValue[sizeToCopy] = '\0'; + } + *inOutParameterValueSize = parameterValue.size() + 1; + return SilKit_ReturnCode_SUCCESS; +} +CAPI_CATCH_EXCEPTIONS + SilKit_ReturnCode SilKitCALL SilKit_ParticipantConfiguration_FromString( SilKit_ParticipantConfiguration** outParticipantConfiguration, const char* participantConfigurationString) diff --git a/SilKit/source/capi/Test_CapiGetParameter.cpp b/SilKit/source/capi/Test_CapiGetParameter.cpp new file mode 100644 index 000000000..d96dedda6 --- /dev/null +++ b/SilKit/source/capi/Test_CapiGetParameter.cpp @@ -0,0 +1,60 @@ +// SPDX-FileCopyrightText: 2024 Vector Informatik GmbH +// +// SPDX-License-Identifier: MIT +#include "gtest/gtest.h" +#include "gmock/gmock.h" +#include "silkit/capi/SilKit.h" + +#include "MockParticipant.hpp" + +namespace { + +using SilKit::Core::Tests::DummyParticipant; + +class MockParticipant : public SilKit::Core::Tests::DummyParticipant +{ +public: + MOCK_METHOD(std::string, GetParameter, (SilKit::Parameter /*parameter*/), (override)); +}; + +class Test_CapiGetParameter : public testing::Test +{ +public: + MockParticipant mockParticipant; + Test_CapiGetParameter() {} +}; + +TEST_F(Test_CapiGetParameter, getparameter_bad_params) +{ + SilKit_ReturnCode returnCode; + auto cMockParticipant = (SilKit_Participant*)&mockParticipant; + char* parameterValue{nullptr}; + size_t parameterSize; + + returnCode = + SilKit_Participant_GetParameter(nullptr, ¶meterSize, SilKit_Parameter_ParticipantName, cMockParticipant); + EXPECT_EQ(returnCode, SilKit_ReturnCode_SUCCESS); + + returnCode = + SilKit_Participant_GetParameter(parameterValue, nullptr, SilKit_Parameter_ParticipantName, cMockParticipant); + EXPECT_EQ(returnCode, SilKit_ReturnCode_BADPARAMETER); + + returnCode = + SilKit_Participant_GetParameter(parameterValue, ¶meterSize, SilKit_Parameter_ParticipantName, nullptr); + EXPECT_EQ(returnCode, SilKit_ReturnCode_BADPARAMETER); +} + +TEST_F(Test_CapiGetParameter, getparameter_function_mapping) +{ + SilKit_ReturnCode returnCode; + auto cMockParticipant = (SilKit_Participant*)&mockParticipant; + char* parameterValue{nullptr}; + size_t parameterSize; + + EXPECT_CALL(mockParticipant, GetParameter(SilKit::Parameter::ParticipantName)).Times(testing::Exactly(1)); + returnCode = SilKit_Participant_GetParameter(parameterValue, & parameterSize, SilKit_Parameter_ParticipantName, + cMockParticipant); + EXPECT_EQ(returnCode, SilKit_ReturnCode_SUCCESS); +} + +} // namespace diff --git a/SilKit/source/config/ParticipantConfiguration.cpp b/SilKit/source/config/ParticipantConfiguration.cpp index 103c6e6e7..d479d4049 100755 --- a/SilKit/source/config/ParticipantConfiguration.cpp +++ b/SilKit/source/config/ParticipantConfiguration.cpp @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace SilKit { namespace Config { -namespace v1 { +inline namespace v1 { auto Label::ToPublicApi() const -> SilKit::Services::MatchingLabel { diff --git a/SilKit/source/core/internal/IParticipantInternal.hpp b/SilKit/source/core/internal/IParticipantInternal.hpp index 9940a4474..9442dd484 100644 --- a/SilKit/source/core/internal/IParticipantInternal.hpp +++ b/SilKit/source/core/internal/IParticipantInternal.hpp @@ -307,6 +307,9 @@ class IParticipantInternal : public IParticipant //! \brief Return the ILogger at this SIL Kit participant. virtual auto GetLogger() -> Services::Logging::ILogger* = 0; + //! \brief Get a parameter set by an API call and/or the participant configuration. + virtual auto GetParameter(Parameter parameter) -> std::string = 0; + //! \brief Return the LifecycleService at this SIL Kit participant. virtual auto GetLifecycleService() -> Services::Orchestration::ILifecycleService* = 0; diff --git a/SilKit/source/core/mock/participant/MockParticipant.hpp b/SilKit/source/core/mock/participant/MockParticipant.hpp index f01938470..d1a9b6125 100644 --- a/SilKit/source/core/mock/participant/MockParticipant.hpp +++ b/SilKit/source/core/mock/participant/MockParticipant.hpp @@ -346,6 +346,11 @@ class DummyParticipant : public IParticipantInternal return &logger; } + auto GetParameter(Parameter /*parameter*/) -> std::string override + { + return ""; + } + void RegisterSimulator(Core::ISimulator*, std::string, Experimental::NetworkSimulation::SimulatedNetworkType) override { diff --git a/SilKit/source/core/participant/Participant.hpp b/SilKit/source/core/participant/Participant.hpp index 47955a87e..a8feca20d 100644 --- a/SilKit/source/core/participant/Participant.hpp +++ b/SilKit/source/core/participant/Participant.hpp @@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "silkit/services/all.hpp" #include "silkit/services/logging/ILogger.hpp" +#include "silkit/participant/parameters.hpp" #include "ParticipantConfiguration.hpp" #include "ReplayScheduler.hpp" @@ -165,6 +166,9 @@ class Participant : public IParticipantInternal auto GetMetricsManager() -> IMetricsManager* override; auto GetLogger() -> Services::Logging::ILogger* override; + + auto GetParameter(Parameter parameter) -> std::string override; + auto CreateLifecycleService(Services::Orchestration::LifecycleConfiguration startConfiguration) -> Services::Orchestration::ILifecycleService* override; auto GetLifecycleService() -> Services::Orchestration::ILifecycleService* override; diff --git a/SilKit/source/core/participant/Participant_impl.hpp b/SilKit/source/core/participant/Participant_impl.hpp index 2364e1b6a..dfcba031e 100644 --- a/SilKit/source/core/participant/Participant_impl.hpp +++ b/SilKit/source/core/participant/Participant_impl.hpp @@ -1048,6 +1048,25 @@ auto Participant::GetLoggerInternal() -> Services::Logging::I return _logger.get(); } +template +auto Participant::GetParameter(Parameter parameter) -> std::string +{ + switch (parameter) + { + case Parameter::ParticipantName: + return GetParticipantName(); + break; + case Parameter::RegistryUri: + return GetRegistryUri(); + break; + case Parameter::Undefined: + break; + } + + throw SilKit::SilKitError("Unknown parameter."); +} + + template void Participant::SendMsg(const IServiceEndpoint* from, const Can::WireCanFrameEvent& msg) { diff --git a/SilKit/source/services/orchestration/TimeSyncService.cpp b/SilKit/source/services/orchestration/TimeSyncService.cpp index 9b093274a..363d8848d 100644 --- a/SilKit/source/services/orchestration/TimeSyncService.cpp +++ b/SilKit/source/services/orchestration/TimeSyncService.cpp @@ -486,7 +486,6 @@ void TimeSyncService::ExecuteSimStep(std::chrono::nanoseconds timePoint, std::ch _waitTimeMonitor.StopMeasurement(); const auto waitingDuration = _waitTimeMonitor.CurrentDuration(); - const auto waitingDurationMs = std::chrono::duration_cast(waitingDuration); const auto waitingDurationS = std::chrono::duration_cast(waitingDuration); {