12 Task::Task(const Task& rTask)
\r
18 throw(NativeException)
\r
20 if(NULL != nativeTask)
\r
22 if(MSG_OK != MSG_task_destroy(nativeTask))
\r
24 // TODO throw NativeException
\r
30 Task::Task(const char* name, double computeDuration, double messageSize)
\r
33 if(computeDuration < 0)
\r
35 // TODO throw exception
\r
39 if(messageSize < 0)
\r
41 // TODO throw exception
\r
47 // TODO throw exception
\r
52 nativeTask = MSG_task_create(name, computeDuration, messageSize, NULL);
\r
54 nativeTask->data = (void*)this;
\r
57 Task::Task(const char* name, Host* hosts, double* computeDurations, double* messageSizes)
\r
59 // TODO parallel task create
\r
63 const char* Task::getName(void) const
\r
65 return nativeTask->name;
\r
68 Process& Task::getSender(void) const
\r
70 m_proccess_t nativeProcess = MSG_task_get_sender(nativeTask);
\r
72 return (*((Process*)(nativeProcess->data)));
\r
75 Host& Task::getSource(void) const
\r
76 throw(NativeException)
\r
78 m_host_t nativeHost = MSG_task_get_source(nativeTask);
\r
80 if(!nativeHost->data)
\r
82 // TODO throw the exception
\r
86 return (*((Host*)(nativeHost->data)));
\r
89 double Task::getComputeDuration(void) const
\r
91 return MSG_task_get_compute_duration(nativeTask);
\r
94 double Task::getRemainingDuration(void) const
\r
96 return MSG_task_get_remaining_computation(nativeTask);
\r
99 void Task::setPriority(double priority)
\r
101 MSG_task_set_priority(nativeTask, priority);
\r
104 Task& Task::get(int channel)
\r
105 throw(NativeException)
\r
107 m_task_t nativeTask = NULL;
\r
110 if(MSG_OK != MSG_task_get_ext(&nativeTask, channel , -1.0, NULL))
\r
112 // TODO throw the NativeException
\r
116 return (*((Task*)(nativeTask->data)));
\r
119 Task& Task::get(int channel, const Host& rHost)
\r
120 throw(NativeException)
\r
122 m_task_t nativeTask = NULL;
\r
125 if(MSG_OK != MSG_task_get_ext(&nativeTask, channel , -1.0, rHost.nativeHost))
\r
127 // TODO throw the NativeException
\r
131 return (*((Task*)(nativeTask->data)));
\r
134 Task& Task::get(int channel, double timeout, const Host& rHost)
\r
135 throw(NativeException)
\r
137 m_task_t nativeTask = NULL;
\r
140 if(MSG_OK != MSG_task_get_ext(&nativeTask, channel , timeout, rHost.nativeHost))
\r
142 // TODO throw the NativeException
\r
146 return (*((Task*)(nativeTask->data)));
\r
149 bool static Task::probe(int channel)
\r
151 return (bool)MSG_task_Iprobe(channel);
\r
154 int Task::probe(int channel, const Host& rHost)
\r
156 return MSG_task_probe_from_host(chan_id,rHost.nativeHost);
\r
159 void Task::execute(void)
\r
160 throw(NativeException)
\r
162 if(MSG_OK != MSG_task_execute(nativeTask))
\r
164 // TODO throw NativeException
\r
168 void Task::cancel(void)
\r
169 throw(NativeException)
\r
171 if(MSG_OK != MSG_task_cancel(nativeTask))
\r
173 // TODO throw NativeException
\r
178 throw(NativeException)
\r