PLCnext API Documentation 24.0.0.71
RscServiceProxyBase.hxx
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Rsc/Services/Rsc.h"
9#include "Arp/System/Rsc/Services/IRscServiceProxy.hpp"
10#include "Arp/System/Rsc/Services/RscClient.hpp"
11
12namespace Arp { namespace System { namespace Rsc { namespace Services
13{
14
15// forwards
16class RscClient;
17
22template<class TServiceInterface>
23class RscServiceProxyBase : public IRscServiceProxy, public TServiceInterface
24{
25protected: // usings
26 using IRscService = TServiceInterface;
27 using Base = RscServiceProxyBase<TServiceInterface>;
28
29protected: // construction/destruction
31 RscServiceProxyBase(RscHandle providerHandle, RscHandle serviceHandle, RscClient& rscClient);
33 ~RscServiceProxyBase(void)override = default;
34
35protected: // IServiceProxy operations
36 RscHandle GetServiceProviderHandle(void)override;
37 RscHandle GetServiceHandle(void)override;
38 void ReadServiceHandle(void)override;
39
40private: // deleted methods (for non-copyable classes)
41 RscServiceProxyBase(const RscServiceProxyBase& arg); // = delete;
42 RscServiceProxyBase& operator=(const RscServiceProxyBase& arg); // = delete;
43
44protected: // fields
45 RscHandle rscServiceProviderHandle;
46 RscHandle rscServiceHandle;
47 RscClient& rscClient;
48};
49
51// inline methods of class RscServiceProxyBase
52template<class TServiceInterface>
53inline RscServiceProxyBase<TServiceInterface>::RscServiceProxyBase(RscHandle providerHandle, RscHandle serviceHandle, RscClient& rscClient)
54 : rscServiceProviderHandle(providerHandle)
55 , rscServiceHandle(serviceHandle)
56 , rscClient(rscClient)
57{
58}
59
60template<class TServiceInterface>
61inline RscHandle RscServiceProxyBase<TServiceInterface>::GetServiceHandle()
62{
63 return this->rscServiceHandle;
64}
65
66template<class TServiceInterface>
67inline RscHandle RscServiceProxyBase<TServiceInterface>::GetServiceProviderHandle()
68{
69 return this->rscServiceProviderHandle;
70}
71
72template<class TServiceInterface>
73inline void RscServiceProxyBase<TServiceInterface>::ReadServiceHandle()
74{
75 this->rscServiceHandle = this->rscClient.GetServiceHandle(this->rscServiceProviderHandle, TServiceInterface::GetProxyFactory().GetServiceName());
76}
77
78}}}} // end of namespace Arp::System::Rsc::Services
@ System
System components used by the System, Device, Plc or Io domains.
Root namespace for the PLCnext API