LibreOffice Module sd (master) 1
|
Store a function object and execute it asynchronous. More...
#include <AsynchronousCall.hxx>
Public Types | |
typedef ::std::function< void()> | AsynchronousFunction |
Post a function object that is to be executed asynchronously. More... | |
Public Member Functions | |
AsynchronousCall () | |
Create a new asynchronous call. More... | |
~AsynchronousCall () | |
void | Post (const AsynchronousFunction &rFunction) |
Private Member Functions | |
DECL_LINK (TimerCallback, Timer *, void) | |
Private Attributes | |
Timer | maTimer |
::std::unique_ptr< AsynchronousFunction > | mpFunction |
The function object that will be executed when the TimerCallback function is called the next time. More... | |
Store a function object and execute it asynchronous.
The features of this class are: a) It provides a wrapper around a VCL Timer so that generic function objects can be used. b) When more than one function objects are posted to be executed later then the pending ones are erased and only the last one will actually be executed.
Use this class like this: aInstanceOfAsynchronousCall.Post( ::std::bind( ::std::mem_fun(&DrawViewShell::SwitchPage), pDrawViewShell, 11));
Definition at line 45 of file AsynchronousCall.hxx.
typedef ::std::function<void()> sd::tools::AsynchronousCall::AsynchronousFunction |
Post a function object that is to be executed asynchronously.
When this method is called while the current function object has not been executed then the latter is destroyed and only the given function object will be executed.
rFunction | The function object that may be called asynchronously in the near future. |
Definition at line 63 of file AsynchronousCall.hxx.
sd::tools::AsynchronousCall::AsynchronousCall | ( | ) |
Create a new asynchronous call.
Each object of this class processes one (semantical) type of call.
Definition at line 25 of file AsynchronousCall.cxx.
References LINK, maTimer, and Timer::SetInvokeHandler().
sd::tools::AsynchronousCall::~AsynchronousCall | ( | ) |
Definition at line 31 of file AsynchronousCall.cxx.
References maTimer, mpFunction, and Task::Stop().
|
private |
void sd::tools::AsynchronousCall::Post | ( | const AsynchronousFunction & | rFunction | ) |
Definition at line 37 of file AsynchronousCall.cxx.
References maTimer, mpFunction, Timer::SetTimeout(), and Timer::Start().
Referenced by sd::DrawViewShell::SwitchPage().
|
private |
Definition at line 67 of file AsynchronousCall.hxx.
Referenced by AsynchronousCall(), Post(), and ~AsynchronousCall().
|
private |
The function object that will be executed when the TimerCallback function is called the next time.
This pointer may be NULL.
Definition at line 71 of file AsynchronousCall.hxx.
Referenced by Post(), and ~AsynchronousCall().