PLCnext API Documentation 25.0.2.69
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
15namespace Arp::Base::Rsc::Commons::Services
16{
17
18// type imports
20
25class ARP_EXPORT RscClient
26{
27public: // Impl forward declaration
28 class Impl;
29
30public: // nested forward declaration
31 class TransactionGuard;
32
33public: // construction
34 RscClient(const String& ipcAppName);
35 RscClient(const Url& url = Url::GetEmpty());
36
37 // canonical construction/destruction/assignment
38 RscClient(const RscClient& arg) = delete;
39 RscClient(RscClient&& arg)noexcept;
40 RscClient& operator=(const RscClient& arg) = delete;
41 RscClient& operator=(RscClient&& arg)noexcept;
43
44public: // setter/getter operations
45 bool IsIpc(void)const;
46 bool IsConnected(void)const;
47 RscReader& GetReader(void);
48 RscWriter& GetWriter(void);
49
50public: // operations
51 void Connect(const Url& url = Url::GetEmpty());
52 bool TryConnect(const Url& url = Url::GetEmpty());
53 void Reconnect(const Url& url = Url::GetEmpty());
54 bool TryReconnect(const Url& url = Url::GetEmpty());
55 void Close(bool disconnectRemoting = true);
56 void Authenticate(SecurityToken authenticationToken);
57 RscHandle GetServiceProviderHandle(const char* serviceProviderName);
58 RscHandle GetServiceHandle(RscHandle serviceProviderHandle, const char* serviceName);
59 RscHandle GetServiceHandle(const char* serviceProviderName, const char* serviceName);
60 void GetServiceHandles(const char* serviceProviderName, const char* serviceName, RscHandle& serviceProviderHandle, RscHandle& serviceHandle);
61
62public: // internal operations
63 Impl& GetImpl(void);
64 const Impl& GetImpl(void)const;
65
66private: // Impl usings
67 using Pimpl = PimplPtr<Impl>;
68
69private: // Impl fields
70 Pimpl pimpl;
71};
72
73} // 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
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.