preCICE v3.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::utils {
7
10public:
11 // Returns the next free, i.e. unique, ID.
12 int getFreeID();
13
20 bool insertID(int id);
21
23 void resetIDs();
24
25private:
27 boost::container::flat_set<int> _ids;
28
30 int _lowerLimit = 0;
31};
32
33} // namespace precice::utils
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.
contains precice-related utilities.