msl 1.3.0
Loading...
Searching...
No Matches
Counter.h
Go to the documentation of this file.
1// Copyright 2024 Julien Lamy, ICube, Université de Strasbourg-CNRS.
2// Part of msl, distributed under the terms of the MIT license.
3
4#ifndef _abe0360e_c8a7_4aae_a795_924c3cdcd44e
5#define _abe0360e_c8a7_4aae_a795_924c3cdcd44e
6
7#include <cstddef>
8
9namespace msl
10{
11
14{
15public:
17 Counter(std::size_t end);
18
20 std::size_t index() const;
21
23 std::size_t end() const;
24
26 Counter & setEnd(std::size_t end);
27
30
36
38 bool first() const;
39
41 bool last() const;
42
44 bool done() const;
45
46private:
47 std::size_t _end, _index;
48};
49
50}
51
52#endif // _abe0360e_c8a7_4aae_a795_924c3cdcd44e
Counter from 0 (included) to end (excluded).
Definition Counter.h:14
Counter & operator++()
Increment the index.
bool last() const
Test if the index is equal to end-1.
bool done() const
Test if the index is equal to end.
Counter & reset()
Set the index to 0.
Counter(std::size_t end)
Initialize index to 0.
Counter & setEnd(std::size_t end)
Set the end value.
std::size_t end() const
Return the end value.
bool first() const
Test if the index is 0.
std::size_t index() const
Return the current index.
Top-level namespace of the msl library.
Definition acceleration.h:17