Logo AND Algorithmique Numérique Distribuée

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