pvAccessCPP 7.1.8
Loading...
Searching...
No Matches
rpcClient.h
1
7#ifndef RPCCLIENT_H
8#define RPCCLIENT_H
9
10#include <string>
11
12#ifdef epicsExportSharedSymbols
13# define rpcClientEpicsExportSharedSymbols
14# undef epicsExportSharedSymbols
15#endif
16#include <pv/pvData.h>
17#include <pv/valueBuilder.h>
18#ifdef rpcClientEpicsExportSharedSymbols
19# define epicsExportSharedSymbols
20# undef rpcClientEpicsExportSharedSymbols
21#endif
22
23#include <pv/rpcService.h>
24
25#include <shareLib.h>
26
27#define RPCCLIENT_DEFAULT_TIMEOUT 5.0
28
29namespace epics
30{
31
32namespace pvAccess
33{
34
39class epicsShareClass RPCClient
40{
41public:
42 POINTER_DEFINITIONS(RPCClient);
43
51 static shared_pointer create(const std::string & serviceName,
52 epics::pvData::PVStructure::shared_pointer const & pvRequest = epics::pvData::PVStructure::shared_pointer());
53
54 RPCClient(const std::string & serviceName,
55 epics::pvData::PVStructure::shared_pointer const & pvRequest,
56 const ChannelProvider::shared_pointer& provider = ChannelProvider::shared_pointer(),
57 const std::string& address = std::string());
58
59 ~RPCClient() {destroy();}
60
61
62
66 void destroy();
67
76 bool connect(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
77
83
90 bool waitConnect(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
91
102 epics::pvData::PVStructure::shared_pointer request(
103 epics::pvData::PVStructure::shared_pointer const & pvArgument,
104 double timeout = RPCCLIENT_DEFAULT_TIMEOUT,
105 bool lastRequest = false);
106
115 epics::pvData::PVStructure::shared_pointer const & pvArgument,
116 bool lastRequest = false);
117
124 epics::pvData::PVStructure::shared_pointer waitResponse(double timeout = RPCCLIENT_DEFAULT_TIMEOUT);
125
126private:
127
128 const std::string m_serviceName;
129 ChannelProvider::shared_pointer m_provider;
130 Channel::shared_pointer m_channel;
131 ChannelRPC::shared_pointer m_rpc;
132 const epics::pvData::PVStructure::shared_pointer m_pvRequest;
133
134 struct RPCRequester;
135 std::tr1::shared_ptr<RPCRequester> m_rpc_requester;
136
137 RPCClient(const RPCClient&);
139};
140
141}
142
143}
144
145#endif
146
147
constexpr complex< _Tp > & operator=(const _Tp &)
RPCClient is an interface class that is used by a service client.
Definition rpcClient.h:40
void issueRequest(epics::pvData::PVStructure::shared_pointer const &pvArgument, bool lastRequest=false)
Issue a channelRPC request and return immediately.
static shared_pointer create(const std::string &serviceName, epics::pvData::PVStructure::shared_pointer const &pvRequest=epics::pvData::PVStructure::shared_pointer())
Create a RPCClient.
void destroy()
Destroy this instance (i.e.
void issueConnect()
Issue a connect request and return immediately.
epics::pvData::PVStructure::shared_pointer waitResponse(double timeout=5.0)
Wait for the request to complete.
bool connect(double timeout=5.0)
Connect to the server.
bool waitConnect(double timeout=5.0)
Wait for the connect request to complete.
epics::pvData::PVStructure::shared_pointer request(epics::pvData::PVStructure::shared_pointer const &pvArgument, double timeout=5.0, bool lastRequest=false)
Sends a request and wait for the response or until timeout occurs.
Copyright - See the COPYRIGHT that is included with this distribution.