Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::SyncGenerator< void, Param > Class Template Referenceabstract

Helper class for synchronous service generators. More...

#include <Generator.h>

Inheritance diagram for RobotRaconteur::SyncGenerator< void, Param >:
RobotRaconteur::Generator< void, Param > RobotRaconteur::Generator< void, Param >

Public Member Functions

RR_OVIRTUAL void Next (const Param &v) RR_OVERRIDE=0
 Advance 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.
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.
RR_OVIRTUAL void Close () RR_OVERRIDE=0
 Close the generator.
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.
virtual bool TryNext (const Param &v, void &ret)
 Try to advance the generator. Return false if no more values are available.
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 AsyncClose (boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0
 Asynchronously closes the generator.
virtual bool TryNext (const Param &v)
 Try to advance the generator. Return false if no more values are available.
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.

Detailed Description

template<typename Param>
class RobotRaconteur::SyncGenerator< void, Param >

Helper class for synchronous service generators.

By default, services will call AsyncNext(), AsyncClose(), and AsyncAbort(). This class will redirect these calls to synchronous Next(), Close, and Abort(). Inherit from SyncGenerator for this behavior.

Member Function Documentation

◆ Abort()

template<typename Param>
RR_OVIRTUAL void RobotRaconteur::SyncGenerator< void, Param >::Abort ( )
pure virtual

Abort the generator.

Aborts and destroys the generator. This is assumed to be an error condition. Next() should throw OperationAbortedException if called after Abort(). Any ongoing operations should be terminated with an error condition, for example a moving robot should be immediately halted.

Implements RobotRaconteur::Generator< void, Param >.

◆ AsyncAbort() [1/2]

template<typename Param>
RR_OVIRTUAL void RobotRaconteur::SyncGenerator< void, Param >::AsyncAbort ( boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
inline

Asynchronously abort the generator.

Same as Abort() but returns asynchronously.

Parameters
handlerThe handler to call when abort is complete
timeoutTimeout in milliseconds, or RR_TIMEOUT_INFINITE for no timeout.

◆ AsyncAbort() [2/2]

virtual void RobotRaconteur::Generator< void, Param >::AsyncAbort ( boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
pure virtual

Asynchronously abort the generator.

Same as Abort() but returns asynchronously.

Parameters
handlerThe handler to call when abort is complete
timeoutTimeout in milliseconds, or RR_TIMEOUT_INFINITE for no timeout.

◆ AsyncClose() [1/2]

template<typename Param>
RR_OVIRTUAL void RobotRaconteur::SyncGenerator< void, Param >::AsyncClose ( boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
inlinevirtual

Asynchronously closes the generator.

Same as Close() but returns asynchronously.

Parameters
handlerThe handler to call when close is complete
timeoutTimeout in milliseconds, or RR_TIMEOUT_INFINITE for no timeout.

Implements RobotRaconteur::Generator< void, Param >.

◆ AsyncClose() [2/2]

virtual void RobotRaconteur::Generator< void, Param >::AsyncClose ( boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
pure virtual

Asynchronously closes the generator.

Same as Close() but returns asynchronously.

Parameters
handlerThe handler to call when close is complete
timeoutTimeout in milliseconds, or RR_TIMEOUT_INFINITE for no timeout.

◆ AsyncNext() [1/2]

template<typename Param>
virtual void RobotRaconteur::Generator< void, Param >::AsyncNext ( const Param & v,
boost::function< void(const boost::shared_ptr< RobotRaconteurException > &err)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
pure virtualinherited

Asynchronously advance the generator.

Same as Next() but returns asynchronously.

Parameters
vParameter to pass to generator
handlerThe handler to call when next is complete
timeoutTimeout in milliseconds, or RR_TIMEOUT_INFINITE for no timeout.

◆ AsyncNext() [2/2]

template<typename Param>
RR_OVIRTUAL void RobotRaconteur::SyncGenerator< void, Param >::AsyncNext ( const Param & v,
boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
inline

Asynchronously advance the generator.

Same as Next() but returns asynchronously.

Parameters
vParameter to pass to generator
handlerA handler function to receive the return value or an exception
timeoutTimeout in milliseconds, or RR_TIMEOUT_INFINITE for no timeout.

◆ Close()

template<typename Param>
RR_OVIRTUAL void RobotRaconteur::SyncGenerator< void, Param >::Close ( )
pure virtual

Close the generator.

Closes the generator. Closing the generator terminates iteration and destroys the generator. This operation cleanly closes the generator, and is not considered to be an error condition. Next() should throw StopIterationException if called after Close().

Implements RobotRaconteur::Generator< void, Param >.

◆ Next()

template<typename Param>
RR_OVIRTUAL void RobotRaconteur::SyncGenerator< void, Param >::Next ( const Param & v)
pure virtual

Advance the generator.

Next() advances the generator to retrieve the next value. This version of Generator includes passing a parameter v to the generator.

Parameters
vParameter to pass to generator
Returns
Return Return value from generator

Implements RobotRaconteur::Generator< void, Param >.

◆ TryNext() [1/2]

template<typename Param>
virtual bool RobotRaconteur::Generator< void, Param >::TryNext ( const Param & v)
inlinevirtualinherited

Try to advance the generator. Return false if no more values are available.

TryNext() is similar to Next() but returns false if no more values are available. This version of TryNext() includes passing a parameter to the generator.

Parameters
vThe parameter to pass to the generator
Returns
true Valid return
false No more values are available

◆ TryNext() [2/2]

virtual bool RobotRaconteur::Generator< void, Param >::TryNext ( const Param & v,
void & ret )
inlinevirtual

Try to advance the generator. Return false if no more values are available.

TryNext() is similar to Next() but returns false if no more values are available. This is useful for generators that may not have a fixed number of values.

Parameters
vParameter to pass to generator
retReturn value from generator
Returns
true ret is valid
false ret is not valid. No more values are available.

The documentation for this class was generated from the following file: