SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
SampleIteratorQueue.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../common.h"
4 #include "../utils/DynamicPriorityQueue.h"
5 
6 #include <algorithm>
7 
8 namespace smtrat {
9 namespace cad {
10  template<typename Iterator, typename Comparator>
12  private:
14  public:
15  auto begin() const {
16  return mQueue.begin();
17  }
18  auto end() const {
19  return mQueue.end();
20  }
21  template<typename InputIt>
22  void assign(InputIt begin, InputIt end) {
23  mQueue.assign(begin, end);
24  }
25  void clear() {
26  mQueue.clear();
27  }
28  template<typename Filter>
29  void cleanup(Filter&& f) {
30  auto it = std::remove_if(mQueue.begin(), mQueue.end(), f);
31  mQueue.erase(it, mQueue.end());
32  }
33  bool empty() const {
34  return mQueue.empty();
35  }
37  return mQueue.top();
38  }
40  mQueue.push(it);
41  }
42  template<typename InputIt>
43  void addNewSamples(InputIt begin, InputIt end) {
44  for (auto it = begin; it != end; it++) {
45  mQueue.push(*it);
46  }
47  }
49  auto it = mQueue.top();
50  mQueue.pop();
51  return it;
52  }
53 
54  bool is_consistent() const {
55  for (const auto& it: mQueue) {
56  if (!it.isValid()) return false;
57  }
58  return true;
59  }
60 
61  };
62  template<typename I, typename C>
63  inline std::ostream& operator<<(std::ostream& os, const SampleIteratorQueue<I,C>& siq) {
64  for (const auto& it: siq) {
65  os << *it << "@" << it.depth() << ", ";
66  }
67  return os;
68  }
69 }
70 }
auto erase(typename std::vector< T >::const_iterator it)
void addNewSamples(InputIt begin, InputIt end)
void assign(InputIt begin, InputIt end)
PriorityQueue< Iterator, Comparator > mQueue
std::ostream & operator<<(std::ostream &os, const SampleIteratorQueue< I, C > &siq)
PositionIteratorType Iterator
Definition: Common.h:49
Class to create the formulas for axioms.