Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make static stuff member of class Replayer.
[simgrid.git] / examples / s4u / replay-io / s4u-replay-io.cpp
index 2e02f08..c5fb26b 100644 (file)
@@ -12,8 +12,6 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(replay_io, "Messages specific for this example");
 
-static std::unordered_map<std::string, simgrid::s4u::File*> opened_files;
-
 #define ACT_DEBUG(...)                                                                                                 \
   if (XBT_LOG_ISENABLED(replay_io, xbt_log_priority_verbose)) {                                                        \
     std::string NAME = boost::algorithm::join(action, " ");                                                            \
@@ -21,22 +19,23 @@ static std::unordered_map<std::string, simgrid::s4u::File*> opened_files;
   } else                                                                                                               \
     ((void)0)
 
-static void log_action(const simgrid::xbt::ReplayAction& action, double date)
-{
-  if (XBT_LOG_ISENABLED(replay_io, xbt_log_priority_verbose)) {
-    std::string s = boost::algorithm::join(action, " ");
-    XBT_VERB("%s %f", s.c_str(), date);
-  }
-}
+class Replayer {
+  static std::unordered_map<std::string, simgrid::s4u::File*> opened_files;
 
-static simgrid::s4u::File* get_file_descriptor(const std::string& file_name)
-{
-  std::string full_name = simgrid::s4u::this_actor::get_name() + ":" + file_name;
+  static void log_action(const simgrid::xbt::ReplayAction& action, double date)
+  {
+    if (XBT_LOG_ISENABLED(replay_io, xbt_log_priority_verbose)) {
+      std::string s = boost::algorithm::join(action, " ");
+      XBT_VERB("%s %f", s.c_str(), date);
+    }
+  }
 
-  return opened_files.at(full_name);
-}
+  static simgrid::s4u::File* get_file_descriptor(const std::string& file_name)
+  {
+    std::string full_name = simgrid::s4u::this_actor::get_name() + ":" + file_name;
+    return opened_files.at(full_name);
+  }
 
-class Replayer {
 public:
   explicit Replayer(std::vector<std::string> args)
   {
@@ -92,6 +91,8 @@ public:
   }
 };
 
+std::unordered_map<std::string, simgrid::s4u::File*> Replayer::opened_files;
+
 int main(int argc, char* argv[])
 {
   simgrid::s4u::Engine e(&argc, argv);