blob: ee3f73e1f190f6a9884c6f3f2f90e049d6788ddf (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup freestyle
* \brief Class defining a singleton used as timestamp
*/
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
class TimeStamp {
public:
static inline TimeStamp *instance()
{
return &_instance;
}
inline unsigned getTimeStamp() const
{
return _time_stamp;
}
inline void increment()
{
++_time_stamp;
}
inline void reset()
{
_time_stamp = 1;
}
protected:
TimeStamp()
{
_time_stamp = 1;
}
TimeStamp(const TimeStamp &)
{
}
private:
static TimeStamp _instance;
unsigned _time_stamp;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TimeStamp")
#endif
};
} /* namespace Freestyle */
|