PLCnext API Documentation 25.0.2.69
RscServiceStubBase.hxx
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Rsc/Commons/Rsc.hpp"
9#include "Arp/Base/Rsc/Commons/Services/IRscServiceStub.hpp"
10#include <memory>
11
12namespace Arp::Base::Rsc::Commons::Services
13{
14
15// forwards
16class RscServerContext; // used by any service stub
17
23template<class T>
25{
26protected: // usings
27 using ServiceImplType = T;
28 using ServiceImplPtr = std::shared_ptr<ServiceImplType>;
29
30public: // construction
31 explicit RscServiceStubBase(ServiceImplPtr serviceImplPtr);
32
33public: // getter
35
36public: // abstract IRscServiceStub operations
37 virtual void Invoke(SerializationContext& context) = 0;
38
39private: // fields
40 ServiceImplPtr serviceImplPtr;
41};
42
44// inline methods of class RscServiceStubBase
45
49template<class T>
51 : serviceImplPtr(serviceImplPtr)
52{
53}
54
58template<class T>
60{
61 return *this->serviceImplPtr;
62}
63
64} // end of namespace Arp::Base::Rsc::Commons::Services
Generic interface of service stubs used to invoke services.
Definition: IRscServiceStub.hpp:19
Base class for for Rsc service stub implementations.
Definition: RscServiceStubBase.hxx:25
virtual void Invoke(SerializationContext &context)=0
Invokes a service operation polymorphic.
T ServiceImplType
The type of the service implementation (e.g. DemoServiceImpl)
Definition: RscServiceStubBase.hxx:27
ServiceImplType & GetServiceImpl(void) const
Gets the service implementation instance.
Definition: RscServiceStubBase.hxx:59
RscServiceStubBase(ServiceImplPtr serviceImplPtr)
Constructs a RscServiceStubBase instance.
Definition: RscServiceStubBase.hxx:50
std::shared_ptr< ServiceImplType > ServiceImplPtr
The type of the service implementation pointer.
Definition: RscServiceStubBase.hxx:28
This class serves as base class for all serialization contexts supported by RSC.
Definition: SerializationContext.hpp:23