Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Split TransitionAny and TransitionRandom to their own files
[simgrid.git] / src / mc / transition / TransitionRandom.cpp
1 /* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "src/mc/transition/TransitionRandom.hpp"
7 #include "xbt/asserts.h"
8 #include "xbt/string.hpp"
9
10 #include <sstream>
11
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_trans_rand, mc_transition, "Logging specific to MC Random transitions");
13
14 namespace simgrid {
15 namespace mc {
16 std::string RandomTransition::to_string(bool verbose) const
17 {
18   return xbt::string_printf("Random([%d;%d] ~> %d)", min_, max_, times_considered_);
19 }
20
21 RandomTransition::RandomTransition(aid_t issuer, int times_considered, std::stringstream& stream)
22     : Transition(Type::RANDOM, issuer, times_considered)
23 {
24   xbt_assert(stream >> min_ >> max_);
25 }
26
27 std::string RandomTransition::dot_label() const
28 {
29   return Transition::dot_label() + to_c_str(type_);
30 }
31
32 } // namespace mc
33 } // namespace simgrid