Timer Console
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1/*
2MIT License
3
4Copyright (c) 2025 Ryan Large
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24
25#ifndef TIMER_H
26#define TIMER_H
27
28#include <atomic>
29#include <chrono>
30#include <iostream>
31#include <vector>
32
33#include "./timerData.h"
34
38class Timer {
39 public:
40 Timer();
41
45 std::vector<TimerData> timeData;
46
50 std::atomic<bool> running;
51
55 void loadTimers();
56
60 void printTimers();
61
62
64
67 void listenForInput();
68
73 void handleCases(const char& answer);
74
80
81
83
86 void handleQuit();
87
91 void handleDeleteAll();
92
97
101 void handleAddtimer();
102
106 void handleRemoveTimer();
107
108 protected:
109 private:
110};
111
112#endif
void handleQuit()
Option methods -----------------------—.
Definition timer.cpp:141
void handleDeleteAll()
deleteAll removes all timers from memory
Definition timer.cpp:149
void handleResetAllTimers()
handleResetAllTimers handles resetting all timers to 00:00:00 in memory
Definition timer.cpp:156
void loadTimers()
loadTimers calls upon Files.
Definition timer.cpp:57
void handleAddtimer()
handleAddTimer prompts the user to create a timer and add it to timeData vector
Definition timer.cpp:163
Timer()
Definition timer.cpp:46
void handleRemoveTimer()
handleRemoveTimer removes a timer from timeData vector after prompting the user for the index of the ...
Definition timer.cpp:182
void printTimers()
printTimers loops through timeData to grab each TimerData instance and calls their corresponding prin...
Definition timer.cpp:69
TimerData::Times getUserTimer()
getUserTimer prompts the user to input the hours minutes and seconds they would like to set on the ti...
Definition timer.cpp:202
std::atomic< bool > running
running is a special atomic bool created for managing the multi threaded nature of this class....
Definition timer.h:50
void handleCases(const char &answer)
handleCases is a switch case method that handles mapping the users input to the correct class method
Definition timer.cpp:117
void listenForInput()
Thread methods ------------------------—.
Definition timer.cpp:78
std::vector< TimerData > timeData
timeData stores all the timers in memory for the user to manipulate as a vector of TimerData structur...
Definition timer.h:45
Times struct organizes parts of a timer body including the hour, minutes, seconds and milliseconds....
Definition timerData.h:40