X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/45fc9b393d412fb043fadf8e660fa6a137125f45..84b6ab29e2861d096c8d500c6bd56289bfe90664:/examples/cxx/explicitDestination/Slave.cxx diff --git a/examples/cxx/explicitDestination/Slave.cxx b/examples/cxx/explicitDestination/Slave.cxx index 6b4de500f8..03c14c6bae 100644 --- a/examples/cxx/explicitDestination/Slave.cxx +++ b/examples/cxx/explicitDestination/Slave.cxx @@ -1,45 +1,45 @@ -#include "Slave.hpp" -#include "FinalizeTask.hpp" -#include "BasicTask.hpp" - -#include -#include - -#include -using namespace std; - -MSG_IMPLEMENT_DYNAMIC(Slave, Process); - -int Slave::main(int argc, char** argv) -{ - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hello I'm " << getName() << " on " << getHost().getName() << "!" << endl; - - Task* receivedTask; - BasicTask* basicTask; - - while(true) - { - receivedTask = Task::receive(Host::currentHost().getName()); - - if(receivedTask->isInstanceOf("FinalizeTask")) - { - delete receivedTask; - break; - } - - basicTask = reinterpret_cast(receivedTask); - - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Received \"" << basicTask->getName() << "\" " << endl; - - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Processing \"" << basicTask->getName() << "\" " << endl; - basicTask->execute(); - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "\"" << basicTask->getName() << "\" done " << endl; - - delete basicTask; - } - - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Received Finalize. I'm done. See you!" << endl; - - delete this; - return 0; -} \ No newline at end of file +#include "Slave.hpp" +#include "FinalizeTask.hpp" +#include "BasicTask.hpp" + +#include +#include + +#include +using namespace std; + +MSG_IMPLEMENT_DYNAMIC(Slave, Process) + +int Slave::main(int argc, char** argv) +{ + info("Hello"); + + Task* receivedTask; + BasicTask* basicTask; + + while(true) + { + receivedTask = Task::receive(Host::currentHost().getName()); + + if(receivedTask->isInstanceOf("FinalizeTask")) + { + delete receivedTask; + break; + } + + basicTask = reinterpret_cast(receivedTask); + + info(TEXT_("Received \"") + TEXT_(basicTask->getName()) + TEXT_("\" ")); + + info(TEXT_("Processing \"") + TEXT_(basicTask->getName()) + TEXT_("\" ")); + basicTask->execute(); + info(TEXT_("\"") + TEXT_(basicTask->getName()) + TEXT_("\" done ")); + + delete basicTask; + } + + info("Received Finalize. I'm done. See you!"); + + delete this; + return 0; +}