*strategy_ = *(parent_state->strategy_);
recipe_ = std::list(parent_state_->get_recipe());
- recipe_.push_back(incoming_transition_);
+ recipe_.push_back(incoming_transition_.get());
remote_app.get_actors_status(strategy_->actors_to_run_);
// 2. what action actor `next` was able to take given `times_considered`
// The latter update is important as *more* information is potentially available
// about a transition AFTER it has executed.
- transition_ = just_executed;
+ outgoing_transition_ = std::shared_ptr<Transition>(just_executed);
- const auto executed_transition = std::shared_ptr<Transition>(just_executed);
- actor_state.set_transition(executed_transition, times_considered);
+ actor_state.set_transition(outgoing_transition_, times_considered);
app.wait_for_requests();
- return executed_transition;
+ return outgoing_transition_;
}
} // namespace simgrid::mc
class XBT_PRIVATE State : public xbt::Extendable<State> {
static long expended_states_; /* Count total amount of states, for stats */
- /**
- * @brief The outgoing transition: what was the last transition that we took to leave this state?
- *
- * The owner of the transition is the `ActorState` instance which exists in this state.
- */
- Transition* transition_ = nullptr;
+ /** @brief The outgoing transition is the last transition that we took to leave this state. */
+ std::shared_ptr<Transition> outgoing_transition_ = nullptr;
- /**
- * @brief The incoming transition is what led to this state, coming from its parent
- *
- * The owner of the transition is the `ActorState` instance of the parent.
- */
- Transition* incoming_transition_ = nullptr;
+ /** @brief The incoming transition is what led to this state, coming from its parent */
+ std::shared_ptr<Transition> incoming_transition_ = nullptr;
/** @brief A list of transition to be replayed in order to get in this state. */
std::list<Transition*> recipe_;
unsigned long consider_all() const { return strategy_->consider_all(); }
bool is_actor_done(aid_t actor) const { return strategy_->actors_to_run_.at(actor).is_done(); }
- Transition* get_transition_out() const { return transition_; }
- void set_transition_out(Transition* t) { transition_ = t; }
+ std::shared_ptr<Transition> get_transition_out() const { return outgoing_transition_; }
std::shared_ptr<State> get_parent_state() const { return parent_state_; }
std::list<Transition*> get_recipe() const { return recipe_; }
void set_system_state(std::shared_ptr<Snapshot> state) { system_state_ = std::move(state); }
std::map<aid_t, Transition> const& get_sleep_set() const { return sleep_set_; }
- void add_sleep_set(const Transition* t)
+ void add_sleep_set(std::shared_ptr<Transition> t)
{
sleep_set_.insert_or_assign(t->aid_, Transition(t->type_, t->aid_, t->times_considered_));
}
RecordTrace res;
for (auto const& transition : stack_.back()->get_recipe())
res.push_back(transition);
- res.push_back(stack_.back()->get_transition_out());
+ res.push_back(stack_.back()->get_transition_out().get());
return res;
}
for (auto const& transition : stack_.back()->get_recipe()) {
trace.push_back(xbt::string_printf("%ld: %s", transition->aid_, transition->to_string().c_str()));
}
- if (const auto* trans = stack_.back()->get_transition_out(); trans != nullptr)
+ if (const auto trans = stack_.back()->get_transition_out(); trans != nullptr)
trace.push_back(xbt::string_printf("%ld: %s", trans->aid_, trans->to_string().c_str()));
return trace;
}
/* Actually answer the request: let's execute the selected request (MCed does one step) */
state->execute_next(next, get_remote_app());
- on_transition_execute_signal(state->get_transition_out(), get_remote_app());
+ on_transition_execute_signal(state->get_transition_out().get(), get_remote_app());
// If there are processes to interleave and the maximum depth has not been
// reached then perform one step of the exploration algorithm.
prev_state->get_transition_out()->to_string().c_str(), issuer_id);
tmp_stack.pop_back();
continue;
- } else if (prev_state->get_transition_out()->depends(state->get_transition_out())) {
+ } else if (prev_state->get_transition_out()->depends(state->get_transition_out().get())) {
XBT_VERB("Dependent Transitions:");
XBT_VERB(" %s (state=%ld)", prev_state->get_transition_out()->to_string().c_str(), prev_state->get_num());
XBT_VERB(" %s (state=%ld)", state->get_transition_out()->to_string().c_str(), state->get_num());
{
RecordTrace res;
for (std::shared_ptr<Pair> const& pair : exploration_stack_)
- res.push_back(pair->app_state_->get_transition_out());
+ res.push_back(pair->app_state_->get_transition_out().get());
return res;
}
{
RecordTrace res;
for (auto const& state : state_stack)
- res.push_back(state->get_transition_out());
+ res.push_back(state->get_transition_out().get());
return res;
}
{
std::vector<std::string> trace;
for (auto const& state : state_stack) {
- const auto* t = state->get_transition_out();
+ const auto t = state->get_transition_out();
trace.push_back(xbt::string_printf("%ld: %s", t->aid_, t->to_string().c_str()));
}
return trace;