PLCnext API Documentation 26.0.1.58
RscClient.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/PimplPtr.hxx"
9#include "Arp/Base/Commons/Net/Url.hpp"
10#include "Arp/Base/Commons/Security/SecurityToken.hpp"
11#include "Arp/Base/Rsc/Commons/Rsc.hpp"
12#include "Arp/Base/Rsc/Commons/Services/RscReader.hpp"
13#include "Arp/Base/Rsc/Commons/Services/RscWriter.hpp"
14#include "Arp/Base/Rsc/Commons/Services/RscServiceHandle.hpp"
15
16namespace Arp::Base::Rsc::Commons::Services
17{
18
19// type imports
21
26class ARP_EXPORT RscClient
27{
28public: // nested types forward declaration
29 class Impl;
30 class TransactionGuard;
31
32public: // construction
33 RscClient(const String& ipcAppName);
34 RscClient(const Url& url = Url::GetEmpty());
35
36 // canonical construction/destruction/assignment
37 RscClient(const RscClient& arg) = delete;
38 RscClient(RscClient&& arg)noexcept;
39 RscClient& operator=(const RscClient& arg) = delete;
40 RscClient& operator=(RscClient&& arg)noexcept;
42
43public: // setter/getter operations
44 bool IsIpc(void)const;
45 bool IsConnected(void)const;
46 RscReader& GetReader(void);
47 RscWriter& GetWriter(void);
48
49public: // operations
50 void Connect(const Url& url = Url::GetEmpty());
51 bool TryConnect(const Url& url = Url::GetEmpty());
52 void Reconnect(const Url& url = Url::GetEmpty());
53 bool TryReconnect(const Url& url = Url::GetEmpty());
54 void Disconnect(void);
55 void Close(bool disconnectRemoting = true);
56 void Authenticate(SecurityToken authenticationToken);
57 RscHandle GetServiceHandle(RscHandle serviceProviderHandle, const char* serviceName);
58 RscHandle GetServiceHandle(const char* serviceProviderName, const char* serviceName);
59 RscHandle GetServiceProviderHandle(const char* serviceProviderName);
60 void GetServiceHandles(const char* serviceProviderName, const char* serviceName, RscHandle& serviceProviderHandle, RscHandle& serviceHandle);
61 void GetRscServiceHandle(const char* serviceProviderName, const char* serviceName, RscServiceHandle& rscServiceHandle);
62
63public: // internal operations
64 Impl& GetImpl(void);
65 const Impl& GetImpl(void)const;
66
67private: // Impl usings
68 using Pimpl = PimplPtr<Impl>;
69
70private: // Impl fields
71 Pimpl pimpl;
72};
73
74} // end of namespace Arp::Base::Rsc::Commons::Services
This class implements represents a Uniform Resource Locator.
Definition: Url.hpp:25
static Url GetEmpty(void)
Returns an empty Url.
Definition: Url.cpp:84
This class is used for authorization of arbitrary operations.
Definition: SecurityToken.hpp:18
Adapter class to implement PImpl idiom.
Definition: PimplPtr.hxx:15
This class monitors a RSC client call using RAII idiom.
Definition: RscClient.TransactionGuard.hpp:18
RscClient(RscClient &&arg) noexcept
The default move constructor.
~RscClient(void)
The default destructor.
RscClient & operator=(RscClient &&arg) noexcept
The default move-assignment operator.
Reads marshaled data of RSC services.
Definition: RscReader.hpp:34
This class is used for adressing RSC service instances remotely.
Definition: RscServiceHandle.hpp:22
Writes marshalled data of RSC services.
Definition: RscWriter.hpp:34
@ IsConnected
A connect request was made on an already connected socket.
@ Connect
Connect operation should be polled.