blob: 8cd8bb686e2df1f828d84e4d6f536e318a0f2bd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/********************* */
/*! \file equality_engine_iterator.h
** \verbatim
** Top contributors (to current version):
** Andrew Reynolds, Dejan Jovanovic, Tim King
** This file is part of the CVC4 project.
** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
** in the top-level source directory and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
**
** \brief Iterator class for equality engine
**/
#include "cvc4_private.h"
#ifndef CVC5__THEORY__UF__EQUALITY_ENGINE_ITERATOR_H
#define CVC5__THEORY__UF__EQUALITY_ENGINE_ITERATOR_H
#include "expr/node.h"
#include "theory/uf/equality_engine_types.h"
namespace cvc5 {
namespace theory {
namespace eq {
class EqualityEngine;
/**
* Iterator to iterate over all the equivalence classes in an equality engine.
*/
class EqClassesIterator
{
public:
EqClassesIterator();
EqClassesIterator(const eq::EqualityEngine* ee);
Node operator*() const;
bool operator==(const EqClassesIterator& i) const;
bool operator!=(const EqClassesIterator& i) const;
EqClassesIterator& operator++();
EqClassesIterator operator++(int);
bool isFinished() const;
private:
/** Pointer to the equality engine we are iterating over */
const eq::EqualityEngine* d_ee;
/** The iterator value */
size_t d_it;
};
/**
* Iterator to iterate over the equivalence class members in a particular
* equivalence class.
*/
class EqClassIterator
{
public:
EqClassIterator();
/**
* Iterate over equivalence class eqc, where eqc must be a representative of
* argument ee.
*/
EqClassIterator(Node eqc, const eq::EqualityEngine* ee);
Node operator*() const;
bool operator==(const EqClassIterator& i) const;
bool operator!=(const EqClassIterator& i) const;
EqClassIterator& operator++();
EqClassIterator operator++(int);
bool isFinished() const;
private:
/** Pointer to the equality engine we are iterating over */
const eq::EqualityEngine* d_ee;
/** Starting node */
EqualityNodeId d_start;
/** Current node */
EqualityNodeId d_current;
};
} // Namespace eq
} // Namespace theory
} // namespace cvc5
#endif
|