Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
the makefile used on bob
[simgrid.git] / src / cxx / Process.hpp
1 /*\r
2  * Process.hpp\r
3  *\r
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier           \r
5  * All right reserved. \r
6  *\r
7  * This program is free software; you can redistribute \r
8  * it and/or modify it under the terms of the license \r
9  *(GNU LGPL) which comes with this package. \r
10  *\r
11  */  \r
12  \r
13 #ifndef MSG_PROCESS_HPP\r
14 #define MSG_PROCESS_HPP\r
15 \r
16 // Compilation C++ recquise\r
17 #ifndef __cplusplus\r
18         #error Process.hpp requires C++ compilation (use a .cxx suffix)\r
19 #endif\r
20 \r
21 \r
22 namespace SimGrid\r
23 {\r
24         namespace Msg\r
25         {\r
26                 // SimGrid::Msg::Process class declaration.\r
27                 class Process\r
28                 {\r
29                         friend ApplicationHandler;\r
30                         \r
31                         private;\r
32                         \r
33                                 // Disable the default constructor.\r
34                                 Process();\r
35                         \r
36                         public:\r
37                         \r
38                                 /*! \brief  Constructs a process from the name of the host and its name.\r
39                                  *\r
40                                  * \param hostName              The host name of the process to create.\r
41                                  * \param name                  The name of the process to create.\r
42                                  *\r
43                                  * \exception                   If the constructor failed, it throws one of the exceptions described\r
44                                  *                                              below:\r
45                                  *                                              \r
46                                  *                                              [NullPointerException]          if the name of the process is NULL or if the\r
47                                  *                                                                                                      name of the host is NULL.\r
48                                  *                                              [HostNotFoundException]         if the host is not found.\r
49                                  */     \r
50                                 Process(const char* hostName, const char* name)\r
51                                 throw(NullPointerException, HostNotFoundException);\r
52                         \r
53                                 /*! \brief Constructs a process from a reference to an host object and its name.\r
54                                  *\r
55                                  * \param rHost                 A reference to the host object representing the native\r
56                                  *                                              MSG host where to create the process.\r
57                                  * \param name                  The name of the process to create.\r
58                                  *\r
59                                  * \exception                   If the constructor failed, it throws the exception described\r
60                                  *                                              below:\r
61                                  *\r
62                                  *                                              [NullPointerException]          if the name of process is NULL.\r
63                                  */ \r
64                                 Process(const Host& rHost, const char* name)\r
65                                 throw(NullPointerException);\r
66                                 \r
67                                 /*! brief Construct a proces from reference to an host object and the name of the process.\r
68                                  * This constuctor takes also the list of the arguments of the process.\r
69                                  *\r
70                                  * \param host                  A reference to the host where to create the process.\r
71                                  * \param name                  The name of the process to create.\r
72                                  * \param argc                  The number of the arguments of the process to create.\r
73                                  * \param argv                  The list of arguments of the process to create.\r
74                                  *\r
75                                  * \exception                   If the constructor failed, it throws one of the exceptions described\r
76                                  *                                              below:\r
77                                  *\r
78                                  *                                              [NullPointerException]          if the name of the host is NULL or\r
79                                  *                                                                                                      if the name of the process is NULL.\r
80                                  *                                              [InvalidArgumentException]  if the value of the parameter argv is\r
81                                  *                                                                                                      negative.\r
82                                  *                                              [LogicException]                        if the parameter argv is NULL and the \r
83                                  *                                                                                                      parameter argc is different than zero\r
84                                  *                                                                                                      if the parameter argv is not NULL and \r
85                                  *                                                                                                      the parameter argc is zero.\r
86                                  */\r
87                                 Process(const Host& rHost, const char* name, int argc, char** argv)\r
88                                 throw(NullPointerException, InvalidArgumentException, LogicException);\r
89                                 \r
90                                 /*! brief Constructs a proces from the name of a host and the name of the process.\r
91                                  * This constuctor takes also the list of the arguments of the process.\r
92                                  *\r
93                                  * \param hostName              The name of the host where to create the process.\r
94                                  * \param name                  The name of the process to create.\r
95                                  * \param argc                  The number of the arguments of the process to create.\r
96                                  * \param argv                  The list of arguments of the process to create.\r
97                                  *\r
98                                  * \exception                   If the constructor failed, it throws one of the exceptions described\r
99                                  *                                              below:\r
100                                  *                                              \r
101                                  *                                              [NullPointerException]          if the name of the process or if the name\r
102                                  *                                                                                                      of the host is NULL.\r
103                                  *                                              [InvalidArgumentException]  if the value of the parameter argv is\r
104                                  *                                                                                                      negative.\r
105                                  *                                              [LogicException]                        if the parameter argv is NULL and the \r
106                                  *                                                                                                      parameter argc is different than zero\r
107                                  *                                                                                                      if the parameter argv is not NULL and \r
108                                  *                                                                                                      the parameter argc is zero.\r
109                                  *                                              [HostNotFoundException]         if the specified host is no found.\r
110                                  */\r
111                                 Process(const char* hostName, const char* name, int argc, char** argv)\r
112                                 throw(NullPointerException, HostNotFoundException);\r
113                         \r
114                                 /*! \brief Process::killAll() - kill all the running processes of the simulation.\r
115                                  *\r
116                                  * \param resetPID              Should we reset the PID numbers. A negative number means no reset\r
117                          *                                              and a positive number will be used to set the PID of the next newly\r
118                          *                                              created process.\r
119                          *\r
120                          * \return                              The static method returns the PID of the next created process.\r
121                          */                     \r
122                                 static int killAll(int resetPID);\r
123                         \r
124                                 /*! \brief Process::suspend() - Suspend an MSG process.\r
125                                  * \r
126                                  * \excetpion                   If this method failed, it throws one the exception described below:\r
127                                  *\r
128                                  *                                              [MsgException]  if an internal exception occurs during the operation.\r
129                                  */\r
130                                 void suspend(void)\r
131                                 throw(MsgException);\r
132                                 \r
133                                 \r
134                         \r
135                                 /*! \brief Process::resume() - Resume the MSG process.\r
136                                  *\r
137                                  * \exception                   If this method failed, it throws the exception described below:\r
138                                  *\r
139                                  *                                              [MsgException] if an internal exception occurs during the operation.\r
140                                  */\r
141                                 void resume(void) \r
142                                 throw(MsgException);\r
143                         \r
144                                 /*! \brief Process::isSuspend() - Tests if a process is suspended.\r
145                                  *\r
146                                  * \return                              This method returns true is the process is suspended.\r
147                                  *                                              Otherwise the method returns false.\r
148                                  */\r
149                                 bool isSuspended(void);\r
150                         \r
151                                 /*! \brief Process::getHost() - Retrieves the host of a process object.\r
152                                  *\r
153                                  * \return                              The method returns a reference to the\r
154                                  *                                              host of the process.\r
155                                  *\r
156                                  */\r
157                                 Host& getHost(void); \r
158                         \r
159                                 /*! \brief Process::fromPID() - Retrieves a process from its PID.\r
160                                  *\r
161                                  * \param PID                   The PID of the process to retrieve.\r
162                                  *\r
163                                  * \return                              If successful the method returns a reference to\r
164                                  *                                              to process. Otherwise, the method throws one of\r
165                                  *                                              the exceptions described below:\r
166                                  *\r
167                                  * \exception                   [ProcessNotFoundException]      if the process is not found (no process with this PID).\r
168                                  *\r
169                                  *                                              [InvalidArgumentException]      if the parameter PID is less than 1.\r
170                                  *\r
171                                  *                                              [MsgException]                          if a native error occurs during the operation.\r
172                                  */\r
173                                 static Process& fromPID(int PID)\r
174                                 throw(ProcessNotFoundException, InvalidArgumentException, MsgException); \r
175                         \r
176                                 /*! \brief Process::getPID() - Gets the PID of a process object.\r
177                                  *\r
178                                  * \return                              This method returns the PID of a process object.\r
179                                  */\r
180                                 int getPID(void);\r
181                                 \r
182                                 /*! \brief Process::getPPID() - Gets the parent PID of a process object.\r
183                                  *\r
184                                  * \return                              This method returns the parent PID of a process object.\r
185                                  */\r
186                                 int getPPID(void);\r
187                                 \r
188                                 /*! \brief Process::getName() - Gets the name of a process object.\r
189                                  *\r
190                                  * \return                              This method returns the name of a process object.\r
191                                  */\r
192                                 const char* getName(void) const;\r
193                         \r
194                                 /*! \brief Process::currentProcess() - Retrieves the current process.\r
195                                  *\r
196                                  * \return                              This method returns a reference to the current process. Otherwise\r
197                                  *                                              the method throws the excepction described below:\r
198                                  *\r
199                                  * \exception                   [MsgException]  if an internal exception occurs.\r
200                                  */\r
201                                 static Process& currentProcess(void)\r
202                                 throw (MsgException);\r
203                         \r
204                                 /*! \brief Process::currentProcessPID() - Retrieves the PID of the current process.\r
205                                  *\r
206                                  * \return                              This method returns the PID of the current process.\r
207                                  */\r
208                                 static int currentProcessPID(void);\r
209                                 \r
210                                 /*! \brief Process::currentProcessPPID() - Retrieves the parent PID of the current process.\r
211                                  *\r
212                                  * \return                              This method returns the parent PID of the current process.\r
213                                  */\r
214                                 static int currentProcessPPID(void);\r
215                         \r
216                                 /*! \brief Process::migrate() - Migrate a process object to an another host.\r
217                                  *\r
218                                  * \param rHost                 A reference to the host to migrate the process to.\r
219                                  *\r
220                                  * \return                              If successful the method migrate the process to the specified\r
221                                  *                                              host. Otherwise the method throws the exception described\r
222                                  *                                              below:\r
223                                  *\r
224                                  * \exception                   [MsgException]  if an internal exception occurs.\r
225                                  */\r
226                                 void migrate(const Host& rHost)\r
227                                 throw(MsgException);\r
228                         \r
229                                 /*! \brief Process::sleep() - Makes the current process sleep until time seconds have elapsed. \r
230                                  *\r
231                                  * \param seconds                       The number of seconds to sleep.\r
232                                  *\r
233                                  * \execption                           If this method failed, it throws one of the exceptions described\r
234                                  *                                                      below: \r
235                                  *\r
236                                  *                                                      [InvalidArgumentException]      if the parameter seconds is\r
237                                  *                                                      less or equals to zero.\r
238                                  *\r
239                                  *                                                      [MsgException] if an internal exception occurs.\r
240                                  */\r
241                                 static void sleep(double seconds)\r
242                                 throw(InvalidArgumentException, MsgException);\r
243                         \r
244                                 /*! \brief Process::putTask() - This method puts a task on a given channel of a given host.\r
245                                  *\r
246                                  * \exception                   If this method failed, it throws one of the exceptions described\r
247                                  *                                              below:\r
248                                  *\r
249                                  *                                              [InvalidArgumentException] if the channel number is negative.\r
250                                  *\r
251                                  *                                              [MsgException]                          if an internal exception occurs.\r
252                                  */\r
253                                 void putTask(const Host& rHost, int channel, const Task& rTask)\r
254                                 throw(InvalidArgumentException, MsgException);\r
255                         \r
256                                 /*! \brief Process::putTask() - This method puts a task on a given channel of a given host (waiting at most given time).\r
257                                  *\r
258                                  * \exception                   If this method failed, it throws one of the exceptions described below:\r
259                                  *\r
260                                  *                                              [MsgException]                          if an internal error occurs.\r
261                                  *\r
262                                  *                                              [InvalidArgumentException]      if the value of the channel specified as\r
263                                  *                                                                                                      parameter is negative or if the timeout value\r
264                                  *                                                                                                      is less than zero and différent of -1.\r
265                                  *\r
266                                  * \remark                              Set the timeout with -1.0 to disable it.\r
267                                  */\r
268                                 void putTask(const Host& rHost, int channel, const Task& rTask, double timeout) \r
269                                 throw(InvalidArgumentException, MsgException);\r
270                         \r
271                                 /*! \brief Process::getTask() - Retrieves a task from a channel number (waiting at most given time).\r
272                                  *\r
273                                  * \param channel               The number of the channel where to get the task.\r
274                                  *\r
275                                  * \return                              If successful the method returns a reference to \r
276                                  *                                              the getted task. Otherwise the method throws one\r
277                                  *                                              of the exceptions described below:\r
278                                  *\r
279                                  * \exception                   [InvalidArgumentException]      if the channel number is negative.\r
280                                  *\r
281                                  *                                              [MsgException]                          if an internal exception occurs.\r
282                                  */\r
283                                 Task& getTask(int channel) \r
284                                 throw(InvalidArgumentException, MsgException);\r
285                         \r
286                                 /*! \brief Process::taskGet() - Retrieves a task from a channel number (waiting at most given time).\r
287                                  *\r
288                                  * \param channel               The number of the channel where to get the task.\r
289                                  * \param timeout               The timeout value.\r
290                                  *\r
291                                  * \return                              If successful the method returns a reference to \r
292                                  *                                              the getted task. Otherwise the method throws one\r
293                                  *                                              of the exceptions described below:\r
294                                  *\r
295                                  * \exception                   [InvalidArgumentException]      if the channel number is negative\r
296                                  *                                                                                                      or if the timeout value is less than\r
297                                  *                                                                                                      zero and different of -1.0.\r
298                                  *                                              [MsgException]                          if an internal exception occurs.\r
299                                  */\r
300                                 Task& getTask(int channel, double timeout) \r
301                                 throw(InvalidArgumentException, MsgException);\r
302                         \r
303                                 /*! \brief Process::taskGet() - Retrieves a task from a channel number and a host.\r
304                                  *\r
305                                  * \param channel               The number of the channel where to get the task.\r
306                                  * \param host                  The host of the channel to get the task.\r
307                                  *\r
308                                  * \return                              If successful the method returns a reference to \r
309                                  *                                              the getted task. Otherwise the method throws one\r
310                                  *                                              of the exceptions described below.\r
311                                  *\r
312                                  * \exception                   [InvalidArgumentException]      if the channel number is negative.\r
313                                  *                                              [MsgException]                          if an internal exception occurs.\r
314                                  */\r
315                                 Task& getTask(int channel, const Host& rHost) \r
316                                 throw(InvalidArgumentException, MsgException);\r
317                         \r
318                                 /*! \brief Process::taskGet() - Retrieves a task from a channel number and a host (waiting at most given time).\r
319                                  *\r
320                                  * \param channel               The number of the channel where to get the task.\r
321                                  * \param timeout               The timeout value.\r
322                                  * \param rHost                 The host owning the channel.\r
323                                  *\r
324                                  * \return                              If successful the method returns a reference to \r
325                                  *                                              the getted task. Otherwise the method throws one\r
326                                  *                                              of the exceptions described below:\r
327                                  *\r
328                                  * \exception                   [InvalidArgumentException]      if the channel number is negative or\r
329                                  *                                                                                                      if the timeout value is negative and different\r
330                                  *                                                                                                      of -1.0.\r
331                                  *                                              [MsgException]                          if an internal exception occurs.\r
332                                  *\r
333                                  * \remark                              Set the timeout with -1.0 to disable it.\r
334                                  */\r
335                                 Task& getTask(int channel, double timeout, const Host& rHost)\r
336                                 throw(InvalidArgumentException MsgException);\r
337                         \r
338                                 /*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the specified alias\r
339                                  * (waiting at most given time).\r
340                                  *\r
341                                  * \param alias                         The alias of the mailbox where to send the task.\r
342                                  * \param rTask                         A reference to the task object to send.\r
343                                  * \param timeout                       The timeout value.\r
344                                  *\r
345                                  * \exception                           If this method failed, it throws one of the exceptions described below:\r
346                                  *\r
347                                  *                                                      [NullPointerException]          if the alias specified as parameter is NULL.\r
348                                  *      \r
349                                  *                                                      [InvalidArgumentException]      if the timeout value is negative and different than\r
350                                  *                                                                                                              -1.0\r
351                                  *                                                      [MsgException]                          if an internal exception occurs.\r
352                                  *\r
353                                  * \remark                                      Set the timeout with -1.0 to disable it.\r
354                                  */\r
355                                 void sendTask(const char* alias, const Task& rTask, double timeout) \r
356                                 throw(NullPointerException, InvalidArgumentException, MsgException);\r
357                         \r
358                                 /*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the specified alias.\r
359                                  *\r
360                                  * \param alias                         The alias of the mailbox where to send the task.\r
361                                  * \param rTask                         A reference to the task object to send.\r
362                                  *\r
363                                  * \exception                           If this method failed, it throws one of the exceptions described below:\r
364                                  *\r
365                                  *                                                      [NullPointerException]          if the alias parameter is NULL.\r
366                                  *\r
367                                  *                                                      [MsgException]                          if an internal exception occurs.\r
368                                  *\r
369                                  */\r
370                                 void sendTask(const char* alias, const Task& rTask) \r
371                                 throw(NullPointerException, MsgException);\r
372                         \r
373                                 /*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the default alias.\r
374                                  *\r
375                                  * \param rTask                         A reference to the task object to send.\r
376                                  *\r
377                                  * \exception                           If this method failed, it throws one of the exceptions described below:\r
378                                  *                                                      \r
379                                  *                                                      [BadAllocException]                     if there is not enough memory to build the default alias.\r
380                                  *\r
381                                  *                                                      [MsgException]                          if an internal exception occurs.\r
382                                  *\r
383                                  */\r
384                                 void sendTask(const Task& rTask) \r
385                                 throw(BadAllocException, MsgException);\r
386                         \r
387                                 /*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the default alias\r
388                                  * (waiting at most given time).\r
389                                  *\r
390                                  * \param rTask                         A reference to the task object to send.\r
391                                  * \param timeout                       The timeout value.\r
392                                  *\r
393                                  * \exception                           If this method failed, it throws one of the exceptions described below:\r
394                                  *\r
395                                  *                                                      [BadAllocException]                     if there is not enough memory to build the default alias.\r
396                                  *\r
397                                  *                                                      [InvalidArgumentException]      if the timeout value is negative and different than -1.0.\r
398                                  *\r
399                                  *                                                      [MsgException]                          if an internal exception occurs.\r
400                                  *\r
401                                  * \remark                                      set the timeout value with -1.0 to disable it.\r
402                                  */\r
403                                 void sendTask(const Task& rTask, double timeout) \r
404                                 throw(BadAllocException, InvalidArgumentException, MsgException);\r
405                         \r
406                                 /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
407                                  * parameter.\r
408                                  *\r
409                                  * \param alias                         The alias of the mailbox where to retrieve the task.\r
410                                  *\r
411                                  * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
412                                  *                                                      throws one of the exceptions described below:\r
413                                  *\r
414                                  * \exception                           [NullPointerException]  if the parameter alias is NULL.\r
415                                  *\r
416                                  *                                                      [MsgException]                  if an internal exception occurs.\r
417                                  */\r
418                                 Task& receiveTask(const char* alias) \r
419                                 throw(NullPointerException, MsgException);\r
420                         \r
421                                 /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the default alias.\r
422                                  *\r
423                                  * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
424                                  *                                                      throws one of the exceptions described below:\r
425                                  *\r
426                                  * \exception                           [BadAllocException]             if there is not enough memory to build the alias.                       \r
427                                  *                                                      [MsgException]                  if an internal exception occurs.\r
428                                  */\r
429                                 Task& receiveTask(void) \r
430                                 throw(BadAllocException, MsgException);\r
431                         \r
432                                 /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
433                                  * parameter(waiting at most given time).\r
434                                  *\r
435                                  * \param alias                         The alias of the mailbox where to retrieve the task.\r
436                                  * \param timeout                       The timeout value.\r
437                                  *\r
438                                  * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
439                                  *                                                      throws one of the exceptions described below.\r
440                                  *\r
441                                  * \exception                           [InvalidArgumentException]      if the timeout value is negative or different of -1.0.\r
442                                  *\r
443                                  *                                                      [NullPointerException]          if the parameter alias is NULL.\r
444                                  *\r
445                                  *                                                      [MsgException]                          if an internal exception occurs.\r
446                                  */\r
447                                 Task& receiveTask(const char* alias, double timeout) \r
448                                 throw(NullPointerException, InvalidArgumentException, MsgException);\r
449                         \r
450                                 /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the default alias\r
451                                  * (waiting at most given time).\r
452                                  *\r
453                                  * \param timeout                       The timeout value.\r
454                                  *\r
455                                  * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
456                                  *                                                      throws one of the exceptions described below:\r
457                                  *\r
458                                  * \exception                           [InvalidArgumentException]      if the timeout value is negative or different than -1.0.\r
459                                  *\r
460                                  *                                                      [BadAllocException]                     if there is not enough memory to build the alias.\r
461                                  *                      \r
462                                  *                                                      [MsgException]                          if an internal exception occurs.\r
463                                  */\r
464                                 Task& receiveTask(double timeout) \r
465                                 throw(InvalidArgumentException, BadAllocException, MsgException);\r
466                         \r
467                                 /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
468                                  * parameter located on a given host (waiting at most given time).\r
469                                  *\r
470                                  * \param alias                         The alias of the mailbox where to retrieve the task.\r
471                                  * \param timeout                       The timeout value.\r
472                                  * \param rHost                         A reference to the host object owning the mailbox.\r
473                                  *\r
474                                  * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
475                                  *                                                      throws one of the exceptions described below:\r
476                                  *\r
477                                  * \exception                           [InvalidArgumentException]      if the timeout value is negative or different of -1.0.\r
478                                  *\r
479                                  *                                                      [NullPointerException]          if the parameter alias is NULL.\r
480                                  *\r
481                                  *                                                      [MsgException]                          if an internal exception occurs.\r
482                                  */\r
483                                 Task& receiveTask(const char* alias, double timeout, const Host& rHost) \r
484                                 throw(NullPointerException, InvalidArgumentException, MsgException);\r
485                         \r
486                                 /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by default alias\r
487                                  *  and located on a given host (waiting at most given time).\r
488                                  *\r
489                                  * \param timeout                       The timeout value.\r
490                                  * \param rHost                         A reference to the host object owning the mailbox.\r
491                                  *\r
492                                  * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
493                                  *                                                      throws one of the exceptions described below:\r
494                                  *\r
495                                  * \exception                           [InvalidArgumentException]      if the timeout value is negative and different than -1.0.\r
496                                  *\r
497                                  *                                                      [BadAllocException]                     if there is not enough memory to build the default alias.\r
498                                  *\r
499                                  *                                                      [MsgException]                          if an internal exception occurs.\r
500                                  */\r
501                                 Task& Process::receiveTask(double timeout, const Host& rHost) \r
502                                 throw(BadAllocException, InvalidArgumentException, MsgException);\r
503                         \r
504                                 /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias\r
505                                  *  specified as parameter and located on a given host.\r
506                                  *\r
507                                  * \param alias                 The alias using to identify the mailbox from which to get the task.\r
508                                  * \param rHost                 A reference to the host object owning the mailbox.\r
509                                  *\r
510                                  * \return                              If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
511                                  *                                              throws one of the exceptions described below:\r
512                                  *\r
513                                  * \exception                   [NullPointerException]                  if the parameter alias is NULL.\r
514                                  *\r
515                                  *                                              [MsgException]                                  if an internal exception occurs.\r
516                                  */\r
517                                 Task& receiveTask(const char* alias, const Host& rHost) \r
518                                 throw(NullPointerException, MsgException);\r
519                         \r
520                                 /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by default alias\r
521                                  *  and located on a given host.\r
522                                  *\r
523                                  * \param rHost                 A reference to the host object owning the mailbox.\r
524                                  *\r
525                                  * \return                              If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
526                                  *                                              throws one of the exceptions described below:\r
527                                  *\r
528                                  * \exception                   [BadAllocException]                             if there is not enough memory to build the alias.\r
529                                  *\r
530                                  *                                              [MsgException]                                  if an internal exception occurs.\r
531                                  */\r
532                                 Task& receiveTask(const Host& rHost) \r
533                                 throw(BadAllocException, MsgException);\r
534                         \r
535                                 \r
536                         private:\r
537                         \r
538                                 /* Process::create() - Creates a process on a given host.\r
539                                  *\r
540                                  * param rHost                  A reference to a host object where to create the process.\r
541                                  * param name                   The name of the process to create.\r
542                                  * param argc                   The number of argument to pass to the main function of the process.\r
543                                  * param argv                   The list of the arguments of the main function of the process.\r
544                                  *\r
545                                  * exception                    If this method failed, it throws one of the exceptions described below:\r
546                                  *\r
547                                  *                                              [HostNotFoundException] if the host specified as parameter doesn't exist.\r
548                                  */\r
549                                 void create(const Host& rHost, const char* name, int argc, char** argv) \r
550                                 throw(HostNotFoundException);\r
551                                 \r
552                                 /* Process::fromNativeProcess() - Retrieves the process wrapper associated with a native process.\r
553                                  *\r
554                                  * \param nativeProcess The native process to get the wrapper.\r
555                                  *\r
556                                  * \return                              The wrapper associated with the native process specified as parameter.\r
557                                  */\r
558                                 static Process& fromNativeProcess(m_process_t nativeProcess);\r
559                         \r
560                         \r
561                         public:\r
562                         \r
563                                 /* Process::run() - used to set the field code of the context of the process.\r
564                                  */ \r
565                                 static int run(int argc, char** argv);\r
566                                 \r
567                                 /*! \brief Process::main() - This virtual pure function is the main function of the process.\r
568                                  * You must override this function for each new class of process that you create.\r
569                                  *\r
570                                  * \param argc                  The number of parameters of the main function.\r
571                                  * \param argv                  The list of the parameter of the main function.\r
572                                  *\r
573                                  * \return                              The exit code of the main function.\r
574                                  */\r
575                                 virtual int main(int argc, char** argv) = 0;\r
576                                 \r
577                         private:\r
578                                 \r
579                                 // Attributes.\r
580                                 \r
581                                 m_process_t nativeProcess;      // pointer to the native msg process.\r
582                         \r
583                 };\r
584         \r
585         } //namepace Msg\r
586 \r
587 } namespace SimGrid