Timer Console
Loading...
Searching...
No Matches
TimerData Class Reference

TimerData class is the structure of what the actual timer imementatiom will be for each timer a user creates. Initializes all data when created. More...

#include <timerData.h>

Classes

struct  Times
 Times struct organizes parts of a timer body including the hour, minutes, seconds and milliseconds. All parts are initialized at creation time. More...
 

Public Member Functions

 TimerData (const int &i)
 
void setTime (const int &hours, const int &minutes, const int &seconds)
 setTime method sets the initial time on creation when called from Timer class.
 
void start ()
 start method updates paused and running member methods to start counting time and updates the startTime
 
void pause ()
 pause stops the timer and calculates the elapsed time to update it
 
void reset ()
 reset method updates paused and running g member variables and sets the elapsedTime to 0
 
bool isComplete ()
 isComplete method returns a true or false depending on if getTimeRemaining returns a value less than 0. To stop the timer and set off an alarm
 
std::chrono::milliseconds getTimeRemaining ()
 
void printRemainingTime ()
 printRemainingTime method prints the timer to the console in a user friendly way and in the correctly place in the console
 
void setIndex (const int &newIndex)
 setIndex method changes the index of the timer depending on if the user moves the timer within the list of timers in memory aka TimerData vector setIndex
 
bool getIsPaused ()
 getIsPaused tells the caller of the method if the timer is counting down
 
bool getIsRunning ()
 getIsRunning tells the caller of the method if the timer is counting down
 
std::vector< TimesgetTimes ()
 getTimes method returns the time of the timer as a Times structure
 

Public Attributes

bool index
 

Private Attributes

std::chrono::milliseconds duration
 
std::chrono::steady_clock::time_point startTime
 
std::chrono::steady_clock::duration elapsedTime
 
bool running
 
bool paused
 

Detailed Description

TimerData class is the structure of what the actual timer imementatiom will be for each timer a user creates. Initializes all data when created.

Constructor & Destructor Documentation

◆ TimerData()

TimerData::TimerData ( const int & i)

TimerData constructor takes in single para

Parameters
iProvided by the length of the timerData vector in Timer class for easy selection when prompting user for input
See also
Timer

Member Function Documentation

◆ getIsPaused()

bool TimerData::getIsPaused ( )

getIsPaused tells the caller of the method if the timer is counting down

◆ getIsRunning()

bool TimerData::getIsRunning ( )

getIsRunning tells the caller of the method if the timer is counting down

◆ getTimeRemaining()

std::chrono::milliseconds TimerData::getTimeRemaining ( )

◆ getTimes()

std::vector< TimerData::Times > TimerData::getTimes ( )

getTimes method returns the time of the timer as a Times structure

See also
Times

◆ isComplete()

bool TimerData::isComplete ( )

isComplete method returns a true or false depending on if getTimeRemaining returns a value less than 0. To stop the timer and set off an alarm

See also
getTimeRemaining

◆ pause()

void TimerData::pause ( )

pause stops the timer and calculates the elapsed time to update it

See also
elapsedTime

◆ printRemainingTime()

void TimerData::printRemainingTime ( )

printRemainingTime method prints the timer to the console in a user friendly way and in the correctly place in the console

◆ reset()

void TimerData::reset ( )

reset method updates paused and running g member variables and sets the elapsedTime to 0

See also
paused
running
elapsedTime

◆ setIndex()

void TimerData::setIndex ( const int & newIndex)

setIndex method changes the index of the timer depending on if the user moves the timer within the list of timers in memory aka TimerData vector setIndex

See also
timerData
Parameters
newIndexInteger defining what index of TimerData vector the timer should change to

◆ setTime()

void TimerData::setTime ( const int & hours,
const int & minutes,
const int & seconds )

setTime method sets the initial time on creation when called from Timer class.

See also
Timer

◆ start()

void TimerData::start ( )

start method updates paused and running member methods to start counting time and updates the startTime

See also
paused
running
startTime

Member Data Documentation

◆ duration

std::chrono::milliseconds TimerData::duration
private

◆ elapsedTime

std::chrono::steady_clock::duration TimerData::elapsedTime
private

◆ index

bool TimerData::index

◆ paused

bool TimerData::paused
private

◆ running

bool TimerData::running
private

◆ startTime

std::chrono::steady_clock::time_point TimerData::startTime
private

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