friend State; // FIXME remove this once we have a proper class to handle the statistics
public:
- XBT_DECLARE_ENUM_CLASS(Type, UNKNOWN, RANDOM, COMM_RECV, COMM_SEND, COMM_TEST, COMM_WAIT, TESTANY);
+ XBT_DECLARE_ENUM_CLASS(Type, RANDOM, COMM_RECV, COMM_SEND, COMM_TEST, COMM_WAIT, TESTANY,
+ /* UNKNOWN must be last */ UNKNOWN);
Type type_ = Type::UNKNOWN;
aid_t aid_ = 0;
{
short type;
stream >> type;
+ xbt_assert(type >= 0 && type <= static_cast<short>(Transition::Type::UNKNOWN), "Invalid transition type %d received",
+ type);
+
Transition::Type simcall = static_cast<Transition::Type>(type);
switch (simcall) {
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