LibreOffice Module vcl (master)  1
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Timer Class Reference

#include <timer.hxx>

Inheritance diagram for Timer:
[legend]
Collaboration diagram for Timer:
[legend]

Public Member Functions

 Timer (const sal_Char *pDebugName=nullptr)
 
 Timer (const Timer &rTimer)
 
virtual ~Timer () override
 
Timeroperator= (const Timer &rTimer)
 
virtual void Invoke () override
 Calls the maInvokeHandler with the parameter this. More...
 
void Invoke (Timer *arg)
 Calls the maInvokeHandler with the parameter. More...
 
void SetInvokeHandler (const Link< Timer *, void > &rLink)
 
void ClearInvokeHandler ()
 
void SetTimeout (sal_uInt64 nTimeoutMs)
 
sal_uInt64 GetTimeout () const
 
virtual void Start () override
 Activates the timer task. More...
 
- Public Member Functions inherited from Task
 Task (const sal_Char *pDebugName)
 
 Task (const Task &rTask)
 
virtual ~Task () COVERITY_NOEXCEPT_FALSE
 
Taskoperator= (const Task &rTask)
 
void SetPriority (TaskPriority ePriority)
 
TaskPriority GetPriority () const
 
void SetDebugName (const sal_Char *pDebugName)
 
const char * GetDebugName () const
 
void Stop ()
 
bool IsActive () const
 
void SetStatic ()
 This function must be called for static tasks, so the Task destructor ignores the SchedulerMutex, as it may not be available anymore. More...
 
bool IsStatic () const
 

Protected Member Functions

virtual void SetDeletionFlags () override
 
virtual sal_uInt64 UpdateMinPeriod (sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow) const override
 How long (in MS) until the Task is ready to be dispatched? More...
 
 Timer (bool bAuto, const sal_Char *pDebugName)
 
- Protected Member Functions inherited from Task
const ImplSchedulerDataGetSchedulerData () const
 

Private Attributes

Link< Timer *, voidmaInvokeHandler
 Callback Link. More...
 
sal_uInt64 mnTimeout
 
const bool mbAuto
 

Additional Inherited Members

- Static Protected Member Functions inherited from Task
static void StartTimer (sal_uInt64 nMS)
 

Detailed Description

Definition at line 26 of file timer.hxx.

Constructor & Destructor Documentation

Timer::Timer ( bool  bAuto,
const sal_Char pDebugName 
)
protected

Definition at line 39 of file timer.cxx.

References DEFAULT, and Task::SetPriority().

Timer::Timer ( const sal_Char pDebugName = nullptr)

Definition at line 47 of file timer.cxx.

Timer::Timer ( const Timer rTimer)

Definition at line 52 of file timer.cxx.

References maInvokeHandler, and mnTimeout.

Timer::~Timer ( )
overridevirtual

Definition at line 59 of file timer.cxx.

Member Function Documentation

void Timer::ClearInvokeHandler ( )
inline

Definition at line 58 of file timer.hxx.

sal_uInt64 Timer::GetTimeout ( ) const
inline

Definition at line 61 of file timer.hxx.

void Timer::Invoke ( )
overridevirtual

Calls the maInvokeHandler with the parameter this.

Implements Task.

Reimplemented in DebugEventInjector.

Definition at line 73 of file timer.cxx.

References Link< class, class >::Call(), and maInvokeHandler.

Referenced by IdleFormatter::DoIdleFormat(), and IdleFormatter::ForceTimeout().

void Timer::Invoke ( Timer arg)

Calls the maInvokeHandler with the parameter.

Convenience Invoke function, mainly used to call with nullptr.

Parameters
argparameter for the Link::Call function

Definition at line 78 of file timer.cxx.

References Link< class, class >::Call(), and maInvokeHandler.

Timer & Timer::operator= ( const Timer rTimer)

Definition at line 63 of file timer.cxx.

References maInvokeHandler, mbAuto, mnTimeout, Task::operator=(), and SAL_WARN_IF.

void Timer::SetDeletionFlags ( )
overrideprotectedvirtual

Reimplemented from Task.

Definition at line 25 of file timer.cxx.

References mbAuto, and Task::SetDeletionFlags().

void Timer::SetInvokeHandler ( const Link< Timer *, void > &  rLink)
inline
void Timer::SetTimeout ( sal_uInt64  nTimeoutMs)
void Timer::Start ( )
overridevirtual
sal_uInt64 Timer::UpdateMinPeriod ( sal_uInt64  nMinPeriod,
sal_uInt64  nTimeNow 
) const
overrideprotectedvirtual

How long (in MS) until the Task is ready to be dispatched?

Simply return Scheduler::ImmediateTimeoutMs if you're ready, like an Idle. If you have to return Scheduler::InfiniteTimeoutMs, you probably need another mechanism to wake up the Scheduler or rely on other Tasks to be scheduled, or simply use a polling Timer.

Parameters
nMinPeriodthe currently expected sleep time
nTimeNowthe current time
Returns
the sleep time of the Task to become ready

Implements Task.

Reimplemented in Idle.

Definition at line 32 of file timer.cxx.

References Task::GetSchedulerData(), Scheduler::ImmediateTimeoutMs, mnTimeout, and ImplSchedulerData::mnUpdateTime.

Member Data Documentation

Link<Timer *, void> Timer::maInvokeHandler
private

Callback Link.

Definition at line 28 of file timer.hxx.

Referenced by Invoke(), operator=(), and Timer().

const bool Timer::mbAuto
private

Definition at line 30 of file timer.hxx.

Referenced by operator=(), and SetDeletionFlags().

sal_uInt64 Timer::mnTimeout
private

Definition at line 29 of file timer.hxx.

Referenced by operator=(), SetTimeout(), Start(), Timer(), and UpdateMinPeriod().


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