preCICE v3.1.2
Loading...
Searching...
No Matches
ManageUniqueIDs.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <boost/container/flat_set.hpp>
4#include <functional>
5
6namespace precice {
7namespace utils {
8
11public:
12 // Returns the next free, i.e. unique, ID.
13 int getFreeID();
14
21 bool insertID(int id);
22
24 void resetIDs();
25
26private:
28 boost::container::flat_set<int> _ids;
29
31 int _lowerLimit = 0;
32};
33
34} // namespace utils
35} // namespace precice
Manages a set of unique IDs.
bool insertID(int id)
Inserts an ID which has to be unique.
boost::container::flat_set< int > _ids
Stores all used IDs.
int _lowerLimit
Marks next ID to be given, from lower to higher values.
void resetIDs()
Resets all retrieved and inserted IDs.
Main namespace of the precice library.