LibreOffice Module sd (master) 1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
sd::tools::TimerBasedTaskExecution Class Reference

Execute an AsynchronousTask timer based, i.e. More...

#include <TimerBasedTaskExecution.hxx>

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

Classes

class  Deleter
 Used by the shared_ptr instead of the private destructor. More...
 

Public Member Functions

void Release ()
 Stop the execution of the task and release the shared pointer to itself so that it will eventually be destroyed. More...
 

Static Public Member Functions

static std::shared_ptr< TimerBasedTaskExecutionCreate (const std::shared_ptr< AsynchronousTask > &rpTask, sal_uInt32 nMillisecondsBetweenSteps, sal_uInt32 nMaxTimePerStep)
 Create a new object of this class. More...
 
static void ReleaseTask (const std::weak_ptr< TimerBasedTaskExecution > &rpTask)
 Convenience method that calls Release() on the given task. More...
 

Private Member Functions

 TimerBasedTaskExecution (std::shared_ptr< AsynchronousTask > pTask, sal_uInt32 nMillisecondsBetweenSteps, sal_uInt32 nMaxTimePerStep)
 
 ~TimerBasedTaskExecution ()
 
 DECL_LINK (TimerCallback, Timer *, void)
 

Private Attributes

std::shared_ptr< AsynchronousTaskmpTask
 
Timer maTimer
 
std::shared_ptr< TimerBasedTaskExecutionmpSelf
 This shared_ptr to this is used to destroy a TimerBasedTaskExecution object when its task has been executed completely. More...
 
sal_uInt32 mnMaxTimePerStep
 

Friends

class Deleter
 

Detailed Description

Execute an AsynchronousTask timer based, i.e.

every nMillisecondsBetweenSteps milliseconds as much steps are executed as fit into a nMaxTimePerStep millisecond interval.

When a task is executed completely, i.e. HasNextStep() returns <FALSE>, the TimerBasedTaskExecution destroys itself. This, of course, works only if the creating instance does not hold a shared_ptr to that object.

Definition at line 38 of file TimerBasedTaskExecution.hxx.

Constructor & Destructor Documentation

◆ TimerBasedTaskExecution()

sd::tools::TimerBasedTaskExecution::TimerBasedTaskExecution ( std::shared_ptr< AsynchronousTask pTask,
sal_uInt32  nMillisecondsBetweenSteps,
sal_uInt32  nMaxTimePerStep 
)
private

Definition at line 83 of file TimerBasedTaskExecution.cxx.

References LINK, maTimer, Timer::SetInvokeHandler(), Timer::SetTimeout(), and Timer::Start().

Referenced by Create().

◆ ~TimerBasedTaskExecution()

sd::tools::TimerBasedTaskExecution::~TimerBasedTaskExecution ( )
private

Definition at line 96 of file TimerBasedTaskExecution.cxx.

References maTimer, and Task::Stop().

Member Function Documentation

◆ Create()

std::shared_ptr< TimerBasedTaskExecution > sd::tools::TimerBasedTaskExecution::Create ( const std::shared_ptr< AsynchronousTask > &  rpTask,
sal_uInt32  nMillisecondsBetweenSteps,
sal_uInt32  nMaxTimePerStep 
)
static

Create a new object of this class.

Parameters
rpTaskThe AsynchronousTask that is to be executed.
nMillisecondsBetweenStepsWait at least this long between the execution of steps. Note that more than one step may be executed in succession.
nMaxTimePerStepThe maximal time for executing steps without yielding control.

Definition at line 40 of file TimerBasedTaskExecution.cxx.

References Deleter, and TimerBasedTaskExecution().

Referenced by sd::sidebar::MasterPageContainer::Implementation::LateInit().

◆ DECL_LINK()

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

◆ Release()

void sd::tools::TimerBasedTaskExecution::Release ( )

Stop the execution of the task and release the shared pointer to itself so that it will eventually be destroyed.

Definition at line 56 of file TimerBasedTaskExecution.cxx.

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

◆ ReleaseTask()

void sd::tools::TimerBasedTaskExecution::ReleaseTask ( const std::weak_ptr< TimerBasedTaskExecution > &  rpTask)
static

Convenience method that calls Release() on the given task.

It checks the given weak_ptr for being expired and catches bad_weak_ptr exceptions.

Definition at line 63 of file TimerBasedTaskExecution.cxx.

Referenced by sd::sidebar::MasterPageContainer::Implementation::~Implementation().

Friends And Related Function Documentation

◆ Deleter

friend class Deleter
friend

Definition at line 82 of file TimerBasedTaskExecution.hxx.

Referenced by Create().

Member Data Documentation

◆ maTimer

Timer sd::tools::TimerBasedTaskExecution::maTimer
private

◆ mnMaxTimePerStep

sal_uInt32 sd::tools::TimerBasedTaskExecution::mnMaxTimePerStep
private

Definition at line 73 of file TimerBasedTaskExecution.hxx.

◆ mpSelf

std::shared_ptr<TimerBasedTaskExecution> sd::tools::TimerBasedTaskExecution::mpSelf
private

This shared_ptr to this is used to destroy a TimerBasedTaskExecution object when its task has been executed completely.

Definition at line 72 of file TimerBasedTaskExecution.hxx.

Referenced by Release().

◆ mpTask

std::shared_ptr<AsynchronousTask> sd::tools::TimerBasedTaskExecution::mpTask
private

Definition at line 67 of file TimerBasedTaskExecution.hxx.


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