X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e9a351f4dbb9fdf5c9eb9eaaddb47dd357b9ea0d..863aeead864a309c494893a1b06ec33ed2b7daf1:/src/xbt/xbt_replay.cpp diff --git a/src/xbt/xbt_replay.cpp b/src/xbt/xbt_replay.cpp index 4e9f9fca24..b9b6612af1 100644 --- a/src/xbt/xbt_replay.cpp +++ b/src/xbt/xbt_replay.cpp @@ -23,7 +23,7 @@ static void read_and_trim_line(std::ifstream* fs, std::string* line) do { std::getline(*fs, *line); boost::trim(*line); - } while (!fs->eof() && (line->length() == 0 || line->front() == '#')); + } while (not fs->eof() && (line->length() == 0 || line->front() == '#')); XBT_DEBUG("got from trace: %s", line->c_str()); } @@ -34,7 +34,9 @@ class ReplayReader { public: explicit ReplayReader(const char* filename) { + 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() { @@ -48,7 +50,7 @@ bool ReplayReader::get(ReplayAction* action) read_and_trim_line(fs, &line); boost::split(*action, line, boost::is_any_of(" \t"), boost::token_compress_on); - return !fs->eof(); + return not fs->eof(); } static ReplayAction* get_action(char* name) @@ -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)); +}