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