return res;
}
TestAnyTransition::TestAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream)
+ : Transition(Type::TESTANY, issuer, times_considered)
{
int size;
stream >> size;
for (int i = 0; i < size; i++) {
- Transition* t = recv_transition(issuer, 0, stream);
+ Transition* t = deserialize_transition(issuer, 0, stream);
transitions_.push_back(t);
}
}
return true;
}
-Transition* recv_transition(aid_t issuer, int times_considered, std::stringstream& stream)
+Transition* deserialize_transition(aid_t issuer, int times_considered, std::stringstream& stream)
{
short type;
stream >> type;
- Transition::Type simcall = static_cast<Transition::Type>(type);
+ xbt_assert(type >= 0 && type <= static_cast<short>(Transition::Type::UNKNOWN), "Invalid transition type %d received",
+ type);
+
+ auto simcall = static_cast<Transition::Type>(type);
switch (simcall) {
case Transition::Type::COMM_RECV:
case Transition::Type::UNKNOWN:
return new Transition(Transition::Type::UNKNOWN, issuer, times_considered);
- default:
- xbt_die("recv_transition of type %s unimplemented", Transition::to_c_str(simcall));
}
+ THROW_IMPOSSIBLE; // Some compilers don't detect that each branch of the above switch has a return
}
} // namespace mc