λ61
Loading...
Searching...
No Matches
AbstractTimer.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 Tetex7
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18//
19// Created by tete on 8/24/25.
20//
21#pragma once
22
23#ifndef L61_ITIMER_HPP
24#define L61_ITIMER_HPP
26
27#include <cstdint>
29{
30 class AbstractTimer : public Object
31 {
32 public:
33 enum class Mode : bool { SECONDS, MILLISECONDS };
34 private:
35 const Mode m_mode;
36 public:
37 explicit AbstractTimer(Mode mode = Mode::MILLISECONDS);
38
39 virtual void start(std::uint32_t duration) = 0;
40 virtual bool isFinished() const = 0;
41 virtual void reset() = 0;
42
43 operator bool() const;
44 Mode getMode() const;
45
46 virtual ~AbstractTimer() = default;
47 };
48}
49#endif // L61_ITIMER_HPP
virtual bool isFinished() const =0
Mode getMode() const
Definition AbstractTimer.cpp:32
Mode
Definition AbstractTimer.hpp:33
@ SECONDS
Definition AbstractTimer.hpp:33
@ MILLISECONDS
Definition AbstractTimer.hpp:33
virtual void start(std::uint32_t duration)=0
AbstractTimer(Mode mode=Mode::MILLISECONDS)
Definition AbstractTimer.cpp:27
const Mode m_mode
Definition AbstractTimer.hpp:35
Definition Object.hpp:47
Definition AbstractTimer.hpp:29