pvAccessCPP  7.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 
29 namespace epics
30 {
31 
32 namespace pvAccess
33 {
34 
39 class epicsShareClass RPCClient
40 {
41 public:
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 
82  void issueConnect();
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 
114  void issueRequest(
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 
126 private:
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&);
138  RPCClient& operator=(const RPCClient&);
139 };
140 
141 }
142 
143 }
144 
145 #endif
146 
147 
complex< _Tp > & operator=(const _Tp &)
RPCClient is an interface class that is used by a service client.
Definition: rpcClient.h:39