Blender  V2.93
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
GHOST_TimerManager Class Reference

#include <GHOST_TimerManager.h>

Public Member Functions

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

Protected Types

typedef std::vector< GHOST_TimerTask * > TTimerVector
 

Protected Member Functions

void disposeTimers ()
 

Protected Attributes

TTimerVector m_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 38 of file GHOST_TimerManager.h.

Member Typedef Documentation

◆ TTimerVector

typedef std::vector<GHOST_TimerTask *> GHOST_TimerManager::TTimerVector
protected

Definition at line 106 of file GHOST_TimerManager.h.

Constructor & Destructor Documentation

◆ GHOST_TimerManager()

GHOST_TimerManager::GHOST_TimerManager ( )

Constructor.

Copyright (C) 2001 NaN Technologies B.V.

Definition at line 34 of file GHOST_TimerManager.cpp.

◆ ~GHOST_TimerManager()

GHOST_TimerManager::~GHOST_TimerManager ( )

Destructor.

Definition at line 38 of file GHOST_TimerManager.cpp.

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 54 of file GHOST_TimerManager.cpp.

References getTimerFound(), GHOST_kFailure, GHOST_kSuccess, and m_timers.

Referenced by GHOST_System::installTimer().

◆ disposeTimers()

void GHOST_TimerManager::disposeTimers ( )
protected

Deletes all timers.

Definition at line 137 of file GHOST_TimerManager.cpp.

References m_timers.

Referenced by ~GHOST_TimerManager().

◆ fireTimer()

bool GHOST_TimerManager::fireTimer ( GHOST_TUns64  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 112 of file GHOST_TimerManager.cpp.

References next, blender::compositor::task, and time.

Referenced by fireTimers().

◆ fireTimers()

bool GHOST_TimerManager::fireTimers ( GHOST_TUns64  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 99 of file GHOST_TimerManager.cpp.

References fireTimer(), m_timers, and time.

Referenced by GHOST_System::dispatchEvents(), GHOST_System::installTimer(), GHOST_SystemCocoa::processEvents(), GHOST_SystemSDL::processEvents(), GHOST_SystemWin32::processEvents(), GHOST_SystemX11::processEvents(), and GHOST_SystemWayland::processEvents().

◆ getNumTimers()

GHOST_TUns32 GHOST_TimerManager::getNumTimers ( )

Returns the number of timer tasks.

Returns
The number of events on the stack.

Definition at line 43 of file GHOST_TimerManager.cpp.

References m_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 48 of file GHOST_TimerManager.cpp.

References m_timers.

Referenced by addTimer().

◆ nextFireTime()

GHOST_TUns64 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 84 of file GHOST_TimerManager.cpp.

References GHOST_kFireTimeNever, m_timers, and next.

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 68 of file GHOST_TimerManager.cpp.

References GHOST_kFailure, GHOST_kSuccess, and m_timers.

Referenced by GHOST_System::removeTimer().

Member Data Documentation

◆ m_timers

TTimerVector GHOST_TimerManager::m_timers
protected

The list with event consumers.

Definition at line 108 of file GHOST_TimerManager.h.

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


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