19 #ifndef SPOT_FASTTGBAALGOS_EC_ROOT_STACK_HH
20 # define SPOT_FASTTGBAALGOS_EC_ROOT_STACK_HH
25 #include "misc/hash.hh"
26 #include "union_find.hh"
27 #include "fasttgba/fasttgba.hh"
45 while (!stack_.empty())
52 virtual bool is_empty ()
54 return stack_.empty();
57 virtual unsigned int size ()
62 virtual void push_trivial (
unsigned int root)
64 stack_.push(std::make_pair(root, empty_));
72 stack_.push(std::make_pair(root, empty_));
74 stack_.push(std::make_pair(root,
new markset(m)));
77 virtual unsigned int root_of_the_top ()
79 return stack_.top().first;
84 max_size_ = max_size_ > stack_.size()? max_size_ : stack_.size();
85 if (stack_.top().second != empty_)
86 delete stack_.top().second;
90 virtual const markset& top_acceptance()
92 assert(!stack_.empty());
93 return *stack_.top().second;
96 virtual unsigned int max_size()
102 std::stack<std::pair<unsigned int, markset*>> stack_;
104 unsigned int max_size_;
120 unsigned int max_size_;
132 while (!stack_.empty())
139 virtual bool is_empty ()
141 return stack_.empty();
144 virtual unsigned int size ()
146 return stack_.size();
149 virtual void push_trivial (
unsigned int root)
156 stack_.push_back({root,
true, empty_});
160 else if (stack_.back().is_trivial)
162 assert(root == stack_.back().root +1);
164 stack_.push_back({root,
true, empty_});
170 root <= stack_.back().root +1);
171 stack_.back().root = root -1;
172 stack_.push_back({root,
true, empty_});
178 unsigned int last = 0)
181 assert(root <= last);
182 assert (!is_empty() || root == 0);
183 assert(is_empty() || root == stack_.back().root +1);
186 stack_.push_back({last,
false, empty_});
188 stack_.push_back({last,
false,
new markset(m)});
195 assert (!is_empty());
196 if (stack_.back().is_trivial)
197 return stack_.back().root;
198 if (stack_.size() > 1)
199 return (stack_[stack_.size() - 2]).root + 1;
205 max_size_ = max_size_ > stack_.size()? max_size_ : stack_.size();
209 if (stack_.back().is_trivial)
215 stack_.push_back({r-1,
true, empty_});
219 if (r - 1 > stack_.back().root)
220 stack_.push_back({r-1,
true, empty_});
225 if (stack_.back().mark != empty_)
226 delete stack_.back().mark;
231 virtual const markset& top_acceptance()
233 assert(!stack_.empty());
234 return *stack_.back().mark;
237 virtual unsigned int max_size()
245 #endif // SPOT_FASTTGBAALGOS_EC_ROOT_STACK_HH
Definition: root_stack.hh:107
virtual void push_non_trivial(unsigned int root, markset m, unsigned int last=0)
< Unused for this implem
Definition: root_stack.hh:176
Definition: root_stack.hh:35
int mark
the type that represents a mark
Definition: markset.hh:32
This class represents a set of acceptance marks.
Definition: markset.hh:35
Definition: acc_dict.hh:31
virtual unsigned int root_of_the_top()
Definition: root_stack.hh:193
virtual void push_non_trivial(unsigned int root, markset m, unsigned int)
< Unused for this implem
Definition: root_stack.hh:67