Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Flush output of energy tests.
[simgrid.git] / src / xbt / xbt_replay.cpp
index 4e9f9fc..c05deb6 100644 (file)
@@ -34,7 +34,9 @@ class ReplayReader {
 public:
   explicit ReplayReader(const char* filename)
   {
-    fs = new std::ifstream(filename, std::ifstream::in);
+         XBT_VERB("Prepare to replay file '%s'", filename);
+         fs = new std::ifstream(filename, std::ifstream::in);
+          xbt_assert(fs->is_open(), "Cannot read replay file '%s'", filename);
   }
   ~ReplayReader()
   {
@@ -123,9 +125,6 @@ static void handle_action(ReplayAction* action)
 /**
  * \ingroup XBT_replay
  * \brief function used internally to actually run the replay
-
- * \param argc argc .
- * \param argv argv
  */
 int replay_runner(int argc, char* argv[])
 {
@@ -180,3 +179,14 @@ void xbt_replay_action_register(const char* action_name, action_fun function)
 {
   simgrid::xbt::action_funs.insert({std::string(action_name), function});
 }
+
+/**
+ * \ingroup XBT_replay
+ * \brief Get the function that was previously registered to handle a kind of action
+ *
+ * This can be useful if you want to override and extend an existing action.
+ */
+action_fun xbt_replay_action_get(const char* action_name)
+{
+  return simgrid::xbt::action_funs.at(std::string(action_name));
+}