Peano
Loading...
Searching...
No Matches
Enumerator.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5
6#include "tarch/logging/Log.h"
8#include <set>
9#include <string>
10
11
12namespace tarch {
13 class Enumerator;
14}
15
29 public:
30 static constexpr int NoNumber = -1;
31
32 Enumerator(int max = std::numeric_limits<int>::max()-2 );
33
37 void reset();
38
39 void setMax( int max );
40
47 int getNumber();
48
62 void releaseNumber( int value );
63
67 int size() const;
68
69 std::string toString() const;
70
71 private:
73
75 std::set<int> _activeNumbers;
76 int _max;
78};
79
Simple rank-global enumerator.
Definition Enumerator.h:28
tarch::multicore::BooleanSemaphore _semaphore
Definition Enumerator.h:74
static constexpr int NoNumber
Definition Enumerator.h:30
void setMax(int max)
void releaseNumber(int value)
Free a number.
Enumerator(int max=std::numeric_limits< int >::max() -2)
int size() const
Number of numbers handed out so far.
std::set< int > _activeNumbers
Definition Enumerator.h:75
void reset()
Complete reset, which basically eliminates all the active numbers.
int getNumber()
Return unique number.
std::string toString() const
static tarch::logging::Log _log
Definition Enumerator.h:72
Log Device.
Definition Log.h:517
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19