-/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2017. 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. */
}
}
-static simgrid::s4u::File* get_file_descriptor(const char* file_name)
+static simgrid::s4u::File* get_file_descriptor(std::string file_name)
{
- std::string full_name = simgrid::s4u::this_actor::name() + ":" + file_name;
+ std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name;
return opened_files.at(full_name);
}
/* My actions */
static void open(const char* const* action)
{
- const char* file_name = action[2];
+ std::string file_name = action[2];
double clock = simgrid::s4u::Engine::getClock();
- std::string full_name = simgrid::s4u::this_actor::name() + ":" + file_name;
+ std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name;
- ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name);
+ ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name.c_str());
simgrid::s4u::File* file = new simgrid::s4u::File(file_name, NULL);
opened_files.insert({full_name, file});
static void read(const char* const* action)
{
- const char* file_name = action[2];
+ std::string file_name = action[2];
sg_size_t size = std::stoul(action[3]);
double clock = simgrid::s4u::Engine::getClock();
static void close(const char* const* action)
{
- const char* file_name = action[2];
+ std::string file_name = action[2];
double clock = simgrid::s4u::Engine::getClock();
simgrid::s4u::File* file = get_file_descriptor(file_name);
- ACT_DEBUG("Entering Close: %s (filename: %s)", NAME, file_name);
+ ACT_DEBUG("Entering Close: %s (filename: %s)", NAME, file_name.c_str());
delete file;
log_action(action, simgrid::s4u::Engine::getClock() - clock);
xbt_replay_action_register("read", Replayer::read);
xbt_replay_action_register("close", Replayer::close);
- /* Actually do the simulation using MSG_action_trace_run */
if (argv[3]) {
simgrid::xbt::action_fs = new std::ifstream(argv[3], std::ifstream::in);
}
XBT_INFO("Simulation time %g", e->getClock());
+ delete e;
return 0;
}