Robot Raconteur Companion C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType > Class Template Referenceabstract

Base class for asynchronous task generators. More...

#include <TaskGenerator.h>

Inheritance diagram for RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType >:
RobotRaconteur::Companion::Util::SyncTaskGenerator< StatusType >

Public Member Functions

 AsyncTaskGenerator (const boost::shared_ptr< RobotRaconteur::RobotRaconteurNode > &node, int32_t next_timeout, int32_t watchdog_timeout)
 Represents an asynchronous task generator.

Protected Member Functions

virtual void SetResult (boost::intrusive_ptr< StatusType > &result)
 Set the result of the generator.
virtual void SetResultException (boost::shared_ptr< RobotRaconteur::RobotRaconteurException > &exp)
 Set the exception result of the generator.
void SendUpdate ()
 Send an update to the caller.
virtual void StartTask ()=0
 Start the task.
virtual void CloseRequested ()
 This method is called when a close request is received.
virtual void AbortRequested ()
 This method is called when an abort request is received.
virtual void FillStatus (boost::intrusive_ptr< StatusType > &status)
 This method is called to fill the next status report.

Detailed Description

template<typename StatusType>
class RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType >

Base class for asynchronous task generators.

Base class for asynchronous task generators. This utility class is used to help implement generators that represent long running operations.

Subclasses should override the following functions:

The operation should call SetResult() or SetResultException() when the operation is complete. The generator will then return the result to the caller.

Template Parameters
StatusTypeThe status type for the generator

Constructor & Destructor Documentation

◆ AsyncTaskGenerator()

template<typename StatusType>
RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType >::AsyncTaskGenerator ( const boost::shared_ptr< RobotRaconteur::RobotRaconteurNode > & node,
int32_t next_timeout,
int32_t watchdog_timeout )
inline

Represents an asynchronous task generator.

The AsyncTaskGenerator class is used to generate asynchronous tasks in RobotRaconteurCompanion. It takes a RobotRaconteurNode, next_timeout, and watchdog_timeout as parameters.

Parameters
nodeThe RobotRaconteurNode instance.
next_timeoutThe timeout to return from the Next() function.
watchdog_timeoutThe timeout for the watchdog. -1 to disable.

Member Function Documentation

◆ FillStatus()

template<typename StatusType>
virtual void RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType >::FillStatus ( boost::intrusive_ptr< StatusType > & status)
inlineprotectedvirtual

This method is called to fill the next status report.

This method is called to fill the next status report. Subclasses should override this method to fill the next status report.

Parameters
statusThe status report to fill

◆ SendUpdate()

template<typename StatusType>
void RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType >::SendUpdate ( )
inlineprotected

Send an update to the caller.

This method triggers Next() to return an intermediate status report. Override FillStatus() to fill the status report.

◆ SetResult()

template<typename StatusType>
virtual void RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType >::SetResult ( boost::intrusive_ptr< StatusType > & result)
inlineprotectedvirtual

Set the result of the generator.

This method sets the result of the generator. The generator will return the result to the caller.

Parameters
resultThe result to return

◆ SetResultException()

template<typename StatusType>
virtual void RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType >::SetResultException ( boost::shared_ptr< RobotRaconteur::RobotRaconteurException > & exp)
inlineprotectedvirtual

Set the exception result of the generator.

This method sets the exception result of the generator. The generator will return the exception to the caller.

Parameters
expThe exception to return

◆ StartTask()

template<typename StatusType>
virtual void RobotRaconteur::Companion::Util::AsyncTaskGenerator< StatusType >::StartTask ( )
protectedpure virtual

Start the task.

This method is called when the generator is started. Subclasses should override this method to start the task.

Implemented in RobotRaconteur::Companion::Util::SyncTaskGenerator< StatusType >.


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