Plaquette
 
Loading...
Searching...
No Matches
Timeable.h
1/*
2 * Timeable.h
3 *
4 * (c) 2025 Sofian Audry :: info(@)sofianaudry(.)com
5 * (c) 2018 Thomas O Fredericks :: tof(@)t-o-f(.)info
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef PQ_TIMEABLE_H_
22#define PQ_TIMEABLE_H_
23
24namespace pq {
25
27class Timeable {
28public:
29 Timeable() {}
30
32 virtual void start();
33
35 virtual void stop();
36
38 virtual void pause();
39
41 virtual void resume();
42
44 virtual void togglePause();
45
47 virtual void setTime(float time) = 0;
48
50 virtual void addTime(float time) = 0;
51
53 virtual bool isRunning() const = 0;
54
55protected:
56 // Sets running state.
57 virtual void _setRunning(bool isRunning) = 0;
58};
59
60}
61
62#endif
Abstract class for time-based objects.
Definition Timeable.h:27
virtual void pause()
Interrupts the chronometer.
Definition Timeable.cpp:37
virtual void togglePause()
Toggles pause/unpause.
Definition Timeable.cpp:45
virtual void resume()
Resumes process.
Definition Timeable.cpp:41
virtual void stop()
Interrupts the chronometer and resets to zero.
Definition Timeable.cpp:31
virtual bool isRunning() const =0
Returns true iff currently running.
virtual void setTime(float time)=0
Forces current time (in seconds).
virtual void addTime(float time)=0
Adds/subtracts time to the chronometer.
virtual void start()
Starts/restarts the chronometer.
Definition Timeable.cpp:25