Zephyr C++ Toolkit
Loading...
Searching...
No Matches
zct::TimerManager Class Reference

#include <TimerManager.hpp>

Collaboration diagram for zct::TimerManager:

Classes

struct  TimerExpiryInfo
 

Public Member Functions

 TimerManager (uint32_t maxNumTimers)
 
 ~TimerManager ()
 
void registerTimer (Timer &timer)
 
TimerExpiryInfo getNextExpiringTimer ()
 

Protected Attributes

Timer ** m_timers
 
uint32_t m_numTimers = 0
 
uint32_t m_maxNumTimers
 

Constructor & Destructor Documentation

◆ TimerManager()

zct::TimerManager::TimerManager ( uint32_t  maxNumTimers)
inline

Create a new timer manager.

Dynamically allocates memory for maxNumTimers pointers to timers.

Parameters
maxNumTimersThe maximum number of timers that can be registered with the timer manager. Space for this many pointers to timers will be allocated on the heap.

◆ ~TimerManager()

zct::TimerManager::~TimerManager ( )
inline

Member Function Documentation

◆ getNextExpiringTimer()

TimerExpiryInfo zct::TimerManager::getNextExpiringTimer ( )
inline

Iterates over all registered timers and returns the expiry time of the timer that expires next. If no timer is found, the 'timer' member of the returned struct will be nullptr. timer is guaranteed to not be nullptr if durationToWaitUs is not UINT64_MAX.

This function does not update the timer's next expiry time if it finds an expired timer. It is up to the caller to do this when it decides that the timer expiry has been "handled".

Returns
A struct containing the timer that expires next and the duration to wait until that timer expires.

◆ registerTimer()

void zct::TimerManager::registerTimer ( Timer timer)
inline

Registers a timer with the timer manager. The provided timer needs to exist for the duration of the registration.

Parameters
timerThe timer to register.

Member Data Documentation

◆ m_maxNumTimers

uint32_t zct::TimerManager::m_maxNumTimers
protected

◆ m_numTimers

uint32_t zct::TimerManager::m_numTimers = 0
protected

◆ m_timers

Timer** zct::TimerManager::m_timers
protected

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