Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
last changes of cpp wrappers examples
[simgrid.git] / examples / cxx / basic / Slave.cxx
1 #include "Slave.hpp"
2 #include "FinalizeTask.hpp"
3 #include <Host.hpp>
4 #include <HostNotFoundException.hpp>
5
6 #include <iostream>
7 using namespace std;
8
9 #include <Msg.hpp>
10
11 MSG_IMPLEMENT_DYNAMIC(Slave, Process)
12
13 int Slave::main(int argc, char** argv)
14 {
15         info("Hello");;
16         
17         while(true) 
18         { 
19                 Task* t = Task::get(0); 
20         
21                 if(t->isInstanceOf("FinalizeTask")) 
22                 {
23                         delete t;
24                         break;
25                 }
26                 
27                 info(TEXT_("Received \"") + TEXT_(t->getName()) + TEXT_("\" "));
28         
29                 info(TEXT_("Processing \"") + TEXT_(t->getName()));
30
31                 t->execute();
32                 
33                 info(TEXT_("\"") + TEXT_(t->getName()) + TEXT_("\" done "));
34
35                 delete t;
36         }
37         
38         info("Received Finalize. I'm done. See you!");
39         
40         delete this;
41
42         return 0;
43 }