Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fewer explicit news are fewer possible leaks
[simgrid.git] / examples / s4u / actions-comm / s4u-actions-comm.cpp
index 2779185..f620071 100644 (file)
@@ -85,7 +85,7 @@ public:
 
 int main(int argc, char *argv[])
 {
-  simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv);
+  simgrid::s4u::Engine e(&argc, argv);
 
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file [action_files]\n"
                        "\t# if all actions are in the same file\n"
@@ -94,11 +94,11 @@ int main(int argc, char *argv[])
                        "\tExample: %s msg_platform.xml msg_deployment.xml ",
              argv[0], argv[0], argv[0]);
 
-  e->loadPlatform(argv[1]);
-  e->registerDefault(&simgrid::xbt::replay_runner);
-  e->registerFunction<Replayer>("p0");
-  e->registerFunction<Replayer>("p1");
-  e->loadDeployment(argv[2]);
+  e.loadPlatform(argv[1]);
+  e.registerDefault(&simgrid::xbt::replay_runner);
+  e.registerFunction<Replayer>("p0");
+  e.registerFunction<Replayer>("p1");
+  e.loadDeployment(argv[2]);
 
   /*   Action registration */
   xbt_replay_action_register("compute", Replayer::compute);
@@ -109,15 +109,14 @@ int main(int argc, char *argv[])
     simgrid::xbt::action_fs = new std::ifstream(argv[3], std::ifstream::in);
   }
 
-  e->run();
+  e.run();
 
   if (argv[3]) {
     delete simgrid::xbt::action_fs;
     simgrid::xbt::action_fs = nullptr;
   }
 
-  XBT_INFO("Simulation time %g", e->getClock());
+  XBT_INFO("Simulation time %g", e.getClock());
 
-  delete e;
   return 0;
 }