Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
Client.h
Go to the documentation of this file.
1
23
24#pragma once
25
31#include <boost/atomic.hpp>
32#include <set>
33
34#ifdef _MSVC_VER
35#pragma warning(push)
36#pragma warning(disable : 4996)
37#endif
38#include <boost/signals2.hpp>
39
40namespace RobotRaconteur
41{
42class ROBOTRACONTEUR_CORE_API ClientContext;
43class ROBOTRACONTEUR_CORE_API PipeClientBase;
44class ROBOTRACONTEUR_CORE_API WireClientBase;
45
46class ROBOTRACONTEUR_CORE_API ServiceStub : public virtual RRObject, public RR_ENABLE_SHARED_FROM_THIS<ServiceStub>
47{
48
49 public:
50 ServiceStub(boost::string_ref path, const RR_SHARED_PTR<ClientContext>& c);
51
52 std::string ServicePath;
53
54 RR_WEAK_PTR<ClientContext> context;
55
56 uint32_t RREndpoint;
57
58 RR_SHARED_PTR<boost::recursive_mutex> RRMutex;
59
60 RR_SHARED_PTR<ClientContext> GetContext();
61
62 RR_INTRUSIVE_PTR<MessageEntry> ProcessRequest(const RR_INTRUSIVE_PTR<MessageEntry>& m);
63
64 void AsyncProcessRequest(const RR_INTRUSIVE_PTR<MessageEntry>& m,
65 RR_MOVE_ARG(boost::function<void(const RR_INTRUSIVE_PTR<MessageEntry>&,
66 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
67 int32_t timeout = RR_TIMEOUT_INFINITE);
68
69 virtual void DispatchEvent(const RR_INTRUSIVE_PTR<MessageEntry>& m) = 0;
70
71 RR_SHARED_PTR<RRObject> FindObjRef(boost::string_ref n);
72
73 void AsyncFindObjRef(boost::string_ref n,
74 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<RRObject>&,
75 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
76 int32_t timeout = RR_TIMEOUT_INFINITE);
77
78 RR_SHARED_PTR<RRObject> FindObjRef(boost::string_ref n, boost::string_ref i);
79
80 RR_SHARED_PTR<RRObject> FindObjRefTyped(boost::string_ref n, boost::string_ref objecttype);
81
82 RR_SHARED_PTR<RRObject> FindObjRefTyped(boost::string_ref n, boost::string_ref i, boost::string_ref objecttype);
83
84 void AsyncFindObjRef(boost::string_ref n, boost::string_ref i,
85 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<RRObject>&,
86 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
87 int32_t timeout = RR_TIMEOUT_INFINITE);
88
89 void AsyncFindObjRefTyped(boost::string_ref n, boost::string_ref objecttype,
90 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<RRObject>&,
91 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
92 int32_t timeout = RR_TIMEOUT_INFINITE);
93
94 void AsyncFindObjRefTyped(boost::string_ref n, boost::string_ref i, boost::string_ref objecttype,
95 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<RRObject>&,
96 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
97 int32_t timeout = RR_TIMEOUT_INFINITE);
98
99 template <typename T>
100 static void EndAsyncFindObjRef(
101 const RR_SHARED_PTR<RRObject>& obj, const RR_SHARED_PTR<RobotRaconteurException>& err,
102 const boost::function<void(const RR_SHARED_PTR<T>&, const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
103
104 std::string FindObjectType(boost::string_ref n);
105
106 std::string FindObjectType(boost::string_ref n, boost::string_ref i);
107
108 void AsyncFindObjectType(boost::string_ref n,
109 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<std::string>&,
110 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
111 int32_t timeout = RR_TIMEOUT_INFINITE);
112
113 void AsyncFindObjectType(boost::string_ref n, boost::string_ref i,
114 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<std::string>&,
115 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
116 int32_t timeout = RR_TIMEOUT_INFINITE);
117
118 void AsyncSendPipeMessage(const RR_INTRUSIVE_PTR<MessageEntry>& m, bool unreliable,
119 const boost::function<void(const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
120
121 void SendWireMessage(const RR_INTRUSIVE_PTR<MessageEntry>& m);
122
123 virtual void DispatchPipeMessage(const RR_INTRUSIVE_PTR<MessageEntry>& m);
124
125 virtual void DispatchWireMessage(const RR_INTRUSIVE_PTR<MessageEntry>& m);
126
127 virtual RR_INTRUSIVE_PTR<MessageEntry> CallbackCall(const RR_INTRUSIVE_PTR<MessageEntry>& m);
128
129 RR_OVIRTUAL std::string RRType() RR_OVERRIDE { return "RobotRaconteur.ServiceStub"; }
130
131 virtual void RRClose();
132
133 virtual void RRInitStub() = 0;
134
135 virtual RR_SHARED_PTR<PipeClientBase> RRGetPipeClient(boost::string_ref membername);
136
137 virtual RR_SHARED_PTR<WireClientBase> RRGetWireClient(boost::string_ref membername);
138
139 RR_SHARED_PTR<RobotRaconteurNode> RRGetNode();
140 RR_WEAK_PTR<RobotRaconteurNode> RRGetNodeWeak();
141
142 protected:
143 RR_WEAK_PTR<RobotRaconteurNode> node;
144};
145
146struct ROBOTRACONTEUR_CORE_API PullServiceDefinitionReturn
147{
148 RR_SHARED_PTR<ServiceDefinition> def;
149 RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> > attributes;
150 std::set<std::string> extra_imports;
151};
152
153struct ROBOTRACONTEUR_CORE_API PullServiceDefinitionAndImportsReturn
154{
155 std::vector<RR_SHARED_PTR<ServiceDefinition> > defs;
156 RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> > attributes;
157 std::set<std::string> extra_imports;
158};
159
160class ROBOTRACONTEUR_CORE_API ClientContext : public Endpoint, public RR_ENABLE_SHARED_FROM_THIS<ClientContext>
161{
162 protected:
163 RR_UNORDERED_MAP<MessageStringPtr, RR_SHARED_PTR<ServiceStub> > stubs;
164 boost::mutex stubs_lock;
165 std::list<std::string> active_stub_searches;
166 std::list<boost::tuple<std::string, boost::function<void(const RR_SHARED_PTR<RRObject>&,
167 const RR_SHARED_PTR<RobotRaconteurException>&)> > >
168 active_stub_searches_handlers;
169
170 RR_SHARED_PTR<ServiceFactory> m_ServiceDef;
171
172 public:
173 RR_SHARED_PTR<ServiceFactory> GetServiceDef() const;
174
175 ClientContext(const RR_SHARED_PTR<RobotRaconteurNode>& node);
176
177 ClientContext(const RR_SHARED_PTR<ServiceFactory>& service_def, const RR_SHARED_PTR<RobotRaconteurNode>& node);
178
179 RR_SHARED_PTR<RRObject> FindObjRef(boost::string_ref path, boost::string_ref objecttype = "");
180
181 void AsyncFindObjRef(boost::string_ref path, boost::string_ref objecttype2,
182 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<RRObject>&,
183 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
184 int32_t timeout = RR_TIMEOUT_INFINITE);
185
186 template <typename T>
187 static void EndAsyncFindObjRef(
188 const RR_SHARED_PTR<RRObject>& obj, const RR_SHARED_PTR<RobotRaconteurException>& err,
189 const boost::function<void(const RR_SHARED_PTR<T>&, const RR_SHARED_PTR<RobotRaconteurException>&)>& handler)
190 {
191 if (err)
192 {
193 handler(RR_SHARED_PTR<T>(), err);
194 return;
195 }
196 else
197 {
198 RR_SHARED_PTR<T> castobj = RR_DYNAMIC_POINTER_CAST<T>(obj);
199 if (!castobj)
200 {
201 handler(RR_SHARED_PTR<T>(), RR_MAKE_SHARED<DataTypeMismatchException>("Invalid object type returned"));
202 return;
203 }
204 handler(castobj, RR_SHARED_PTR<RobotRaconteurException>());
205 }
206 }
207
208 protected:
209 void AsyncFindObjRef1(const RR_INTRUSIVE_PTR<MessageEntry>& ret, const RR_SHARED_PTR<RobotRaconteurException>& err,
210 const std::string& path, const std::string& objecttype2,
211 const boost::function<void(const RR_SHARED_PTR<RRObject>&,
212 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler,
213 int32_t timeout);
214
215 void AsyncFindObjRef2(const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>& ret,
216 const RR_SHARED_PTR<RobotRaconteurException>& err, const std::string& objecttype,
217 const std::string& objectdef, const std::string& path, const std::string& objecttype2,
218 const boost::function<void(const RR_SHARED_PTR<RRObject>&,
219 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler,
220 int32_t timeout);
221
222 void AsyncFindObjRef3(const RR_SHARED_PTR<RRObject>& ret, const RR_SHARED_PTR<RobotRaconteurException>& err,
223 const std::string& path,
224 const boost::function<void(const RR_SHARED_PTR<RRObject>&,
225 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
226
227 public:
228 std::string FindObjectType(boost::string_ref path);
229
230 void AsyncFindObjectType(boost::string_ref path,
231 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<std::string>&,
232 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
233 int32_t timeout = RR_TIMEOUT_INFINITE);
234
235 bool VerifyObjectImplements(boost::string_ref objecttype, boost::string_ref implementstype);
236
237 protected:
238 void AsyncFindObjectType1(const RR_INTRUSIVE_PTR<MessageEntry>& ret,
239 const RR_SHARED_PTR<RobotRaconteurException>& err, const std::string& path,
240 const boost::function<void(const RR_SHARED_PTR<std::string>&,
241 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
242
243 private:
244 boost::mutex pulled_service_defs_lock;
245 std::map<std::string, RR_SHARED_PTR<ServiceDefinition> > pulled_service_defs;
246
247 bool VerifyObjectImplements2(boost::string_ref objecttype, boost::string_ref implementstype);
248
249 struct outstanding_request
250 {
251 RR_INTRUSIVE_PTR<MessageEntry> ret;
252 RR_SHARED_PTR<AutoResetEvent> evt;
253 boost::function<void(const RR_INTRUSIVE_PTR<MessageEntry>& ret, const RR_SHARED_PTR<RobotRaconteurException>&)>
254 handler;
255 RR_SHARED_PTR<Timer> timer;
256 };
257
258 boost::mutex outstanding_requests_lock;
259 RR_UNORDERED_MAP<uint32_t, RR_SHARED_PTR<outstanding_request> > outstanding_requests;
260
261 boost::mutex FindObjRef_lock;
262
263 public:
264 RR_INTRUSIVE_PTR<MessageEntry> ProcessRequest(const RR_INTRUSIVE_PTR<MessageEntry>& m);
265
266 void AsyncProcessRequest(const RR_INTRUSIVE_PTR<MessageEntry>& m,
267 RR_MOVE_ARG(boost::function<void(const RR_INTRUSIVE_PTR<MessageEntry>&,
268 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
269 int32_t timeout = RR_TIMEOUT_INFINITE);
270
271 using Endpoint::SendMessage;
272 void SendMessage(const RR_INTRUSIVE_PTR<MessageEntry>& m);
273
274 using Endpoint::AsyncSendMessage;
275 void AsyncSendMessage(const RR_INTRUSIVE_PTR<MessageEntry>& m,
276 const boost::function<void(const RR_SHARED_PTR<RobotRaconteurException>&)>& callback);
277
278 private:
279 void AsyncProcessRequest_err(const RR_SHARED_PTR<RobotRaconteurException>& error, uint32_t requestid);
280
281 void AsyncProcessRequest_timeout(const TimerEvent& error, uint32_t requestid);
282
283 uint32_t request_number;
284
285 RR_SHARED_PTR<Timer> connection_test_timer;
286
287 void connection_test(const TimerEvent& ev);
288
289 public:
290 RR_OVIRTUAL void MessageReceived(const RR_INTRUSIVE_PTR<Message>& m) RR_OVERRIDE;
291
292 protected:
293 void MessageEntryReceived(const RR_INTRUSIVE_PTR<MessageEntry>& m);
294
295 std::string m_ServiceName;
296
297 public:
298 std::string GetServiceName() const;
299
300 bool GetConnected() const;
301
302 protected:
303 bool m_Connected;
304 boost::mutex m_Connected_lock;
305 boost::mutex close_lock;
306
307 private:
308 RR_SHARED_PTR<Transport> connecttransport;
309 std::string connecturl;
310
311 public:
312 std::map<std::string, RR_INTRUSIVE_PTR<RRValue> > GetAttributes();
313
314 private:
315 std::map<std::string, RR_INTRUSIVE_PTR<RRValue> > m_Attributes;
316 boost::mutex m_Attributes_lock;
317
318 public:
319 RR_SHARED_PTR<RRObject> ConnectService(const RR_SHARED_PTR<Transport>& c, boost::string_ref url,
320 boost::string_ref username = "",
321 const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials =
322 (RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >()),
323 boost::string_ref objecttype = "");
324
325 RR_SHARED_PTR<RRObject> ConnectService(const RR_SHARED_PTR<Transport>& c,
326 const RR_SHARED_PTR<ITransportConnection>& tc, boost::string_ref url,
327 boost::string_ref username = "",
328 const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials =
329 (RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >()),
330 boost::string_ref objecttype = "");
331
332 void AsyncConnectService(
333 const RR_SHARED_PTR<Transport>& c, boost::string_ref url, boost::string_ref username,
334 const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials, boost::string_ref objecttype,
335 RR_MOVE_ARG(
336 boost::function<void(const RR_SHARED_PTR<RRObject>&, const RR_SHARED_PTR<RobotRaconteurException>&)>)
337 handler,
338 int32_t timeout = RR_TIMEOUT_INFINITE);
339
340 void AsyncConnectService(
341 const RR_SHARED_PTR<Transport>& c, const RR_SHARED_PTR<ITransportConnection>& tc, boost::string_ref url,
342 boost::string_ref username, const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials,
343 boost::string_ref objecttype,
344 RR_MOVE_ARG(
345 boost::function<void(const RR_SHARED_PTR<RRObject>&, const RR_SHARED_PTR<RobotRaconteurException>&)>)
346 handler,
347 int32_t timeout = RR_TIMEOUT_INFINITE);
348
349 protected:
350 // These functions are part of the connection process
351 void AsyncConnectService1(
352 const RR_SHARED_PTR<Transport>& c, const RR_SHARED_PTR<ITransportConnection>& tc,
353 const RR_SHARED_PTR<RobotRaconteurException>& e, const std::string& url, const std::string& username,
354 const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials, const std::string& objecttype,
355 boost::function<void(const RR_SHARED_PTR<RRObject>&, const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
356
357 void AsyncConnectService2(
358 const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>& d, const RR_SHARED_PTR<RobotRaconteurException>& e,
359 const std::string& username, const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials,
360 const std::string& objecttype,
361 boost::function<void(const RR_SHARED_PTR<RRObject>&, const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
362
363 void AsyncConnectService3(
364 const RR_INTRUSIVE_PTR<MessageEntry>& ret, const RR_SHARED_PTR<RobotRaconteurException>& e,
365 const std::string& username, const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials,
366 const std::string& objecttype, const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>& d,
367 const boost::function<void(const RR_SHARED_PTR<RRObject>&, const RR_SHARED_PTR<RobotRaconteurException>&)>&
368 handler);
369
370 void AsyncConnectService4(const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>& d,
371 const RR_SHARED_PTR<RobotRaconteurException>& e, const std::string& username,
372 const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials,
373 const std::string& objecttype, const std::string& type,
374 const boost::function<void(const RR_SHARED_PTR<RRObject>&,
375 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
376
377 void AsyncConnectService5(const RR_INTRUSIVE_PTR<MessageEntry>& ret,
378 const RR_SHARED_PTR<RobotRaconteurException>& e, const std::string& username,
379 const RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >& credentials,
380 const std::string& objecttype, const std::string& type,
381 const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>& d,
382 const boost::function<void(const RR_SHARED_PTR<RRObject>&,
383 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
384
385 void AsyncConnectService6(const RR_SHARED_PTR<std::string>& ret, const RR_SHARED_PTR<RobotRaconteurException>& e,
386 const std::string& type, const std::string& username,
387 const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>& d,
388 const boost::function<void(const RR_SHARED_PTR<RRObject>&,
389 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
390
391 void AsyncConnectService7(const RR_INTRUSIVE_PTR<MessageEntry>& ret,
392 const RR_SHARED_PTR<RobotRaconteurException>& e, const std::string& objecttype,
393 const std::string& username,
394 const boost::function<void(const RR_SHARED_PTR<RRObject>&,
395 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
396
397 boost::recursive_mutex connect_lock;
398
399 public:
400 void Close();
401
402 void AsyncClose(RR_MOVE_ARG(boost::function<void()>) handler);
403
404 protected:
405 void AsyncClose1(const RR_INTRUSIVE_PTR<MessageEntry>& m, const RR_SHARED_PTR<RobotRaconteurException>& err,
406 const boost::function<void()>& handler);
407
408 public:
409 void AsyncSendPipeMessage(const RR_INTRUSIVE_PTR<MessageEntry>& m, bool unreliable,
410 const boost::function<void(const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
411
412 void SendWireMessage(const RR_INTRUSIVE_PTR<MessageEntry>& m);
413
414 PullServiceDefinitionReturn PullServiceDefinition(boost::string_ref ServiceType = "");
415
416 void AsyncPullServiceDefinition(boost::string_ref ServiceType,
417 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<PullServiceDefinitionReturn>&,
418 const RR_SHARED_PTR<RobotRaconteurException>&)>)
419 handler,
420 int32_t timeout = RR_TIMEOUT_INFINITE);
421
422 protected:
423 void AsyncPullServiceDefinition1(const RR_INTRUSIVE_PTR<MessageEntry>& ret3,
424 const RR_SHARED_PTR<RobotRaconteurException>& err, const std::string& ServiceType,
425 boost::function<void(const RR_SHARED_PTR<PullServiceDefinitionReturn>&,
426 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
427
428 public:
429 PullServiceDefinitionAndImportsReturn PullServiceDefinitionAndImports(boost::string_ref servicetype = "");
430
431 void AsyncPullServiceDefinitionAndImports(
432 boost::string_ref servicetype,
433 RR_MOVE_ARG(boost::function<void(const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>&,
434 const RR_SHARED_PTR<RobotRaconteurException>&)>) handler,
435 int32_t timeout = RR_TIMEOUT_INFINITE);
436
437 protected:
438 void AsyncPullServiceDefinitionAndImports1(
439 const RR_SHARED_PTR<PullServiceDefinitionReturn>& pull_ret, const RR_SHARED_PTR<RobotRaconteurException>& err,
440 const std::string& servicetype, const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>& current,
441 boost::function<void(const RR_SHARED_PTR<PullServiceDefinitionAndImportsReturn>&,
442 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler,
443 boost::posix_time::ptime timeout_time);
444
445 public:
446 std::vector<std::string> GetPulledServiceTypes();
447
448 RR_SHARED_PTR<ServiceFactory> GetPulledServiceType(boost::string_ref type);
449
450 private:
451 boost::mutex pulled_service_types_lock;
452 RR_UNORDERED_MAP<std::string, RR_SHARED_PTR<ServiceFactory> > pulled_service_types;
453
454 bool use_pulled_types;
455
456 RR_SHARED_PTR<ITransportConnection> TransportConnection;
457
458 boost::mutex m_Authentication_lock;
459
460 bool m_UserAuthenticated;
461
462 public:
463 const bool GetUserAuthenticated();
464
465 private:
466 std::string m_AuthenticatedUsername;
467
468 public:
469 const std::string GetAuthenticatedUsername();
470
471 std::string AuthenticateUser(boost::string_ref username, const RR_INTRUSIVE_PTR<RRValue>& credentials);
472
473 void AsyncAuthenticateUser(
474 boost::string_ref username, const RR_INTRUSIVE_PTR<RRValue>& credentials,
475 RR_MOVE_ARG(
476 boost::function<void(const RR_SHARED_PTR<std::string>&, const RR_SHARED_PTR<RobotRaconteurException>&)>)
477 handler,
478 int32_t timeout = RR_TIMEOUT_INFINITE);
479
480 protected:
481 void AsyncAuthenticateUser2(const RR_INTRUSIVE_PTR<MessageEntry>& ret,
482 const RR_SHARED_PTR<RobotRaconteurException>& err, const std::string& username,
483 boost::function<void(const RR_SHARED_PTR<std::string>&,
484 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
485
486 public:
487 std::string LogoutUser();
488
489 std::string RequestObjectLock(const RR_SHARED_PTR<RRObject>& obj, RobotRaconteurObjectLockFlags flags);
490
491 void AsyncRequestObjectLock(
492 const RR_SHARED_PTR<RRObject>& obj, RobotRaconteurObjectLockFlags flags,
493 RR_MOVE_ARG(
494 boost::function<void(const RR_SHARED_PTR<std::string>&, const RR_SHARED_PTR<RobotRaconteurException>&)>)
495 handler,
496 int32_t timeout = RR_TIMEOUT_INFINITE);
497
498 protected:
499 void EndAsyncLockOp(const RR_INTRUSIVE_PTR<MessageEntry>& ret, const RR_SHARED_PTR<RobotRaconteurException>& err,
500 boost::function<void(const RR_SHARED_PTR<std::string>&,
501 const RR_SHARED_PTR<RobotRaconteurException>&)>& handler);
502
503 public:
504 std::string ReleaseObjectLock(const RR_SHARED_PTR<RRObject>& obj);
505
506 void AsyncReleaseObjectLock(
507 const RR_SHARED_PTR<RRObject>& obj,
508 RR_MOVE_ARG(
509 boost::function<void(const RR_SHARED_PTR<std::string>&, const RR_SHARED_PTR<RobotRaconteurException>&)>)
510 handler,
511 int32_t timeout = RR_TIMEOUT_INFINITE);
512
513 std::string MonitorEnter(const RR_SHARED_PTR<RRObject>& obj, int32_t timeout);
514
515 void MonitorExit(const RR_SHARED_PTR<RRObject>& obj);
516
517 RR_OVIRTUAL void PeriodicCleanupTask() RR_OVERRIDE;
518
519 uint32_t CheckServiceCapability(boost::string_ref name);
520
521 boost::signals2::signal<void(const RR_SHARED_PTR<ClientContext>&, ClientServiceListenerEventType,
522 const RR_SHARED_PTR<void>&)>
523 ClientServiceListener;
524
525 protected:
526 void ProcessCallbackCall(const RR_INTRUSIVE_PTR<MessageEntry>& m);
527
528 boost::atomic<bool> use_combined_connection;
529
530 public:
531 RR_OVIRTUAL void TransportConnectionClosed(uint32_t endpoint) RR_OVERRIDE;
532
533 virtual void TransportConnectionClosed1();
534};
535
536template <typename T>
537void ServiceStub::EndAsyncFindObjRef(
538 const RR_SHARED_PTR<RRObject>& obj, const RR_SHARED_PTR<RobotRaconteurException>& err,
539 const boost::function<void(const RR_SHARED_PTR<T>&, const RR_SHARED_PTR<RobotRaconteurException>&)>& handler)
540{
541 ClientContext::EndAsyncFindObjRef(obj, err, handler);
542}
543
544#ifndef ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
545using ServiceStubPtr = RR_SHARED_PTR<ServiceStub>;
546using ServiceStubConstPtr = RR_SHARED_PTR<const ServiceStub>;
547#endif
548
549} // namespace RobotRaconteur
550
551#ifdef _MSVC_VER
552#pragma warning(pop)
553#endif
#define RR_TIMEOUT_INFINITE
Disable timeout for asynchronous operations.
Definition RobotRaconteurConstants.h:566
Base class for all Robot Raconteur objects.
Definition DataTypes.h:228