Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
moved a line for comprehension
[simgrid.git] / include / simgrid / smpi / replay.hpp
index 715f52ee93bfb2fad63a61233f2a96aa1b0ed8d8..4da7a7ee7adbf8d2ba66bfb3a79a62780cdad937 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2020. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -34,7 +34,7 @@
 XBT_PRIVATE unsigned char* smpi_get_tmp_sendbuffer(size_t size);
 XBT_PRIVATE unsigned char* smpi_get_tmp_recvbuffer(size_t size);
 
-XBT_PRIVATE void log_timed_action(simgrid::xbt::ReplayAction& action, double clock);
+XBT_PRIVATE void log_timed_action(const simgrid::xbt::ReplayAction& action, double clock);
 
 namespace simgrid {
 namespace smpi {
@@ -181,22 +181,26 @@ public:
  * In other words: The logic goes here, the setup is done by the ActionArgParser.
  */
 template <class T> class ReplayAction {
+  const std::string name_;
+  const aid_t my_proc_id_ = s4u::this_actor::get_pid();
+  T args_;
+
 protected:
-  const std::string name;
-  const aid_t my_proc_id = s4u::this_actor::get_pid();
-  T args;
+  const std::string& get_name() const { return name_; }
+  aid_t get_pid() const { return my_proc_id_; }
+  const T& get_args() const { return args_; }
 
 public:
-  explicit ReplayAction(const std::string& name) : name(name) {}
+  explicit ReplayAction(const std::string& name) : name_(name) {}
   virtual ~ReplayAction() = default;
 
   void execute(xbt::ReplayAction& action)
   {
     // Needs to be re-initialized for every action, hence here
     double start_time = smpi_process()->simulated_elapsed();
-    args.parse(action, name);
+    args_.parse(action, name_);
     kernel(action);
-    if (name != "Init")
+    if (name_ != "Init")
       log_timed_action(action, start_time);
   }