TS-E+ базовая библиотека.
libTSE+
Титульная страница
Классы
Файлы
Файлы
Указатель
Классы
Функции
Переменные
Определения типов
include
timer.h
1
/*
2
* timer.h
3
*
4
* Created on: Apr 16, 2015
5
* Author: nick
6
*/
7
8
#ifndef TIMER_H_
9
#define TIMER_H_
10
11
#include "system.h"
12
16
typedef
enum
{
17
started,
18
stopped,
19
elapsed
20
} TimerState;
21
25
class
Timer
{
26
private
:
27
TimerState _state;
28
uint32_t _timeout;
29
uint64_t _elapsed;
30
public
:
35
Timer
(uint32_t timeout) : _state(::started), _timeout(timeout), _elapsed(
System
->getTicksCount()+timeout) {}
39
bool
isElapsed
() {
40
if
(_state == started)
41
if
(_elapsed <= System->getTicksCount())
42
_state = elapsed;
43
return
_state == elapsed;
44
}
49
void
restart
(uint32_t timeout = 0) {
50
if
(timeout !=0 )
51
_timeout = timeout;
52
_elapsed =
System
->
getTicksCount
()+_timeout;
53
_state = started;
54
}
58
void
stop
() {
59
_state = stopped;
60
}
61
};
62
63
64
#endif
/* TIMER_H_ */
Timer
Definition:
timer.h:25
System::getTicksCount
const uint64_t getTicksCount()
Timer::stop
void stop()
Definition:
timer.h:58
Timer::Timer
Timer(uint32_t timeout)
Definition:
timer.h:35
Timer::restart
void restart(uint32_t timeout=0)
Definition:
timer.h:49
Timer::isElapsed
bool isElapsed()
Definition:
timer.h:39
System
Definition:
system.h:206
Документация по TS-E+ базовая библиотека.. Последние изменения: Сб 6 Июн 2015 23:31:01. Создано системой
1.8.5