#include "src/mc/api/Transition.hpp"
#include "xbt/asserts.h"
+#include "xbt/string.hpp"
#include <simgrid/config.h>
+
#if SIMGRID_HAVE_MC
#include "src/mc/ModelChecker.hpp"
#endif
unsigned long Transition::executed_transitions_ = 0;
unsigned long Transition::replayed_transitions_ = 0;
-Transition::~Transition() {
-} // Make sure that we have a vtable for Transition by putting this virtual function out of the header
+// Do not move this to the header, to ensure that we have a vtable for Transition
+Transition::~Transition() = default;
-std::string Transition::to_string(bool verbose)
+std::string Transition::to_string(bool) const
{
- return textual_;
+ return "";
}
-const char* Transition::to_cstring(bool verbose)
+std::string Transition::dot_label() const
{
- to_string();
- return textual_.c_str();
+ return xbt::string_printf("[(%ld)] %s", aid_, Transition::to_c_str(type_));
}
void Transition::replay() const
{
mc_model_checker->wait_for_requests();
#endif
}
+std::string RandomTransition::to_string(bool verbose) const
+{
+ return xbt::string_printf("Random([%d;%d] ~> %d)", min_, max_, times_considered_);
+}
+
+RandomTransition::RandomTransition(aid_t issuer, int times_considered, std::stringstream& stream)
+ : Transition(Type::RANDOM, issuer, times_considered)
+{
+ stream >> min_ >> max_;
+}
+std::string RandomTransition::dot_label() const
+{
+ return Transition::dot_label() + to_c_str(type_);
+}
} // namespace mc
} // namespace simgrid