MySQL 26.10.0
Source Code Documentation
hm::Cycle_Timer Class Reference

Cycle-driven timer. More...

#include <health_monitor_timer.h>

Public Member Functions

 Cycle_Timer ()=default
 
 Cycle_Timer (int interval, int timeout)
 
void tick ()
 Cycle Timer - Advance the timer using the default interval. More...
 
void tick (int interval)
 Cycle Timer - Advance the timer using the given interval. More...
 
void reset ()
 Cycle Timer - Reset. More...
 
void set_name (const std::string &name)
 
void set_interval (int interval)
 Cycle Timer - Set interval. More...
 
void set_timeout (int timeout)
 Cycle Timer - Set timeout. More...
 
void adjust_timeout ()
 Cycle Timer - Round up timeout to the next interval. More...
 
int interval () const
 
int timeout () const
 
bool expired () const
 
int remaining () const
 Cycle Timer - Return seconds remaining or 0. More...
 
std::string format_status () const
 Cycle Timer - Return formatted string with timer settings. More...
 

Private Attributes

std::string m_name {"Cycle_Timer"}
 
int m_timer {0}
 
int m_interval {k_default_timer_interval}
 
int m_timeout {k_default_timer_timeout}
 
bool m_expired {false}
 

Detailed Description

Cycle-driven timer.

  • Interval = time between ticks
  • Timeout = total time before expiration

Constructor & Destructor Documentation

◆ Cycle_Timer() [1/2]

hm::Cycle_Timer::Cycle_Timer ( )
default

◆ Cycle_Timer() [2/2]

hm::Cycle_Timer::Cycle_Timer ( int  interval,
int  timeout 
)
inline

Member Function Documentation

◆ adjust_timeout()

void hm::Cycle_Timer::adjust_timeout ( )

Cycle Timer - Round up timeout to the next interval.

◆ expired()

bool hm::Cycle_Timer::expired ( ) const
inline

◆ format_status()

std::string hm::Cycle_Timer::format_status ( ) const

Cycle Timer - Return formatted string with timer settings.

◆ interval()

int hm::Cycle_Timer::interval ( ) const
inline

◆ remaining()

int hm::Cycle_Timer::remaining ( ) const

Cycle Timer - Return seconds remaining or 0.

◆ reset()

void hm::Cycle_Timer::reset ( )

Cycle Timer - Reset.

◆ set_interval()

void hm::Cycle_Timer::set_interval ( int  interval)

Cycle Timer - Set interval.

◆ set_name()

void hm::Cycle_Timer::set_name ( const std::string &  name)
inline

◆ set_timeout()

void hm::Cycle_Timer::set_timeout ( int  timeout)

Cycle Timer - Set timeout.

◆ tick() [1/2]

void hm::Cycle_Timer::tick ( )

Cycle Timer - Advance the timer using the default interval.

◆ tick() [2/2]

void hm::Cycle_Timer::tick ( int  interval)

Cycle Timer - Advance the timer using the given interval.

◆ timeout()

int hm::Cycle_Timer::timeout ( ) const
inline

Member Data Documentation

◆ m_expired

bool hm::Cycle_Timer::m_expired {false}
private

◆ m_interval

int hm::Cycle_Timer::m_interval {k_default_timer_interval}
private

◆ m_name

std::string hm::Cycle_Timer::m_name {"Cycle_Timer"}
private

◆ m_timeout

int hm::Cycle_Timer::m_timeout {k_default_timer_timeout}
private

◆ m_timer

int hm::Cycle_Timer::m_timer {0}
private

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