Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::RangeGenerator< T > Class Template Referenceabstract

Utility class to use a C++ range with Generator<Return,void>. More...

#include <Generator.h>

Inheritance diagram for RobotRaconteur::RangeGenerator< T >:
RobotRaconteur::SyncGenerator< T::value_type, void > RobotRaconteur::Generator< T::value_type, void >

Public Member Functions

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

Detailed Description

template<typename T>
class RobotRaconteur::RangeGenerator< T >

Utility class to use a C++ range with Generator<Return,void>.

Examples of C++ ranges include std::vector<T> or std::list<T>

Use CreateRangeGenerator() helper function to instantiate this type

Template Parameters
TThe type contained in the range

Member Function Documentation

◆ Abort()

template<typename T>
RR_OVIRTUAL void RobotRaconteur::RangeGenerator< T >::Abort ( )
inlinevirtual

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::SyncGenerator< T::value_type, void >.

◆ AsyncAbort() [1/2]

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

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]

RR_OVIRTUAL void RobotRaconteur::SyncGenerator< T::value_type, void >::AsyncAbort ( boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
inlineinherited

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]

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

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.

◆ AsyncClose() [2/2]

RR_OVIRTUAL void RobotRaconteur::SyncGenerator< T::value_type, void >::AsyncClose ( boost::function< void(const boost::shared_ptr< RobotRaconteurException > &)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
inlineinherited

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()

RR_OVIRTUAL void RobotRaconteur::SyncGenerator< T::value_type, void >::AsyncNext ( const void & v,
boost::function< void(const T::value_type &, const boost::shared_ptr< RobotRaconteurException > &err)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
inlinevirtualinherited

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.

Implements RobotRaconteur::Generator< T::value_type, void >.

◆ Close()

template<typename T>
RR_OVIRTUAL void RobotRaconteur::RangeGenerator< T >::Close ( )
inlinevirtual

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::SyncGenerator< T::value_type, void >.

◆ Next() [1/2]

template<typename T>
RR_OVIRTUAL T::value_type RobotRaconteur::RangeGenerator< T >::Next ( )
inline

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

◆ Next() [2/2]

RR_OVIRTUAL T::value_type RobotRaconteur::SyncGenerator< T::value_type, void >::Next ( const void & v)
pure virtualinherited

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< T::value_type, void >.

◆ TryNext()

virtual bool RobotRaconteur::Generator< T::value_type, void >::TryNext ( const void & v,
T::value_type & ret )
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 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: