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