Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
TimestampFlags.h
Go to the documentation of this file.
1
31#pragma once
32
33#include <ogdf/basic/basic.h>
34
35#include <cstddef>
36#include <limits>
37#include <vector>
38
39namespace ogdf {
40namespace internal {
41namespace gcm {
42namespace datastructure {
43
45private:
46 std::vector<unsigned int> flags;
47 unsigned int current_round = 1;
48
49public:
50 TimestampFlags() { /*nothing to do*/
51 }
52
53 TimestampFlags(size_t size) : flags(size, 0) { /*nothing to do*/
54 }
55
56 size_t size() const { return flags.size(); }
57
58 void clear() {
60 if (current_round == std::numeric_limits<unsigned int>::max()) {
61 current_round = 1;
62 std::fill(flags.begin(), flags.end(), 0);
63 }
64 }
65
66 inline bool is_set(size_t id) const {
67 OGDF_ASSERT(id < flags.size());
68 return flags[id] == current_round;
69 }
70
71 inline void set(size_t id) {
72 OGDF_ASSERT(id < flags.size());
73 flags[id] = current_round;
74 }
75};
76
77}
78}
79}
80}
Basic declarations, included by all source files.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:41
The namespace for all OGDF objects.