-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdelta_t.h
38 lines (29 loc) · 1.12 KB
/
delta_t.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef DELTA_T_H
#define DELTA_T_H
#include <iosfwd>
#include <string>
/// The time that passes
/// where
/// * 0.01 means that only 1% of the full move is done
/// * 1.0 denotes a full move, i.e. a piece traverses 1.0 game coordinat
class delta_t
{
public:
explicit delta_t(const double dt);
double get() const noexcept { return m_delta_t; }
private:
double m_delta_t;
};
/// Test this class and its free functions
void test_delta_t();
bool operator==(const delta_t& lhs, const delta_t& rhs) noexcept;
bool operator<(const delta_t& lhs, const delta_t& rhs) noexcept;
bool operator<=(const delta_t& lhs, const delta_t& rhs) noexcept;
delta_t& operator+=(delta_t& lhs, const delta_t& rhs) noexcept;
delta_t operator+(const delta_t& lhs, const delta_t& rhs) noexcept;
delta_t operator-(const delta_t& lhs, const delta_t& rhs) noexcept;
delta_t operator*(const delta_t& lhs, const delta_t& rhs) noexcept;
bool operator>(const delta_t& lhs, const delta_t& rhs) noexcept;
bool operator>=(const delta_t& lhs, const delta_t& rhs) noexcept;
std::ostream& operator<<(std::ostream& os, const delta_t& dt) noexcept;
#endif // DELTA_T_H