Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
comment++
[simgrid.git] / examples / s4u / energy-link / s4u-energy-link.cpp
index be53d6c..e64eccf 100644 (file)
@@ -24,6 +24,7 @@ static void sender(std::vector<std::string> args)
 
   simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::string("message"));
 
+  /* Sleep a while before starting the example */
   simgrid::s4u::this_actor::sleep_for(10);
 
   /* - Send the task to the @ref worker */
@@ -77,7 +78,7 @@ static void receiver(std::vector<std::string> args)
 int main(int argc, char* argv[])
 {
 
-  simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv);
+  simgrid::s4u::Engine e(&argc, argv);
 
   /* Check if we got --NS3 on the command line, and activate ecofen if so */
   bool NS3 = false;
@@ -103,7 +104,7 @@ int main(int argc, char* argv[])
                        "\tIf you add NS3 as last parameter, this will try to activate the ecofen plugin.\n"
                        "\tWithout it, it will use the SimGrid link energy plugin.\n",
              argv[0], argv[0]);
-  e->loadPlatform(argv[1]);
+  e.loadPlatform(argv[1]);
 
   /* prepare to launch the actors */
   std::vector<std::string> argSender;
@@ -137,7 +138,7 @@ int main(int argc, char* argv[])
   simgrid::s4u::Actor::createActor("receiver", simgrid::s4u::Host::by_name("MyHost2"), receiver, argReceiver);
 
   /* And now, launch the simulation */
-  e->run();
+  e.run();
 
   return 0;
 }