Blender V5.0
GHOST_TimerManager Class Reference

#include <GHOST_TimerManager.hh>

Public Member Functions

 GHOST_TimerManager ()
 ~GHOST_TimerManager ()
uint32_t getNumTimers ()
bool getTimerFound (GHOST_TimerTask *timer)
GHOST_TSuccess addTimer (GHOST_TimerTask *timer)
GHOST_TSuccess removeTimer (GHOST_TimerTask *timer)
uint64_t nextFireTime ()
bool fireTimers (uint64_t time)
bool fireTimer (uint64_t time, GHOST_TimerTask *task)

Protected Types

using TTimerVector = std::vector<GHOST_TimerTask *>

Protected Member Functions

void disposeTimers ()

Protected Attributes

TTimerVector timers_

Detailed Description

Manages a list of timer tasks. Timer tasks added are owned by the manager. Don't delete timer task objects.

Definition at line 23 of file GHOST_TimerManager.hh.

Member Typedef Documentation

◆ TTimerVector

using GHOST_TimerManager::TTimerVector = std::vector<GHOST_TimerTask *>
protected

Definition at line 91 of file GHOST_TimerManager.hh.

Constructor & Destructor Documentation

◆ GHOST_TimerManager()

GHOST_TimerManager::GHOST_TimerManager ( )
default

Constructor.

Copyright (C) 2001 NaN Technologies B.V.

References timer.

◆ ~GHOST_TimerManager()

GHOST_TimerManager::~GHOST_TimerManager ( )

Destructor.

Definition at line 21 of file GHOST_TimerManager.cc.

References disposeTimers().

Member Function Documentation

◆ addTimer()

GHOST_TSuccess GHOST_TimerManager::addTimer ( GHOST_TimerTask * timer)

Adds a timer task to the list. It is only added when it not already present in the list.

Parameters
timerThe timer task added to the list.
Returns
Indication as to whether addition has succeeded.

Definition at line 37 of file GHOST_TimerManager.cc.

References getTimerFound(), GHOST_kFailure, GHOST_kSuccess, timer, and timers_.

Referenced by gwl_seat_key_repeat_timer_add().

◆ disposeTimers()

void GHOST_TimerManager::disposeTimers ( )
protected

Deletes all timers.

Definition at line 117 of file GHOST_TimerManager.cc.

References timers_.

Referenced by ~GHOST_TimerManager().

◆ fireTimer()

bool GHOST_TimerManager::fireTimer ( uint64_t time,
GHOST_TimerTask * task )

Checks this timer task to see if they are expired and fires them if needed.

Parameters
timeThe current time.
taskThe timer task to check and optionally fire.
Returns
True if the timer fired.

Definition at line 94 of file GHOST_TimerManager.cc.

References GHOST_TimerTask::getInterval(), GHOST_TimerTask::getNext(), GHOST_TimerTask::getStart(), GHOST_TimerTask::getTimerProc(), next, and GHOST_TimerTask::setNext().

Referenced by fireTimers().

◆ fireTimers()

bool GHOST_TimerManager::fireTimers ( uint64_t time)

Checks all timer tasks to see if they are expired and fires them if needed.

Parameters
timeThe current time.
Returns
True if any timers were fired.

Definition at line 80 of file GHOST_TimerManager.cc.

References fireTimer(), and timers_.

Referenced by GHOST_SystemCocoa::processEvents(), GHOST_SystemSDL::processEvents(), GHOST_SystemWin32::processEvents(), and GHOST_SystemX11::processEvents().

◆ getNumTimers()

uint32_t GHOST_TimerManager::getNumTimers ( )

Returns the number of timer tasks.

Returns
The number of events on the stack.

Definition at line 26 of file GHOST_TimerManager.cc.

References timers_.

◆ getTimerFound()

bool GHOST_TimerManager::getTimerFound ( GHOST_TimerTask * timer)

Returns whether this timer task ins in our list.

Returns
Indication of presence.

Definition at line 31 of file GHOST_TimerManager.cc.

References timer, and timers_.

Referenced by addTimer().

◆ nextFireTime()

uint64_t GHOST_TimerManager::nextFireTime ( )

Finds the soonest time the next timer would fire.

Returns
The soonest time the next timer would fire, or GHOST_kFireTimeNever if no timers exist.

Definition at line 67 of file GHOST_TimerManager.cc.

References GHOST_kFireTimeNever, next, and timers_.

Referenced by GHOST_SystemCocoa::processEvents(), GHOST_SystemSDL::processEvents(), GHOST_SystemWin32::processEvents(), and GHOST_SystemX11::processEvents().

◆ removeTimer()

GHOST_TSuccess GHOST_TimerManager::removeTimer ( GHOST_TimerTask * timer)

Removes a timer task from the list. It is only removed when it is found in the list.

Parameters
timerThe timer task to be removed from the list.
Returns
Indication as to whether removal has succeeded.

Definition at line 51 of file GHOST_TimerManager.cc.

References GHOST_kFailure, GHOST_kSuccess, timer, and timers_.

Referenced by gwl_seat_key_repeat_timer_remove().

Member Data Documentation

◆ timers_

TTimerVector GHOST_TimerManager::timers_
protected

The list with event consumers.

Definition at line 93 of file GHOST_TimerManager.hh.

Referenced by addTimer(), disposeTimers(), fireTimers(), getNumTimers(), getTimerFound(), nextFireTime(), and removeTimer().


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