31namespace RobotRaconteur
67template <
typename Return,
typename Param>
80 virtual Return
Next(
const Param& v) = 0;
92 virtual bool TryNext(
const Param& v, Return& ret)
115 const Param& v, boost::function<
void(
const Return&,
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
133 virtual void AsyncAbort(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
152 virtual void AsyncClose(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
163template <
typename Return>
164class Generator<Return, void> :
private boost::noncopyable
208 boost::function<
void(
const Return&,
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
213 virtual void AsyncAbort(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
218 virtual void AsyncClose(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
227 std::vector<Return> ret;
232 ret.push_back(
Next());
248template <
typename Param>
249class Generator<void, Param> :
private boost::noncopyable
260 virtual void Next(
const Param& v) = 0;
294 boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
299 virtual void AsyncAbort(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
304 virtual void AsyncClose(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
309class ROBOTRACONTEUR_CORE_API GeneratorClientBase
314 RR_WEAK_PTR<ServiceStub> stub;
315 RR_WEAK_PTR<RobotRaconteurNode> node;
317 std::string service_path;
319 GeneratorClientBase(boost::string_ref name, int32_t
id,
const RR_SHARED_PTR<ServiceStub>& stub);
321 virtual RR_INTRUSIVE_PTR<MessageElement> NextBase(
const RR_INTRUSIVE_PTR<MessageElement>& v);
322 virtual void AsyncNextBase(
323 const RR_INTRUSIVE_PTR<MessageElement>& v,
324 boost::function<
void(
const RR_INTRUSIVE_PTR<MessageElement>&,
const RR_SHARED_PTR<RobotRaconteurException>&,
325 const RR_SHARED_PTR<RobotRaconteurNode>&)>
329 static void AsyncNextBase1(
330 const RR_INTRUSIVE_PTR<MessageEntry>& ret,
const RR_SHARED_PTR<RobotRaconteurException>& err,
331 boost::function<
void(
const RR_INTRUSIVE_PTR<MessageElement>&,
const RR_SHARED_PTR<RobotRaconteurException>&,
332 const RR_SHARED_PTR<RobotRaconteurNode>&)>
334 const RR_WEAK_PTR<RobotRaconteurNode>& node);
337 RR_SHARED_PTR<ServiceStub> GetStub();
339 virtual void Abort();
340 virtual void AsyncAbort(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
342 virtual void Close();
343 virtual void AsyncClose(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
345 std::string GetMemberName();
347 virtual ~GeneratorClientBase() {}
352template <
typename Return>
353static void GeneratorClient_AsyncNext1(
354 const RR_INTRUSIVE_PTR<MessageElement>& v2,
const RR_SHARED_PTR<RobotRaconteurException>& err,
355 const RR_SHARED_PTR<RobotRaconteurNode>& node,
356 boost::function<
void(
const Return&,
const RR_SHARED_PTR<RobotRaconteurException>&)> handler)
360 detail::InvokeHandlerWithException(node, handler, err);
366 ret = RRPrimUtil<Return>::PreUnpack(node->UnpackAnyType<
typename RRPrimUtil<Return>::BoxedType>(v2));
368 catch (std::exception& e)
370 detail::InvokeHandlerWithException(node, handler, e);
373 detail::InvokeHandler<Return>(node, handler, ret);
376ROBOTRACONTEUR_CORE_API
void GeneratorClient_AsyncNext2(
377 const RR_INTRUSIVE_PTR<MessageElement>& v2,
const RR_SHARED_PTR<RobotRaconteurException>& err,
378 const RR_SHARED_PTR<RobotRaconteurNode>& node,
379 boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler);
382template <
typename Return,
typename Param>
383class GeneratorClient :
public Generator<Return, Param>,
public GeneratorClientBase
386 GeneratorClient(boost::string_ref name, int32_t
id,
const RR_SHARED_PTR<ServiceStub>& stub)
387 : GeneratorClientBase(name, id, stub)
390 RR_OVIRTUAL Return Next(
const Param& v) RR_OVERRIDE
392 RR_INTRUSIVE_PTR<MessageElement> v1 = CreateMessageElement(
393 "", GetStub()->RRGetNode()->
template PackAnyType<
typename RRPrimUtil<Param>::BoxedType>(
394 RRPrimUtil<Param>::PrePack(v)));
395 RR_INTRUSIVE_PTR<MessageElement> v2 = NextBase(v1);
396 return RRPrimUtil<Return>::PreUnpack(
397 GetStub()->RRGetNode()->
template UnpackAnyType<
typename RRPrimUtil<Return>::BoxedType>(v2));
399 RR_OVIRTUAL
void AsyncNext(
400 const Param& v, boost::function<
void(
const Return&,
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
403 RR_INTRUSIVE_PTR<MessageElement> v1 = CreateMessageElement(
404 "", GetStub()->RRGetNode()->
template PackAnyType<
typename RRPrimUtil<Param>::BoxedType>(
405 RRPrimUtil<Param>::PrePack(v)));
407 boost::bind<void>(&detail::GeneratorClient_AsyncNext1<Return>, RR_BOOST_PLACEHOLDERS(_1),
408 RR_BOOST_PLACEHOLDERS(_2), RR_BOOST_PLACEHOLDERS(_3), handler),
411 RR_OVIRTUAL
void Abort() RR_OVERRIDE { GeneratorClientBase::Abort(); }
412 RR_OVIRTUAL
void AsyncAbort(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
415 GeneratorClientBase::AsyncAbort(handler, timeout);
417 RR_OVIRTUAL
void Close() RR_OVERRIDE { GeneratorClientBase::Close(); }
418 RR_OVIRTUAL
void AsyncClose(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
421 GeneratorClientBase::AsyncClose(handler, timeout);
425template <
typename Return>
426class GeneratorClient<Return, void> :
public Generator<Return, void>,
public GeneratorClientBase
429 GeneratorClient(boost::string_ref name, int32_t
id,
const RR_SHARED_PTR<ServiceStub>& stub)
430 : GeneratorClientBase(name, id, stub)
433 RR_OVIRTUAL Return Next() RR_OVERRIDE
435 RR_INTRUSIVE_PTR<MessageElement> v2 = NextBase(RR_INTRUSIVE_PTR<MessageElement>());
436 return RRPrimUtil<Return>::PreUnpack(
437 GetStub()->RRGetNode()->
template UnpackAnyType<
typename RRPrimUtil<Return>::BoxedType>(v2));
439 RR_OVIRTUAL
void AsyncNext(
440 boost::function<
void(
const Return&,
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
443 AsyncNextBase(RR_INTRUSIVE_PTR<MessageElement>(),
444 boost::bind<void>(&detail::GeneratorClient_AsyncNext1<Return>, RR_BOOST_PLACEHOLDERS(_1),
445 RR_BOOST_PLACEHOLDERS(_2), RR_BOOST_PLACEHOLDERS(_3), handler),
448 RR_OVIRTUAL
void Abort() RR_OVERRIDE { GeneratorClientBase::Abort(); }
449 RR_OVIRTUAL
void AsyncAbort(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
452 GeneratorClientBase::AsyncAbort(handler, timeout);
454 RR_OVIRTUAL
void Close() RR_OVERRIDE { GeneratorClientBase::Close(); }
455 RR_OVIRTUAL
void AsyncClose(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
458 GeneratorClientBase::AsyncClose(handler, timeout);
462template <
typename Param>
463class GeneratorClient<void, Param> :
public Generator<void, Param>,
public GeneratorClientBase
466 GeneratorClient(boost::string_ref name, int32_t
id,
const RR_SHARED_PTR<ServiceStub>& stub)
467 : GeneratorClientBase(name, id, stub)
470 RR_OVIRTUAL
void Next(
const Param& v) RR_OVERRIDE
472 RR_INTRUSIVE_PTR<MessageElement> v1 = CreateMessageElement(
473 "", GetStub()->RRGetNode()->
template PackAnyType<
typename RRPrimUtil<Param>::BoxedType>(
474 RRPrimUtil<Param>::PrePack(v)));
477 RR_OVIRTUAL
void AsyncNext(
const Param& v,
478 boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
481 RR_INTRUSIVE_PTR<MessageElement> v1 = CreateMessageElement(
482 "", GetStub()->RRGetNode()->
template PackAnyType<
typename RRPrimUtil<Param>::BoxedType>(
483 RRPrimUtil<Param>::PrePack(v)));
485 boost::bind<void>(&detail::GeneratorClient_AsyncNext2, RR_BOOST_PLACEHOLDERS(_1),
486 RR_BOOST_PLACEHOLDERS(_2), RR_BOOST_PLACEHOLDERS(_3), RR_MOVE(handler)),
489 RR_OVIRTUAL
void Abort() RR_OVERRIDE { GeneratorClientBase::Abort(); }
490 RR_OVIRTUAL
void AsyncAbort(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
493 GeneratorClientBase::AsyncAbort(handler, timeout);
495 RR_OVIRTUAL
void Close() RR_OVERRIDE { GeneratorClientBase::Close(); }
496 RR_OVIRTUAL
void AsyncClose(boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
499 GeneratorClientBase::AsyncClose(handler, timeout);
505class ROBOTRACONTEUR_CORE_API GeneratorServerBase :
private boost::noncopyable
510 RR_WEAK_PTR<ServiceSkel> skel;
511 RR_INTRUSIVE_PTR<MessageElement> m;
512 RR_SHARED_PTR<ServerEndpoint> ep;
513 RR_WEAK_PTR<RobotRaconteurNode> node;
514 std::string service_path;
516 boost::posix_time::ptime last_access_time;
518 GeneratorServerBase(boost::string_ref name, int32_t index,
const RR_SHARED_PTR<ServiceSkel>& skel,
519 const RR_SHARED_PTR<ServerEndpoint>& ep);
522 friend class ServiceSkel;
524 virtual void CallNext(
const RR_INTRUSIVE_PTR<MessageEntry>& m) = 0;
526 virtual uint32_t GetEndpoint();
528 virtual ~GeneratorServerBase() {}
531 static void EndAsyncCallNext(
const RR_WEAK_PTR<ServiceSkel>& skel,
const RR_INTRUSIVE_PTR<MessageElement>& ret,
532 const RR_SHARED_PTR<RobotRaconteurException>& err, int32_t index,
533 const RR_INTRUSIVE_PTR<MessageEntry>& m,
const RR_SHARED_PTR<ServerEndpoint>& ep);
535 template <
typename Return>
536 static void CallNext1(Return v2,
const RR_SHARED_PTR<RobotRaconteurException>& err, int32_t index,
537 const RR_WEAK_PTR<ServiceSkel>& skel,
const RR_INTRUSIVE_PTR<MessageEntry>& m,
538 const RR_SHARED_PTR<ServerEndpoint>& ep)
540 RR_SHARED_PTR<ServiceSkel> skel1 = skel.lock();
541 RR_SHARED_PTR<RobotRaconteurException> err2 = err;
545 err2 = RR_MAKE_SHARED<InvalidOperationException>(
"Service skel released");
549 GeneratorServerBase::EndAsyncCallNext(skel, RR_INTRUSIVE_PTR<MessageElement>(), err2, index, m, ep);
553 RR_INTRUSIVE_PTR<MessageElement> v3;
556 v3 = CreateMessageElement(
"",
557 skel1->RRGetNode()->template PackAnyType<
typename RRPrimUtil<Return>::BoxedType>(
558 RRPrimUtil<Return>::PrePack(v2)));
560 catch (std::exception& exp)
564 GeneratorServerBase::EndAsyncCallNext(skel, RR_INTRUSIVE_PTR<MessageElement>(),
565 RobotRaconteurExceptionUtil::ExceptionToSharedPtr(exp), index, m, ep);
568 GeneratorServerBase::EndAsyncCallNext(skel, v3, err, index, m, ep);
571 static void CallNext2(
const RR_SHARED_PTR<RobotRaconteurException>& err, int32_t index,
572 const RR_WEAK_PTR<ServiceSkel>& skel,
const RR_INTRUSIVE_PTR<MessageEntry>& m,
573 const RR_SHARED_PTR<ServerEndpoint>& ep)
575 RR_SHARED_PTR<ServiceSkel> skel1 = skel.lock();
576 RR_SHARED_PTR<RobotRaconteurException> err2 = err;
580 err2 = RR_MAKE_SHARED<InvalidOperationException>(
"Service skel released");
584 GeneratorServerBase::EndAsyncCallNext(skel, RR_INTRUSIVE_PTR<MessageElement>(), err2, index, m, ep);
588 RR_INTRUSIVE_PTR<MessageElement> v3;
589 GeneratorServerBase::EndAsyncCallNext(skel, v3, err2, index, m, ep);
593template <
typename Return,
typename Param>
594class GeneratorServer :
public GeneratorServerBase
597 RR_SHARED_PTR<Generator<Return, Param> > generator;
600 GeneratorServer(
const RR_SHARED_PTR<Generator<Return, Param> >& generator, boost::string_ref name, int32_t
id,
601 const RR_SHARED_PTR<ServiceSkel>& skel,
const RR_SHARED_PTR<ServerEndpoint>& ep)
602 : GeneratorServerBase(name, id, skel, ep)
606 this->generator = generator;
609 RR_OVIRTUAL
void CallNext(
const RR_INTRUSIVE_PTR<MessageEntry>& m) RR_OVERRIDE
611 ROBOTRACONTEUR_LOG_TRACE_COMPONENT_PATH(node, Service, ep->GetLocalEndpoint(), service_path, name,
612 "Generator CallNext with id " << index);
613 RR_SHARED_PTR<ServiceSkel> skel1 = skel.lock();
619 if (m->Error != MessageErrorType_None)
621 if (m->Error == MessageErrorType_StopIteration)
623 generator->AsyncClose(boost::bind<void>(&GeneratorServerBase::CallNext1<int32_t>, 0,
624 RR_BOOST_PLACEHOLDERS(_1), index, skel, m, ep));
628 generator->AsyncAbort(boost::bind<void>(&GeneratorServerBase::CallNext1<int32_t>, 0,
629 RR_BOOST_PLACEHOLDERS(_1), index, skel, m, ep));
634 Param v = RRPrimUtil<Param>::PreUnpack(
635 skel1->RRGetNode()->template UnpackAnyType<
typename RRPrimUtil<Param>::BoxedType>(
636 m->FindElement(
"parameter")));
637 generator->AsyncNext(v,
638 boost::bind<void>(&GeneratorServerBase::CallNext1<Return>, RR_BOOST_PLACEHOLDERS(_1),
639 RR_BOOST_PLACEHOLDERS(_2), index, skel, m, ep));
643 RR_OVIRTUAL ~GeneratorServer() RR_OVERRIDE {}
646template <
typename Return>
647class GeneratorServer<Return, void> :
public GeneratorServerBase
650 RR_SHARED_PTR<Generator<Return, void> > generator;
653 GeneratorServer(RR_SHARED_PTR<Generator<Return, void> > generator, boost::string_ref name, int32_t
id,
654 const RR_SHARED_PTR<ServiceSkel>& skel,
const RR_SHARED_PTR<ServerEndpoint>& ep)
655 : GeneratorServerBase(name, id, skel, ep)
659 this->generator = generator;
662 RR_OVIRTUAL
void CallNext(
const RR_INTRUSIVE_PTR<MessageEntry>& m) RR_OVERRIDE
664 RR_SHARED_PTR<ServiceSkel> skel1 = skel.lock();
670 if (m->Error != MessageErrorType_None)
672 if (m->Error == MessageErrorType_StopIteration)
674 generator->AsyncClose(boost::bind<void>(&GeneratorServerBase::CallNext1<int32_t>, 0,
675 RR_BOOST_PLACEHOLDERS(_1), index, skel, m, ep));
679 generator->AsyncAbort(boost::bind<void>(&GeneratorServerBase::CallNext1<int32_t>, 0,
680 RR_BOOST_PLACEHOLDERS(_1), index, skel, m, ep));
685 generator->AsyncNext(boost::bind<void>(&GeneratorServerBase::CallNext1<Return>, RR_BOOST_PLACEHOLDERS(_1),
686 RR_BOOST_PLACEHOLDERS(_2), index, skel, m, ep));
689 RR_OVIRTUAL ~GeneratorServer() RR_OVERRIDE {}
692template <
typename Param>
693class GeneratorServer<void, Param> :
public GeneratorServerBase
696 RR_SHARED_PTR<Generator<void, Param> > generator;
699 GeneratorServer(RR_SHARED_PTR<Generator<void, Param> > generator, boost::string_ref name, int32_t
id,
700 const RR_SHARED_PTR<ServiceSkel>& skel,
const RR_SHARED_PTR<ServerEndpoint>& ep)
701 : GeneratorServerBase(name, id, skel, ep)
705 this->generator = generator;
708 RR_OVIRTUAL
void CallNext(
const RR_INTRUSIVE_PTR<MessageEntry>& m) RR_OVERRIDE
710 RR_SHARED_PTR<ServiceSkel> skel1 = skel.lock();
716 if (m->Error != MessageErrorType_None)
718 if (m->Error == MessageErrorType_StopIteration)
720 generator->AsyncClose(boost::bind<void>(&GeneratorServerBase::CallNext1<int32_t>, 0,
721 RR_BOOST_PLACEHOLDERS(_1), index, skel, m, ep));
725 generator->AsyncAbort(boost::bind<void>(&GeneratorServerBase::CallNext1<int32_t>, 0,
726 RR_BOOST_PLACEHOLDERS(_1), index, skel, m, ep));
731 Param v = RRPrimUtil<Param>::PreUnpack(
732 skel1->RRGetNode()->template UnpackAnyType<
typename RRPrimUtil<Param>::BoxedType>(
733 m->FindElement(
"parameter")));
734 generator->AsyncNext(
735 v, boost::bind<void>(&GeneratorServerBase::CallNext2, RR_BOOST_PLACEHOLDERS(_1), index, skel, m, ep));
738 RR_OVIRTUAL ~GeneratorServer() RR_OVERRIDE {}
751template <
typename Return,
typename Param>
756 RR_OVIRTUAL Return
Next(
const Param& v) RR_OVERRIDE = 0;
759 const Param& v, boost::function<
void(
const Return&,
const RR_SHARED_PTR<RobotRaconteurException>& err)> handler,
764 RR_WEAK_PTR<RobotRaconteurNode> node;
769 catch (std::exception& exp)
771 detail::InvokeHandlerWithException(node, handler, exp);
774 detail::InvokeHandler(node, handler, r);
777 RR_OVIRTUAL
void Abort() RR_OVERRIDE = 0;
783 RR_WEAK_PTR<RobotRaconteurNode> node;
788 catch (std::exception& exp)
790 detail::InvokeHandlerWithException(node, handler, exp);
793 detail::InvokeHandler(node, handler);
796 RR_OVIRTUAL
void Close() RR_OVERRIDE = 0;
802 RR_WEAK_PTR<RobotRaconteurNode> node;
807 catch (std::exception& exp)
809 detail::InvokeHandlerWithException(node, handler, exp);
812 detail::InvokeHandler(node, handler);
818template <
typename Return>
823 RR_OVIRTUAL Return
Next() RR_OVERRIDE = 0;
831 RR_WEAK_PTR<RobotRaconteurNode> node;
836 catch (std::exception& exp)
838 detail::InvokeHandlerWithException(node, handler, exp);
841 detail::InvokeHandler(node, handler, r);
844 RR_OVIRTUAL
void Abort() RR_OVERRIDE = 0;
850 RR_WEAK_PTR<RobotRaconteurNode> node;
855 catch (std::exception& exp)
857 detail::InvokeHandlerWithException(node, handler, exp);
860 detail::InvokeHandler(node, handler);
863 RR_OVIRTUAL
void Close() RR_OVERRIDE = 0;
869 RR_WEAK_PTR<RobotRaconteurNode> node;
874 catch (std::exception& exp)
876 detail::InvokeHandlerWithException(node, handler, exp);
879 detail::InvokeHandler(node, handler);
885template <
typename Param>
890 RR_OVIRTUAL
void Next(
const Param& v) RR_OVERRIDE = 0;
893 boost::function<
void(
const RR_SHARED_PTR<RobotRaconteurException>&)> handler,
897 RR_WEAK_PTR<RobotRaconteurNode> node;
902 catch (std::exception& exp)
904 detail::InvokeHandlerWithException(node, handler, exp);
907 detail::InvokeHandler(node, handler);
910 RR_OVIRTUAL
void Abort() RR_OVERRIDE = 0;
916 RR_WEAK_PTR<RobotRaconteurNode> node;
921 catch (std::exception& exp)
923 detail::InvokeHandlerWithException(node, handler, exp);
926 detail::InvokeHandler(node, handler);
929 RR_OVIRTUAL
void Close() RR_OVERRIDE = 0;
935 RR_WEAK_PTR<RobotRaconteurNode> node;
940 catch (std::exception& exp)
942 detail::InvokeHandlerWithException(node, handler, exp);
945 detail::InvokeHandler(node, handler);
966 typename T::iterator iter;
967 boost::mutex range_lock;
971 RangeGenerator(
const T& range)
975 this->iter = this->range.begin();
979 RR_OVIRTUAL
typename T::value_type
Next() RR_OVERRIDE
981 boost::mutex::scoped_lock lock(range_lock);
988 if (iter == range.end())
996 RR_OVIRTUAL
void Abort() RR_OVERRIDE
998 boost::mutex::scoped_lock lock(range_lock);
1005 boost::mutex::scoped_lock lock(range_lock);
1018template <
typename T>
1021 return RR_MAKE_SHARED<RangeGenerator<T> >(range);
1024#ifndef ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
1025template <
typename Return,
typename Param>
1026using GeneratorPtr = RR_SHARED_PTR<Generator<Return, Param> >;
1027template <
typename Return,
typename Param>
1028using GeneratorConstPtr = RR_SHARED_PTR<const Generator<Return, Param> >;
1029template <
typename T>
1030using RangeGeneratorPtr = RR_SHARED_PTR<RangeGenerator<T> >;
1031template <
typename T>
1032using RangeGeneratorConstPtr = RR_SHARED_PTR<const RangeGenerator<T> >;
boost::shared_ptr< RangeGenerator< T > > CreateRangeGenerator(const T &range)
Create a RangeGenerator from a range.
Definition Generator.h:1019
#define RR_TIMEOUT_INFINITE
Disable timeout for asynchronous operations.
Definition RobotRaconteurConstants.h:566
virtual bool TryNext(Return &ret)
Try to advance the generator. Return false if no more values are available.
Definition Generator.h:187
virtual void AsyncClose(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously closes the generator.
virtual void Close()=0
Close the generator.
virtual void AsyncNext(boost::function< void(const Return &, const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously advance the generator.
virtual void AsyncAbort(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously abort the generator.
virtual Return Next()=0
Advance the generator.
virtual std::vector< Return > NextAll()
Automatically call Next() repeatedly and return std::vector of results.
Definition Generator.h:225
virtual void Abort()=0
Abort the generator.
virtual void AsyncClose(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously closes the generator.
virtual void AsyncNext(const Param &v, boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously advance the generator.
virtual void Close()=0
Close the generator.
virtual void AsyncAbort(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously abort the generator.
virtual void Next(const Param &v)=0
Advance the generator.
virtual void Abort()=0
Abort the generator.
virtual bool TryNext(const Param &v)
Try to advance the generator. Return false if no more values are available.
Definition Generator.h:272
Generator type for use with generator functions, with parameter and return.
Definition Generator.h:69
virtual void Abort()=0
Abort the generator.
virtual void Close()=0
Close the generator.
virtual bool TryNext(const Param &v, Return &ret)
Try to advance the generator. Return false if no more values are available.
Definition Generator.h:92
virtual void AsyncAbort(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously abort the generator.
virtual void AsyncNext(const Param &v, boost::function< void(const Return &, const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously advance the generator.
virtual void AsyncClose(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
Asynchronously closes the generator.
virtual Return Next(const Param &v)=0
Advance the generator.
InvalidOperationException(const std::string &message, std::string sub_name="", const boost::intrusive_ptr< RRValue > ¶m_=boost::intrusive_ptr< RRValue >())
Construct an InvalidOperationException.
OperationAbortedException(const std::string &message, std::string sub_name="", const boost::intrusive_ptr< RRValue > ¶m_=boost::intrusive_ptr< RRValue >())
Construct a OperationAbortedException.
Utility class to use a C++ range with Generator<Return,void>.
Definition Generator.h:963
RR_OVIRTUAL void Close() RR_OVERRIDE
Close the generator.
Definition Generator.h:1003
RR_OVIRTUAL T::value_type Next() RR_OVERRIDE
Advance the generator.
Definition Generator.h:979
RR_OVIRTUAL void Abort() RR_OVERRIDE
Abort the generator.
Definition Generator.h:996
Base class for Robot Raconteur exceptions.
Definition Error.h:53
Server endpoint representing a client connection.
Definition Service.h:740
Exception thrown when a generator has finished sending results.
Definition Error.h:1224
StopIterationException(const std::string &message, std::string sub_name="", const boost::intrusive_ptr< RRValue > ¶m_=boost::intrusive_ptr< RRValue >())
Construct a StopIterationException.
RR_OVIRTUAL void Abort() RR_OVERRIDE=0
Abort the generator.
RR_OVIRTUAL void AsyncNext(boost::function< void(const Return &, const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously advance the generator.
Definition Generator.h:825
RR_OVIRTUAL void Close() RR_OVERRIDE=0
Close the generator.
RR_OVIRTUAL Return Next() RR_OVERRIDE=0
Advance the generator.
RR_OVIRTUAL void AsyncAbort(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously abort the generator.
Definition Generator.h:846
RR_OVIRTUAL void AsyncClose(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously closes the generator.
Definition Generator.h:865
RR_OVIRTUAL void Close() RR_OVERRIDE=0
Close the generator.
RR_OVIRTUAL void Next(const Param &v) RR_OVERRIDE=0
Advance the generator.
RR_OVIRTUAL void AsyncAbort(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously abort the generator.
Definition Generator.h:912
RR_OVIRTUAL void Abort() RR_OVERRIDE=0
Abort the generator.
RR_OVIRTUAL void AsyncNext(const Param &v, boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously advance the generator.
Definition Generator.h:892
RR_OVIRTUAL void AsyncClose(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously closes the generator.
Definition Generator.h:931
Helper class for synchronous service generators.
Definition Generator.h:753
RR_OVIRTUAL void AsyncClose(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously closes the generator.
Definition Generator.h:798
RR_OVIRTUAL void Close() RR_OVERRIDE=0
Close the generator.
RR_OVIRTUAL void AsyncNext(const Param &v, boost::function< void(const Return &, const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously advance the generator.
Definition Generator.h:758
RR_OVIRTUAL Return Next(const Param &v) RR_OVERRIDE=0
Advance the generator.
RR_OVIRTUAL void Abort() RR_OVERRIDE=0
Abort the generator.
RR_OVIRTUAL void AsyncAbort(boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) RR_OVERRIDE
Asynchronously abort the generator.
Definition Generator.h:779