mCRL2
Loading...
Searching...
No Matches
position_counter.h
Go to the documentation of this file.
1
// Author(s): Wieger Wesselink
2
// Copyright: see the accompanying file COPYING or copy at
3
// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4
//
5
// Distributed under the Boost Software License, Version 1.0.
6
// (See accompanying file LICENSE_1_0.txt or copy at
7
// http://www.boost.org/LICENSE_1_0.txt)
8
//
11
12
#ifndef MCRL2_UTILITIES_DETAIL_POSITION_COUNTER_H
13
#define MCRL2_UTILITIES_DETAIL_POSITION_COUNTER_H
14
15
#include <cstddef>
16
#include <vector>
17
18
namespace
mcrl2
{
19
20
namespace
utilities {
21
22
namespace
detail {
23
24
// Registers the current position (x, y) in a tree, and counts the number of nodes on every depth
25
struct
position_counter
26
{
27
const
std::size_t
undefined
= std::size_t(-1);
28
std::size_t
x
= 0;
29
std::size_t
y
=
undefined
;
// the depth
30
std::vector<std::size_t>
ycounts
;
// counts the number of nodes at a certain depth
31
32
void
increase
()
33
{
34
if
(
y
==
undefined
)
35
{
36
y
= 0;
37
}
38
else
39
{
40
y
++;
41
}
42
if
(
y
==
ycounts
.size())
43
{
44
ycounts
.push_back(1);
45
x
= 0;
46
}
47
else
48
{
49
x
=
ycounts
[
y
]++;
50
}
51
}
52
53
void
decrease
()
54
{
55
y
--;
56
}
57
58
bool
at
(std::size_t x0, std::size_t y0)
59
{
60
return
x
== x0 &&
y
== y0;
61
}
62
};
63
64
}
// namespace detail
65
66
}
// namespace utilities
67
68
}
// namespace mcrl2
69
70
#endif
// MCRL2_UTILITIES_DETAIL_POSITION_COUNTER_H
mcrl2
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition
indexed_set.h:72
mcrl2::utilities::detail::position_counter
Definition
position_counter.h:26
mcrl2::utilities::detail::position_counter::x
std::size_t x
Definition
position_counter.h:28
mcrl2::utilities::detail::position_counter::at
bool at(std::size_t x0, std::size_t y0)
Definition
position_counter.h:58
mcrl2::utilities::detail::position_counter::increase
void increase()
Definition
position_counter.h:32
mcrl2::utilities::detail::position_counter::ycounts
std::vector< std::size_t > ycounts
Definition
position_counter.h:30
mcrl2::utilities::detail::position_counter::decrease
void decrease()
Definition
position_counter.h:53
mcrl2::utilities::detail::position_counter::undefined
const std::size_t undefined
Definition
position_counter.h:27
mcrl2::utilities::detail::position_counter::y
std::size_t y
Definition
position_counter.h:29
utilities
include
mcrl2
utilities
detail
position_counter.h
Generated by
1.9.7