this->state_ = InterleavingType::todo;
this->times_considered_ = 0;
}
- void set_done() { this->state_ = InterleavingType::done; }
+ void mark_done() { this->state_ = InterleavingType::done; }
+
+ inline Transition* get_transition(unsigned times_considered)
+ {
+ xbt_assert(times_considered < this->pending_transitions_.size(),
+ "Actor %lu does not have a state available transition with `times_considered = %d`,\n"
+ "yet one was asked for",
+ aid_, times_considered);
+ return this->pending_transitions_[times_considered].get();
+ }
+
+ inline void set_transition(std::unique_ptr<Transition> t, unsigned times_considered)
+ {
+ xbt_assert(times_considered < this->pending_transitions_.size(),
+ "Actor %lu does not have a state available transition with `times_considered = %d`, "
+ "yet one was attempted to be set",
+ aid_, times_considered);
+ this->pending_transitions_[times_considered] = std::move(t);
+ }
};
} // namespace simgrid::mc
return boost::range::count_if(this->actors_to_run_, [](auto& pair) { return pair.second.is_todo(); });
}
+void State::mark_all_todo()
+{
+ for (auto & [aid, actor] : actors_to_run_) {
+
+ if (actor.is_enabled() and not actor.is_done() and not actor.is_todo())
+ actor.mark_todo();
+
+ }
+}
+
Transition* State::get_transition() const
{
- return transition_.get();
- return transition_;
++ return transition_;
}
aid_t State::next_transition() const
long get_num() const { return num_; }
std::size_t count_todo() const;
void mark_todo(aid_t actor) { actors_to_run_.at(actor).mark_todo(); }
+ void mark_done(aid_t actor) { actors_to_run_.at(actor).mark_done();}
+ void mark_all_todo();
bool is_done(aid_t actor) const { return actors_to_run_.at(actor).is_done(); }
Transition* get_transition() const;
- void set_transition(Transition* t) { transition_.reset(t); }
+ void set_transition(Transition* t) { transition_ = t; }
std::map<aid_t, ActorState> const& get_actors_list() const { return actors_to_run_; }
unsigned long get_actor_count() const { return actors_to_run_.size(); }