AsyncProvider is the interface that providers of async operations must implement. More...
#include <Async.h>
Inherited by atscppapi::AsyncHttpFetch, and atscppapi::AsyncTimer.
Public Member Functions | |
virtual void | run ()=0 |
This method is invoked when the async operation is requested. | |
virtual void | cancel () |
Base implementation just breaks communication channel with receiver. | |
virtual | ~AsyncProvider () |
Protected Member Functions | |
shared_ptr < AsyncDispatchControllerBase > | getDispatchController () |
Friends | |
class | Async |
AsyncProvider is the interface that providers of async operations must implement.
The system allows decoupling of the lifetime/scope of provider and receiver objects. The receiver object might have expired before the async operation is complete and the system handles this case. Because of this decoupling, it is the responsibility of the provider to manage it's expiration - self-destruct on completion is a good option.
Definition at line 66 of file Async.h.
virtual atscppapi::AsyncProvider::~AsyncProvider | ( | ) | [inline, virtual] |
virtual void atscppapi::AsyncProvider::cancel | ( | void | ) | [inline, virtual] |
Base implementation just breaks communication channel with receiver.
Implementations should add business logic here.
Reimplemented in atscppapi::AsyncTimer.
shared_ptr<AsyncDispatchControllerBase> atscppapi::AsyncProvider::getDispatchController | ( | ) | [inline, protected] |
virtual void atscppapi::AsyncProvider::run | ( | ) | [pure virtual] |
This method is invoked when the async operation is requested.
This call should be used to just start the async operation and *not* block this thread. On completion, getDispatchController() can be used to invoke the receiver.
Implemented in atscppapi::AsyncHttpFetch, and atscppapi::AsyncTimer.