1313#ifndef SCORE_MW_COM_IMPL_PLUMBING_PROXY_FIELD_BINDING_FACTORY_IMPL_H
1414#define SCORE_MW_COM_IMPL_PLUMBING_PROXY_FIELD_BINDING_FACTORY_IMPL_H
1515
16- #include " score/mw/com/impl/bindings/lola/element_fq_id.h"
1716#include " score/mw/com/impl/bindings/lola/proxy_event.h"
1817#include " score/mw/com/impl/plumbing/i_proxy_field_binding_factory.h"
18+ #include " score/mw/com/impl/plumbing/proxy_method_binding_factory_impl.h"
1919#include " score/mw/com/impl/plumbing/proxy_service_element_binding_factory_impl.h"
2020#include " score/mw/com/impl/proxy_base.h"
2121#include " score/mw/com/impl/proxy_event_binding.h"
2222
23- #include < score/overload.hpp>
24-
2523#include < memory>
2624#include < string_view>
2725
2826namespace score ::mw::com::impl
2927{
3028
29+ namespace detail
30+ {
31+ constexpr char kGetMethodName [] = " Get" ;
32+ constexpr char kSetMethodName [] = " Set" ;
33+ } // namespace detail
34+
3135// / \brief Factory class that dispatches calls to the appropriate binding based on binding information in the
3236// / deployment configuration.
3337template <typename SampleType>
@@ -42,11 +46,17 @@ class ProxyFieldBindingFactoryImpl final : public IProxyFieldBindingFactory<Samp
4246 std::unique_ptr<ProxyEventBinding<SampleType>> CreateEventBinding (
4347 ProxyBase& parent,
4448 const std::string_view field_name) noexcept override ;
49+
50+ std::unique_ptr<ProxyMethodBinding> CreateGetMethodBinding (ProxyBase& parent,
51+ const std::string_view field_name) noexcept override ;
52+
53+ std::unique_ptr<ProxyMethodBinding> CreateSetMethodBinding (ProxyBase& parent,
54+ const std::string_view field_name) noexcept override ;
4555};
4656
4757template <typename SampleType>
4858// Suppress "AUTOSAR C++14 A15-5-3" rule finding. This rule states: "The std::terminate() function shall
49- // not be called implicitly. ". std::visit Throws std::bad_variant_access if
59+ // not be called implicitly". std::visit Throws std::bad_variant_access if
5060// as-variant(vars_i).valueless_by_exception() is true for any variant vars_i in vars. The variant may only become
5161// valueless if an exception is thrown during different stages. Since we don't throw exceptions, it's not possible
5262// that the variant can return true from valueless_by_exception and therefore not possible that std::visit throws
@@ -62,6 +72,24 @@ inline std::unique_ptr<ProxyEventBinding<SampleType>> ProxyFieldBindingFactoryIm
6272 ServiceElementType::FIELD>(parent, field_name);
6373}
6474
75+ template <typename SampleType>
76+ inline std::unique_ptr<ProxyMethodBinding> ProxyFieldBindingFactoryImpl<SampleType>::CreateGetMethodBinding(
77+ ProxyBase& parent,
78+ const std::string_view field_name) noexcept
79+ {
80+ return ProxyMethodBindingFactoryImpl<SampleType ()>::Create (
81+ parent.GetHandle (), ProxyBaseView{parent}.GetBinding (), detail::kGetMethodName );
82+ }
83+
84+ template <typename SampleType>
85+ inline std::unique_ptr<ProxyMethodBinding> ProxyFieldBindingFactoryImpl<SampleType>::CreateSetMethodBinding(
86+ ProxyBase& parent,
87+ const std::string_view field_name) noexcept
88+ {
89+ return ProxyMethodBindingFactoryImpl<SampleType (SampleType)>::Create (
90+ parent.GetHandle (), ProxyBaseView{parent}.GetBinding (), detail::kSetMethodName );
91+ }
92+
6593} // namespace score::mw::com::impl
6694
6795#endif // SCORE_MW_COM_IMPL_PLUMBING_PROXY_FIELD_BINDING_FACTORY_IMPL_H
0 commit comments