LibreOffice Module sd (master) 1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sd::tools::AsynchronousCall Class Reference

Store a function object and execute it asynchronous. More...

#include <AsynchronousCall.hxx>

Collaboration diagram for sd::tools::AsynchronousCall:
[legend]

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< AsynchronousFunctionmpFunction
 The function object that will be executed when the TimerCallback function is called the next time. More...
 

Detailed Description

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.

Member Typedef Documentation

◆ AsynchronousFunction

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.

Parameters
rFunctionThe function object that may be called asynchronously in the near future.

Definition at line 63 of file AsynchronousCall.hxx.

Constructor & Destructor Documentation

◆ AsynchronousCall()

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

◆ ~AsynchronousCall()

sd::tools::AsynchronousCall::~AsynchronousCall ( )

Definition at line 31 of file AsynchronousCall.cxx.

References maTimer, mpFunction, and Task::Stop().

Member Function Documentation

◆ DECL_LINK()

sd::tools::AsynchronousCall::DECL_LINK ( TimerCallback  ,
Timer ,
void   
)
private

◆ Post()

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

Member Data Documentation

◆ maTimer

Timer sd::tools::AsynchronousCall::maTimer
private

Definition at line 67 of file AsynchronousCall.hxx.

Referenced by AsynchronousCall(), Post(), and ~AsynchronousCall().

◆ mpFunction

::std::unique_ptr<AsynchronousFunction> sd::tools::AsynchronousCall::mpFunction
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().


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