0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
Hypertable::Timer Class Reference

A timer class to keep timeout states across AsyncComm related calls. More...

#include <Timer.h>

Public Member Functions

 Timer (uint32_t millis, bool start_timer=false)
 Constructor; assigns number of milliseconds after which the timer will expire. More...
 
void start ()
 Starts the timer. More...
 
void stop ()
 Stops the timer. More...
 
void reset (bool start_timer=false)
 Resets the timer. More...
 
uint32_t remaining ()
 Returns the remaining time till expiry. More...
 
bool expired ()
 Returns true if the timer is expired. More...
 
bool is_running ()
 Returns true if the timer is still running (not yet expired. More...
 
uint32_t duration ()
 Returns the duration of the timer. More...
 

Private Attributes

std::chrono::fast_clock::time_point start_time
 The time when the timer was started. More...
 
bool m_running
 True if the timer is running. More...
 
bool m_started {}
 True if the timer was started. More...
 
std::chrono::fast_clock::duration m_duration
 The duration of the timer. More...
 
std::chrono::fast_clock::duration m_remaining
 The remaining time till expiration. More...
 

Detailed Description

A timer class to keep timeout states across AsyncComm related calls.

Definition at line 44 of file Timer.h.

Constructor & Destructor Documentation

Hypertable::Timer::Timer ( uint32_t  millis,
bool  start_timer = false 
)
inline

Constructor; assigns number of milliseconds after which the timer will expire.

Parameters
millisNumber of milliseconds after timer will expire
start_timerIf true, timer is started immediately; otherwise start with start

Definition at line 54 of file Timer.h.

Member Function Documentation

uint32_t Hypertable::Timer::duration ( )
inline

Returns the duration of the timer.

Returns
Timer duration in milliseconds

Definition at line 127 of file Timer.h.

bool Hypertable::Timer::expired ( )
inline

Returns true if the timer is expired.

Definition at line 112 of file Timer.h.

bool Hypertable::Timer::is_running ( )
inline

Returns true if the timer is still running (not yet expired.

Definition at line 119 of file Timer.h.

uint32_t Hypertable::Timer::remaining ( )
inline

Returns the remaining time till expiry.

Returns
Remaining time in milliseconds

Definition at line 101 of file Timer.h.

void Hypertable::Timer::reset ( bool  start_timer = false)
inline

Resets the timer.

Definition at line 89 of file Timer.h.

void Hypertable::Timer::start ( )
inline

Starts the timer.

Will have no effect if the timer is still running.

Definition at line 64 of file Timer.h.

void Hypertable::Timer::stop ( )
inline

Stops the timer.

Will assert that the timer was started. Updates the remaining time (see remaining).

Definition at line 77 of file Timer.h.

Member Data Documentation

std::chrono::fast_clock::duration Hypertable::Timer::m_duration
private

The duration of the timer.

Definition at line 144 of file Timer.h.

std::chrono::fast_clock::duration Hypertable::Timer::m_remaining
private

The remaining time till expiration.

Definition at line 147 of file Timer.h.

bool Hypertable::Timer::m_running
private

True if the timer is running.

Definition at line 138 of file Timer.h.

bool Hypertable::Timer::m_started {}
private

True if the timer was started.

Definition at line 141 of file Timer.h.

std::chrono::fast_clock::time_point Hypertable::Timer::start_time
private

The time when the timer was started.

Definition at line 135 of file Timer.h.


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