The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Attributes | List of all members
utils::rate_counter Class Reference

#include <rate_counter.hpp>

Public Member Functions

 rate_counter (unsigned rate)
 
bool poll ()
 Increments the counter by one and checks whether it is now a multiple of the chosen rate. More...
 

Private Attributes

unsigned counter_ = 0
 
unsigned rate_ = 1
 

Detailed Description

Definition at line 19 of file rate_counter.hpp.

Constructor & Destructor Documentation

◆ rate_counter()

utils::rate_counter::rate_counter ( unsigned  rate)
inlineexplicit

Definition at line 22 of file rate_counter.hpp.

Member Function Documentation

◆ poll()

bool utils::rate_counter::poll ( )
inline

Increments the counter by one and checks whether it is now a multiple of the chosen rate.

Definition at line 25 of file rate_counter.hpp.

References counter_, and rate_.

Member Data Documentation

◆ counter_

unsigned utils::rate_counter::counter_ = 0
private

Definition at line 28 of file rate_counter.hpp.

Referenced by poll().

◆ rate_

unsigned utils::rate_counter::rate_ = 1
private

Definition at line 29 of file rate_counter.hpp.

Referenced by poll().


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