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

Timer class handles all high level timer tasks and management including adding, removing, providing interface for updating and defining crucial data for timer functionality. More...

#include <timer.h>

Public Member Functions

 Timer ()
 
void loadTimers ()
 loadTimers calls upon Files.
 
void printTimers ()
 printTimers loops through timeData to grab each TimerData instance and calls their corresponding print method.
 
void listenForInput ()
 Thread methods ------------------------—.
 
void handleCases (const char &answer)
 handleCases is a switch case method that handles mapping the users input to the correct class method
 
TimerData::Times getUserTimer ()
 getUserTimer prompts the user to input the hours minutes and seconds they would like to set on the timer and returns these values as a TimerData::Times struct.
 
void handleQuit ()
 Option methods -----------------------—.
 
void handleDeleteAll ()
 deleteAll removes all timers from memory
 
void handleResetAllTimers ()
 handleResetAllTimers handles resetting all timers to 00:00:00 in memory
 
void handleAddtimer ()
 handleAddTimer prompts the user to create a timer and add it to timeData vector
 
void handleRemoveTimer ()
 handleRemoveTimer removes a timer from timeData vector after prompting the user for the index of the timer they would like to remove
 

Public Attributes

std::vector< TimerDatatimeData
 timeData stores all the timers in memory for the user to manipulate as a vector of TimerData structures.
 
std::atomic< bool > running
 running is a special atomic bool created for managing the multi threaded nature of this class. Allowing both the printing in real time of the timers to the console and prompting the user for input
 

Detailed Description

Timer class handles all high level timer tasks and management including adding, removing, providing interface for updating and defining crucial data for timer functionality.

Constructor & Destructor Documentation

◆ Timer()

Timer::Timer ( )

Member Function Documentation

◆ getUserTimer()

TimerData::Times Timer::getUserTimer ( )

getUserTimer prompts the user to input the hours minutes and seconds they would like to set on the timer and returns these values as a TimerData::Times struct.

See also
TimerData::Times

◆ handleAddtimer()

void Timer::handleAddtimer ( )

handleAddTimer prompts the user to create a timer and add it to timeData vector

◆ handleCases()

void Timer::handleCases ( const char & answer)

handleCases is a switch case method that handles mapping the users input to the correct class method

Parameters
answersingle character input indicating what option method will be called based on users input

◆ handleDeleteAll()

void Timer::handleDeleteAll ( )

deleteAll removes all timers from memory

◆ handleQuit()

void Timer::handleQuit ( )

Option methods -----------------------—.

handleQuit quits the timer instance class by ending input clearing the console and stopping the printing of users timer. Also saves in memory timers as JSON to the users timer configuration file

◆ handleRemoveTimer()

void Timer::handleRemoveTimer ( )

handleRemoveTimer removes a timer from timeData vector after prompting the user for the index of the timer they would like to remove

◆ handleResetAllTimers()

void Timer::handleResetAllTimers ( )

handleResetAllTimers handles resetting all timers to 00:00:00 in memory

◆ listenForInput()

void Timer::listenForInput ( )

Thread methods ------------------------—.

listenForInput opens a thread which prompts the user for input and prints options for the user to select from to the console

◆ loadTimers()

void Timer::loadTimers ( )

loadTimers calls upon Files.

See also
Files to pull any stored timers from the users configuration and loads them into memory as timeData.
timeData

◆ printTimers()

void Timer::printTimers ( )

printTimers loops through timeData to grab each TimerData instance and calls their corresponding print method.

See also
TimerData

Member Data Documentation

◆ running

std::atomic<bool> Timer::running

running is a special atomic bool created for managing the multi threaded nature of this class. Allowing both the printing in real time of the timers to the console and prompting the user for input

◆ timeData

std::vector<TimerData> Timer::timeData

timeData stores all the timers in memory for the user to manipulate as a vector of TimerData structures.

See also
TimerData

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