diff --git a/quality/visibility_guard/public_targets.golden b/quality/visibility_guard/public_targets.golden index b01d4c6583..0bff14d961 100644 --- a/quality/visibility_guard/public_targets.golden +++ b/quality/visibility_guard/public_targets.golden @@ -43,5 +43,6 @@ //score/mw/service:factory //score/mw/service:provided_service //score/mw/service:provided_service_container +//score/mw/service:proxy_data //score/mw/service:proxy_future //score/mw/service:service diff --git a/score/mw/service/BUILD b/score/mw/service/BUILD index 9110fdb6eb..6bc1ac1476 100644 --- a/score/mw/service/BUILD +++ b/score/mw/service/BUILD @@ -56,3 +56,13 @@ cc_library( ":service", ], ) + +cc_library( + name = "proxy_data", + hdrs = ["proxy_data.h"], + features = COMPILER_WARNING_FEATURES, + visibility = ["//visibility:public"], + deps = [ + ":service", + ], +) diff --git a/score/mw/service/provided_service_container.h b/score/mw/service/provided_service_container.h index 4fe3e3adad..fc7e210acb 100644 --- a/score/mw/service/provided_service_container.h +++ b/score/mw/service/provided_service_container.h @@ -69,12 +69,14 @@ class ProvidedServices final : public ProvidedServicesBase template ProvidedServices& Add(Args&&... args) & { + ++count_; return *this; } template ProvidedServices&& Add(Args&&... args) && { + ++count_; return std::move(*this); } @@ -168,7 +170,7 @@ class ProvidedServices final : public ProvidedServicesBase std::size_t Count() const noexcept override { - return 0; + return count_; } /// @brief Start all contained valid service instances @@ -178,7 +180,13 @@ class ProvidedServices final : public ProvidedServicesBase void StopAll() override {} /// @brief Swap the content of this object with another one - void Swap(ProvidedServices& other) noexcept {} + void Swap(ProvidedServices& other) noexcept + { + std::swap(count_, other.count_); + } + + private: + std::size_t count_{0U}; }; class ProvidedServiceContainer diff --git a/score/mw/service/proxy_data.h b/score/mw/service/proxy_data.h new file mode 100644 index 0000000000..14a2fa8dc8 --- /dev/null +++ b/score/mw/service/proxy_data.h @@ -0,0 +1,35 @@ +// ******************************************************************************* +// Copyright (c) 2026 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 +// ******************************************************************************* + +#ifndef SCORE_MW_SERVICE_PROXY_DATA_H +#define SCORE_MW_SERVICE_PROXY_DATA_H + +#include "score/mw/service/proxy_needs.h" + +namespace score +{ +namespace mw +{ +namespace service +{ + +/// @brief Stub alias for OptionalProxyData — wraps an optional proxy instance. +/// @tparam T The proxy interface type +template +using OptionalProxyData = Optional; + +} // namespace service +} // namespace mw +} // namespace score + +#endif // SCORE_MW_SERVICE_PROXY_DATA_H