Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add s_type_get_or_null to s_type class as a method
[simgrid.git] / src / xbt / xbt_replay.cpp
index 74bc5a3..4c2fec8 100644 (file)
@@ -38,6 +38,7 @@ public:
     fs = new std::ifstream(filename, std::ifstream::in);
     xbt_assert(fs->is_open(), "Cannot read replay file '%s'", filename);
   }
+  ReplayReader(const ReplayReader&) = delete;
   ~ReplayReader()
   {
     delete fs;
@@ -78,9 +79,10 @@ static ReplayAction* get_action(char* name)
       } else {
         // Else, I have to store it for the relevant colleague
         std::queue<ReplayAction*>* otherqueue = nullptr;
-        try {
-          otherqueue = action_queues.at(evtname);
-        } catch (std::out_of_range& unfound) { // Damn. Create the queue of that guy
+        auto act                              = action_queues.find(evtname);
+        if (act != action_queues.end()) {
+          otherqueue = act->second;
+        } else { // Damn. Create the queue of that guy
           otherqueue = new std::queue<ReplayAction*>();
           action_queues.insert({evtname, otherqueue});
         }
@@ -177,7 +179,7 @@ int replay_runner(int argc, char* argv[])
  */
 void xbt_replay_action_register(const char* action_name, action_fun function)
 {
-  simgrid::xbt::action_funs.insert({std::string(action_name), function});
+  simgrid::xbt::action_funs[std::string(action_name)] = function;
 }
 
 /**