Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
All of the examples use now the StringHelp class to simplify the string manipulation.
[simgrid.git] / examples / cxx / ping_pong / Sender.cxx
index d0518ba..8c3f364 100644 (file)
@@ -4,7 +4,7 @@
 #include <HostNotFoundException.hpp>\r
 #include <Msg.hpp>\r
 \r
-#include <iostream>\r
+#include <Msg.hpp>\r
 using namespace std;\r
 \r
 const double commSizeLat = 1;\r
@@ -14,11 +14,11 @@ MSG_IMPLEMENT_DYNAMIC(Sender, Process);
 \r
 int Sender::main(int argc, char** argv)\r
 {\r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hello I'm " << getName() << " on " << getHost().getName() << "!" << endl;\r
+       info("Hello");\r
        \r
        int hostCount = argc;\r
        \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " <<  "host count : " << hostCount << endl;\r
+       info(TEXT_("Host count : ") + TEXT_(hostCount));\r
        \r
        Host* hostTable = new Host[hostCount]; \r
        double time;\r
@@ -33,7 +33,7 @@ int Sender::main(int argc, char** argv)
                } \r
                catch(HostNotFoundException e) \r
                {\r
-                       cerr << e.toString() <<". Stopping Now!" << endl;\r
+                       error(TEXT_(e.toString()) + TEXT_(". Stopping Now!"));\r
                        exit(1);\r
                }\r
        }\r
@@ -42,7 +42,7 @@ int Sender::main(int argc, char** argv)
        { \r
                time = getClock(); \r
        \r
-               cout <<"[" << getName() << ":" << getHost().getName() << "] " <<  "sender time : " << time << endl;\r
+               info(TEXT_("Sender time : ") + TEXT_(time));\r
        \r
                task = new PingPongTask("no name",computeDuration,commSizeLat);\r
                task->setTime(time);\r
@@ -50,7 +50,8 @@ int Sender::main(int argc, char** argv)
                hostTable[pos].put(0,task);\r
        } \r
        \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " <<  "goodbye!" << endl;\r
+       info("Goodbye!");\r
+\r
        \r
        delete[] hostTable;\r
 \r