Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into 'master'
[simgrid.git] / src / mc / mc_request.cpp
index 565aeec692f16cbcc7c33cbc6441a7359b360b94..94d0d91950797dc637e8e40f20755b2fc9e8efd9 100644 (file)
@@ -10,6 +10,7 @@
 #include "src/mc/ModelChecker.hpp"
 #include "src/mc/checker/SimcallInspector.hpp"
 #include "src/mc/mc_smx.hpp"
+#include <array>
 
 using simgrid::mc::remote;
 
@@ -22,9 +23,9 @@ static inline simgrid::kernel::activity::CommImpl* MC_get_comm(smx_simcall_t r)
 {
   switch (r->call_) {
     case SIMCALL_COMM_WAIT:
-      return static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(r));
+      return simcall_comm_wait__getraw__comm(r);
     case SIMCALL_COMM_TEST:
-      return static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__getraw__comm(r));
+      return simcall_comm_test__getraw__comm(r);
     default:
       return nullptr;
   }
@@ -225,8 +226,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     }
 
     case SIMCALL_COMM_WAIT: {
-      simgrid::kernel::activity::CommImpl* remote_act =
-          static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
+      simgrid::kernel::activity::CommImpl* remote_act = simcall_comm_wait__getraw__comm(req);
       char* p;
       if (value == -1) {
         type = "WaitTimeout";
@@ -239,8 +239,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
         simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
         const simgrid::kernel::activity::CommImpl* act;
         if (use_remote_comm) {
-          mc_model_checker->get_remote_simulation().read(
-              temp_synchro, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+          mc_model_checker->get_remote_simulation().read(temp_synchro, remote(remote_act));
           act = temp_synchro.get_buffer();
         } else
           act = remote_act;
@@ -260,13 +259,11 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     }
 
     case SIMCALL_COMM_TEST: {
-      simgrid::kernel::activity::CommImpl* remote_act =
-          static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__getraw__comm(req));
+      simgrid::kernel::activity::CommImpl* remote_act = simcall_comm_test__getraw__comm(req);
       simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
       const simgrid::kernel::activity::CommImpl* act;
       if (use_remote_comm) {
-        mc_model_checker->get_remote_simulation().read(
-            temp_synchro, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+        mc_model_checker->get_remote_simulation().read(temp_synchro, remote(remote_act));
         act = temp_synchro.get_buffer();
       } else
         act = remote_act;
@@ -390,14 +387,12 @@ bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
   return comm->src_actor_.get() && comm->dst_actor_.get();
 }
 
-static const char* colors[] = {
-    "blue",       "red",    "green3",      "goldenrod", "brown",     "purple", "magenta",
-    "turquoise4", "gray25", "forestgreen", "hotpink",   "lightblue", "tan",
-};
-
 static inline const char* get_color(int id)
 {
-  return colors[id % (sizeof(colors) / sizeof(colors[0])) ];
+  static constexpr std::array<const char*, 13> colors{{"blue", "red", "green3", "goldenrod", "brown", "purple",
+                                                       "magenta", "turquoise4", "gray25", "forestgreen", "hotpink",
+                                                       "lightblue", "tan"}};
+  return colors[id % colors.size()];
 }
 
 std::string request_get_dot_output(smx_simcall_t req, int value)