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()
260 while (!stack_.empty())
267 virtual unsigned int size ()
269 return stack_.
size();
272 virtual void push_transient (
unsigned int root)
274 stack_.push(std::make_pair(root, empty_));
277 virtual void push_non_transient (
unsigned int root,
281 stack_.push(std::make_pair(root, empty_));
283 stack_.push(std::make_pair(root,
new markset(m)));
295 stack_pair ret_val = {stack_.top().first, *stack_.top().second};
297 max_size_ = max_size_ > stack_.size()? max_size_ : stack_.size();
298 if (stack_.top().second !=
empty_)
299 delete stack_.top().second;
304 virtual stack_pair top(
int)
306 stack_pair ret_val = {stack_.top().first, *stack_.top().second};
310 virtual unsigned int max_size()
316 std::stack<std::pair<unsigned int, markset*>> stack_;
336 while (!stack_.empty())
338 if (stack_.top().acc !=
empty_)
339 delete stack_.top().acc;
344 virtual unsigned int size ()
346 return stack_.
size();
349 virtual void push_transient (
unsigned int p)
351 if (stack_.empty() || !stack_.top().is_transient)
352 stack_.push({p, empty_, true});
355 virtual void push_non_transient (
unsigned int p,
359 stack_.push({p,
empty_,
false});
361 stack_.push({p,
new markset(m),
false});
373 max_size_ = max_size_ > stack_.size()? max_size_ : stack_.size();
374 if (!stack_.top().is_transient)
378 if (stack_.top().acc !=
empty_)
379 delete stack_.top().acc;
385 if (p == (
int)stack_.top().pos)
388 generic_stack::stack_pair ret_val = {(unsigned)p,*empty_};
393 virtual generic_stack::stack_pair top(
int p)
395 if (!stack_.top().is_transient)
397 generic_stack::stack_pair ret_val = {stack_.top().pos,
403 generic_stack::stack_pair ret_val = {(unsigned)p,*empty_};
416 std::stack<stack_entry> stack_;
421 #endif // SPOT_FASTTGBAALGOS_EC_ROOT_STACK_HH
this class acts like a wrapper to the C code of the open_set.
Definition: public.hh:32
Definition: root_stack.hh:364
Definition: root_stack.hh:250
Definition: root_stack.hh:107
unsigned int max_size_
The max size of the stack.
Definition: root_stack.hh:320
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:325
Definition: root_stack.hh:286
Definition: root_stack.hh:35
bool empty()
test is a least one mark is set
markset * empty_
The empty markset.
Definition: root_stack.hh:319
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
size_t size()
Return the number of marks in the set.
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