1 | #pragma once |
---|---|
2 | |
3 | #include <common/Types.h> |
4 | #include <atomic> |
5 | |
6 | |
7 | /** Is used for numbering of files. |
8 | */ |
9 | struct SimpleIncrement |
10 | { |
11 | std::atomic<UInt64> value; |
12 | |
13 | SimpleIncrement(UInt64 start = 0) : value(start) {} |
14 | |
15 | void set(UInt64 new_value) |
16 | { |
17 | value = new_value; |
18 | } |
19 | |
20 | UInt64 get() |
21 | { |
22 | return ++value; |
23 | } |
24 | }; |
25 |