Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
The default alias name is now build from the name of the host of the process and...
[simgrid.git] / src / cxx / Process.hpp
index 1ee45b3..5bc46e5 100644 (file)
@@ -1,3 +1,15 @@
+/*\r
+ * Process.hpp\r
+ *\r
+ * Copyright 2006,2007 Martin Quinson, Malek Cherier           \r
+ * All right reserved. \r
+ *\r
+ * This program is free software; you can redistribute \r
+ * it and/or modify it under the terms of the license \r
+ *(GNU LGPL) which comes with this package. \r
+ *\r
+ */  \r
\r
 #ifndef MSG_PROCESS_HPP\r
 #define MSG_PROCESS_HPP\r
 \r
        #error Process.hpp requires C++ compilation (use a .cxx suffix)\r
 #endif\r
 \r
-namespace msg\r
-{\r
-       \r
-class Process\r
+#include <msg/datatypes.h>\r
+\r
+#include <ApplicationHandler.hpp>\r
+#include <Object.hpp>\r
+\r
+#include <MsgException.hpp>\r
+#include <NullPointerException.hpp>\r
+#include <HostNotFoundException.hpp>\r
+#include <ProcessNotFoundException.hpp>\r
+#include <InvalidArgumentException.hpp>\r
+#include <BadAllocException.hpp>\r
+#include <LogicException.hpp>\r
+\r
+namespace SimGrid\r
 {\r
-       \r
-       friend ApplicationHandler;\r
-       \r
-       private;\r
-       \r
-       // Default constructor.\r
-       Process();\r
-       \r
-       public:\r
-       \r
-       // Construct a process from the name of the host and its name.  \r
-       Process(const char* hostName, const char* name)\r
-       throw(HostNotFoundException);\r
-       \r
-       Process(const Host& rHost, const char* name)\r
-       throw(HostNotFoundException);\r
-       \r
-       Process(const char* hostName, const char* name, int argc, char** argv)\r
-       throw(HostNotFoundException);\r
-       \r
-       Process(const Host& rHost, const char* name, int argc, char** argv)\r
-       throw(HostNotFoundException);\r
-       \r
-       static int killAll(int resetPID);\r
-       \r
-       void Process::suspend(void)\r
-       throw(NativeException);\r
-       \r
-       void Process::resume(void) \r
-       throw(NativeException);\r
-       \r
-       bool isSuspended(void);\r
-       \r
-       Host& getHost(void) \r
-       throw(NativeException);\r
-       \r
-       static Process& fromPID(int PID); \r
-       \r
-       \r
-       int getPID(void);\r
-               \r
-       int getPPID(void);\r
-       \r
-       const char* getName(void) const;\r
-       \r
-       static Process& currentProcess(void);\r
-       \r
-       static int currentProcessPID(void);\r
-       \r
-       static int currentProcessPPID(void);\r
-       \r
-       void migrate(const Host& rHost)\r
-       throw(NativeException);\r
-       \r
-       static void sleep(double seconds)\r
-       throw(NativeException);\r
-       \r
-       void putTask(const Host& rHost, int channel, const Task& rTask)\r
-       throw( NativeException);\r
-       \r
-       void putTask(const Host& rHost, int channel, const Task& rTask, double timeout) \r
-       throw(NativeException);\r
-       \r
-       Task& getTask(int channel) \r
-       throw(NativeException);\r
-       \r
-       Task& getTask(int channel, double timeout) \r
-       throw(NativeException);\r
-       \r
-       Task& getTask(int channel, const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       Task& getTask(int channel, double timeout, const Host& rHost)\r
-       throw(NativeException);\r
-       \r
-       void sendTask(const char* alias, const Task& rTask, double timeout) \r
-       throw(NativeException);\r
-       \r
-       void sendTask(const char* alias, const Task& rTask) \r
-       throw(NativeException);\r
-       \r
-       void sendTask(const Task& rTask) \r
-       throw(NativeException);\r
-       \r
-       void sendTask(const Task& rTask, double timeout) \r
-       throw(NativeException);\r
-       \r
-       Task& receiveTask(const char* alias) \r
-       throw(NativeException);\r
-       \r
-       Task& receiveTask(void) \r
-       throw(NativeException);\r
-       \r
-       Task& receiveTask(const char* alias, double timeout) \r
-       throw(NativeException);\r
-       \r
-       Task& receiveTask(double timeout) \r
-       throw(NativeException);\r
-       \r
-       Task& receiveTask(const char* alias, double timeout, const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       Task& Process::receiveTask(double timeout, const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       Task& receiveTask(const char* alias, const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       Task& receiveTask(const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-               \r
-       private:\r
-       void create(const Host& rHost, const char* name, int argc, char** argv) \r
-       throw(HostNotFoundException);\r
-       \r
-       \r
-       static Process& fromNativeProcess(m_process_t nativeProcess);\r
-       \r
-       \r
-       public:\r
-               \r
-       static int run(int argc, char** argv);\r
-       \r
-       virtual int main(int argc, char** argv) = 0;\r
-               \r
-       private:\r
-               \r
-       // Attributes.\r
-       \r
-       m_process_t nativeProcess;      // pointer to the native msg process.\r
-       \r
-};\r
+       namespace Msg\r
+       {\r
+               class ApplicationHandler;\r
+               class Host;\r
+               class Task;\r
+\r
+               // SimGrid::Msg::Process class declaration.\r
+               class SIMGRIDX_EXPORT Process : public Object\r
+               {\r
+                       friend class ApplicationHandler::ProcessFactory;\r
+                       \r
+                       MSG_DECLARE_DYNAMIC(Process);\r
+\r
+                       public:\r
+\r
+                               // Disable the default constructor.\r
+                               Process();\r
+                       \r
+                       \r
+                               /*! \brief  Constructs a process from the name of the host and its name.\r
+                                *\r
+                                * \param hostName              The host name of the process to create.\r
+                                * \param name                  The name of the process to create.\r
+                                *\r
+                                * \exception                   If the constructor failed, it throws one of the exceptions described\r
+                                *                                              below:\r
+                                *                                              \r
+                                *                                              [NullPointerException]          if the name of the process is NULL or if the\r
+                                *                                                                                                      name of the host is NULL.\r
+                                *                                              [HostNotFoundException]         if the host is not found.\r
+                                */     \r
+                               Process(const char* hostName, const char* name)\r
+                               throw(NullPointerException, HostNotFoundException, BadAllocException);\r
+                       \r
+                               /*! \brief Constructs a process from a reference to an host object and its name.\r
+                                *\r
+                                * \param rHost                 A reference to the host object representing the native\r
+                                *                                              MSG host where to create the process.\r
+                                * \param name                  The name of the process to create.\r
+                                *\r
+                                * \exception                   If the constructor failed, it throws the exception described\r
+                                *                                              below:\r
+                                *\r
+                                *                                              [NullPointerException]          if the name of process is NULL.\r
+                                */ \r
+                               Process(const Host& rHost, const char* name)\r
+                               throw(NullPointerException);\r
+                               \r
+                               /*! brief Construct a proces from reference to an host object and the name of the process.\r
+                                * This constuctor takes also the list of the arguments of the process.\r
+                                *\r
+                                * \param host                  A reference to the host where to create the process.\r
+                                * \param name                  The name of the process to create.\r
+                                * \param argc                  The number of the arguments of the process to create.\r
+                                * \param argv                  The list of arguments of the process to create.\r
+                                *\r
+                                * \exception                   If the constructor failed, it throws one of the exceptions described\r
+                                *                                              below:\r
+                                *\r
+                                *                                              [NullPointerException]          if the name of the host is NULL or\r
+                                *                                                                                                      if the name of the process is NULL.\r
+                                *                                              [InvalidArgumentException]  if the value of the parameter argv is\r
+                                *                                                                                                      negative.\r
+                                *                                              [LogicException]                        if the parameter argv is NULL and the \r
+                                *                                                                                                      parameter argc is different than zero\r
+                                *                                                                                                      if the parameter argv is not NULL and \r
+                                *                                                                                                      the parameter argc is zero.\r
+                                */\r
+                               Process(const Host& rHost, const char* name, int argc, char** argv)\r
+                               throw(NullPointerException, InvalidArgumentException, LogicException);\r
+                               \r
+                               /*! brief Constructs a proces from the name of a host and the name of the process.\r
+                                * This constuctor takes also the list of the arguments of the process.\r
+                                *\r
+                                * \param hostName              The name of the host where to create the process.\r
+                                * \param name                  The name of the process to create.\r
+                                * \param argc                  The number of the arguments of the process to create.\r
+                                * \param argv                  The list of arguments of the process to create.\r
+                                *\r
+                                * \exception                   If the constructor failed, it throws one of the exceptions described\r
+                                *                                              below:\r
+                                *                                              \r
+                                *                                              [NullPointerException]          if the name of the process or if the name\r
+                                *                                                                                                      of the host is NULL.\r
+                                *                                              [InvalidArgumentException]  if the value of the parameter argv is\r
+                                *                                                                                                      negative.\r
+                                *                                              [LogicException]                        if the parameter argv is NULL and the \r
+                                *                                                                                                      parameter argc is different than zero\r
+                                *                                                                                                      if the parameter argv is not NULL and \r
+                                *                                                                                                      the parameter argc is zero.\r
+                                *                                              [HostNotFoundException]         if the specified host is no found.\r
+                                */\r
+                               Process(const char* hostName, const char* name, int argc, char** argv)\r
+                               throw(NullPointerException, InvalidArgumentException, LogicException, HostNotFoundException, BadAllocException);\r
+                       \r
+                               /*! \brief Process::killAll() - kill all the running processes of the simulation.\r
+                                *\r
+                                * \param resetPID              Should we reset the PID numbers. A negative number means no reset\r
+                        *                                              and a positive number will be used to set the PID of the next newly\r
+                        *                                              created process.\r
+                        *\r
+                        * \return                              The static method returns the PID of the next created process.\r
+                        */                     \r
+                               static int killAll(int resetPID);\r
+                       \r
+                               /*! \brief Process::suspend() - Suspend an MSG process.\r
+                                * \r
+                                * \excetpion                   If this method failed, it throws one the exception described below:\r
+                                *\r
+                                *                                              [MsgException]  if an internal exception occurs during the operation.\r
+                                */\r
+                               void suspend(void)\r
+                               throw(MsgException);\r
+                               \r
+                               \r
+                       \r
+                               /*! \brief Process::resume() - Resume the MSG process.\r
+                                *\r
+                                * \exception                   If this method failed, it throws the exception described below:\r
+                                *\r
+                                *                                              [MsgException] if an internal exception occurs during the operation.\r
+                                */\r
+                               void resume(void) \r
+                               throw(MsgException);\r
+                       \r
+                               /*! \brief Process::isSuspend() - Tests if a process is suspended.\r
+                                *\r
+                                * \return                              This method returns 1 is the process is suspended.\r
+                                *                                              Otherwise the method returns 0.\r
+                                */\r
+                               int isSuspended(void);\r
+                       \r
+                               /*! \brief Process::getHost() - Retrieves the host of a process object.\r
+                                *\r
+                                * \return                              The method returns a reference to the\r
+                                *                                              host of the process.\r
+                                *\r
+                                */\r
+                               Host& getHost(void); \r
+                       \r
+                               /*! \brief Process::fromPID() - Retrieves a process from its PID.\r
+                                *\r
+                                * \param PID                   The PID of the process to retrieve.\r
+                                *\r
+                                * \return                              If successful the method returns a reference to\r
+                                *                                              to process. Otherwise, the method throws one of\r
+                                *                                              the exceptions described below:\r
+                                *\r
+                                * \exception                   [ProcessNotFoundException]      if the process is not found (no process with this PID).\r
+                                *\r
+                                *                                              [InvalidArgumentException]      if the parameter PID is less than 1.\r
+                                *\r
+                                *                                              [MsgException]                          if a native error occurs during the operation.\r
+                                */\r
+                               static Process& fromPID(int PID)\r
+                               throw(ProcessNotFoundException, InvalidArgumentException, MsgException); \r
+                       \r
+                               /*! \brief Process::getPID() - Gets the PID of a process object.\r
+                                *\r
+                                * \return                              This method returns the PID of a process object.\r
+                                */\r
+                               int getPID(void);\r
+                               \r
+                               /*! \brief Process::getPPID() - Gets the parent PID of a process object.\r
+                                *\r
+                                * \return                              This method returns the parent PID of a process object.\r
+                                */\r
+                               int getPPID(void);\r
+                               \r
+                               /*! \brief Process::getName() - Gets the name of a process object.\r
+                                *\r
+                                * \return                              This method returns the name of a process object.\r
+                                */\r
+                               const char* getName(void) const;\r
+                       \r
+                               /*! \brief Process::currentProcess() - Retrieves the current process.\r
+                                *\r
+                                * \return                              This method returns a reference to the current process. Otherwise\r
+                                *                                              the method throws the excepction described below:\r
+                                *\r
+                                * \exception                   [MsgException]  if an internal exception occurs.\r
+                                */\r
+                               static Process& currentProcess(void)\r
+                               throw (MsgException);\r
+                       \r
+                               /*! \brief Process::currentProcessPID() - Retrieves the PID of the current process.\r
+                                *\r
+                                * \return                              This method returns the PID of the current process.\r
+                                */\r
+                               static int currentProcessPID(void);\r
+                               \r
+                               /*! \brief Process::currentProcessPPID() - Retrieves the parent PID of the current process.\r
+                                *\r
+                                * \return                              This method returns the parent PID of the current process.\r
+                                */\r
+                               static int currentProcessPPID(void);\r
+                       \r
+                               /*! \brief Process::migrate() - Migrate a process object to an another host.\r
+                                *\r
+                                * \param rHost                 A reference to the host to migrate the process to.\r
+                                *\r
+                                * \return                              If successful the method migrate the process to the specified\r
+                                *                                              host. Otherwise the method throws the exception described\r
+                                *                                              below:\r
+                                *\r
+                                * \exception                   [MsgException]  if an internal exception occurs.\r
+                                */\r
+                               void migrate(const Host& rHost)\r
+                               throw(MsgException);\r
+                       \r
+                               /*! \brief Process::sleep() - Makes the current process sleep until time seconds have elapsed. \r
+                                *\r
+                                * \param seconds                       The number of seconds to sleep.\r
+                                *\r
+                                * \execption                           If this method failed, it throws one of the exceptions described\r
+                                *                                                      below: \r
+                                *\r
+                                *                                                      [InvalidArgumentException]      if the parameter seconds is\r
+                                *                                                      less or equals to zero.\r
+                                *\r
+                                *                                                      [MsgException] if an internal exception occurs.\r
+                                */\r
+                               static void sleep(double seconds)\r
+                               throw(InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::putTask() - This method puts a task on a given channel of a given host.\r
+                                *\r
+                                * \exception                   If this method failed, it throws one of the exceptions described\r
+                                *                                              below:\r
+                                *\r
+                                *                                              [InvalidArgumentException] if the channel number is negative.\r
+                                *\r
+                                *                                              [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               void putTask(const Host& rHost, int channel, Task* task)\r
+                               throw(InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::putTask() - This method puts a task on a given channel of a given host (waiting at most given time).\r
+                                *\r
+                                * \exception                   If this method failed, it throws one of the exceptions described below:\r
+                                *\r
+                                *                                              [MsgException]                          if an internal error occurs.\r
+                                *\r
+                                *                                              [InvalidArgumentException]      if the value of the channel specified as\r
+                                *                                                                                                      parameter is negative or if the timeout value\r
+                                *                                                                                                      is less than zero and différent of -1.\r
+                                *\r
+                                * \remark                              Set the timeout with -1.0 to disable it.\r
+                                */\r
+                               void putTask(const Host& rHost, int channel, Task* task, double timeout) \r
+                               throw(InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::getTask() - Retrieves a task from a channel number (waiting at most given time).\r
+                                *\r
+                                * \param channel               The number of the channel where to get the task.\r
+                                *\r
+                                * \return                              If successful the method returns a reference to \r
+                                *                                              the getted task. Otherwise the method throws one\r
+                                *                                              of the exceptions described below:\r
+                                *\r
+                                * \exception                   [InvalidArgumentException]      if the channel number is negative.\r
+                                *\r
+                                *                                              [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               Task* getTask(int channel) \r
+                               throw(InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::taskGet() - Retrieves a task from a channel number (waiting at most given time).\r
+                                *\r
+                                * \param channel               The number of the channel where to get the task.\r
+                                * \param timeout               The timeout value.\r
+                                *\r
+                                * \return                              If successful the method returns a reference to \r
+                                *                                              the getted task. Otherwise the method throws one\r
+                                *                                              of the exceptions described below:\r
+                                *\r
+                                * \exception                   [InvalidArgumentException]      if the channel number is negative\r
+                                *                                                                                                      or if the timeout value is less than\r
+                                *                                                                                                      zero and different of -1.0.\r
+                                *                                              [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               Task* getTask(int channel, double timeout) \r
+                               throw(InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::taskGet() - Retrieves a task from a channel number and a host.\r
+                                *\r
+                                * \param channel               The number of the channel where to get the task.\r
+                                * \param host                  The host of the channel to get the task.\r
+                                *\r
+                                * \return                              If successful the method returns a reference to \r
+                                *                                              the getted task. Otherwise the method throws one\r
+                                *                                              of the exceptions described below.\r
+                                *\r
+                                * \exception                   [InvalidArgumentException]      if the channel number is negative.\r
+                                *                                              [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               Task* getTask(int channel, const Host& rHost) \r
+                               throw(InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::taskGet() - Retrieves a task from a channel number and a host (waiting at most given time).\r
+                                *\r
+                                * \param channel               The number of the channel where to get the task.\r
+                                * \param timeout               The timeout value.\r
+                                * \param rHost                 The host owning the channel.\r
+                                *\r
+                                * \return                              If successful the method returns a reference to \r
+                                *                                              the getted task. Otherwise the method throws one\r
+                                *                                              of the exceptions described below:\r
+                                *\r
+                                * \exception                   [InvalidArgumentException]      if the channel number is negative or\r
+                                *                                                                                                      if the timeout value is negative and different\r
+                                *                                                                                                      of -1.0.\r
+                                *                                              [MsgException]                          if an internal exception occurs.\r
+                                *\r
+                                * \remark                              Set the timeout with -1.0 to disable it.\r
+                                */\r
+                               Task* getTask(int channel, double timeout, const Host& rHost)\r
+                               throw(InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the specified alias\r
+                                * (waiting at most given time).\r
+                                *\r
+                                * \param alias                         The alias of the mailbox where to send the task.\r
+                                * \param rTask                         A reference to the task object to send.\r
+                                * \param timeout                       The timeout value.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exceptions described below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if the alias specified as parameter is NULL.\r
+                                *      \r
+                                *                                                      [InvalidArgumentException]      if the timeout value is negative and different than\r
+                                *                                                                                                              -1.0\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                *\r
+                                * \remark                                      Set the timeout with -1.0 to disable it.\r
+                                */\r
+                               void sendTask(const char* alias, Task* task, double timeout) \r
+                               throw(NullPointerException, InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the specified alias.\r
+                                *\r
+                                * \param alias                         The alias of the mailbox where to send the task.\r
+                                * \param rTask                         A reference to the task object to send.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exceptions described below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if the alias parameter is NULL.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                *\r
+                                */\r
+                               void sendTask(const char* alias, Task* task) \r
+                               throw(NullPointerException, MsgException);\r
+                       \r
+                               /*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the default alias.\r
+                                *\r
+                                * \param rTask                         A reference to the task object to send.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exceptions described below:\r
+                                *                                                      \r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the default alias.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                *\r
+                                */\r
+                               void sendTask(Task* task) \r
+                               throw(BadAllocException, MsgException);\r
+                       \r
+                               /*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the default alias\r
+                                * (waiting at most given time).\r
+                                *\r
+                                * \param rTask                         A reference to the task object to send.\r
+                                * \param timeout                       The timeout value.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exceptions described below:\r
+                                *\r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the default alias.\r
+                                *\r
+                                *                                                      [InvalidArgumentException]      if the timeout value is negative and different than -1.0.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                *\r
+                                * \remark                                      set the timeout value with -1.0 to disable it.\r
+                                */\r
+                               void sendTask(Task* task, double timeout) \r
+                               throw(BadAllocException, InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
+                                * parameter.\r
+                                *\r
+                                * \param alias                         The alias of the mailbox where to retrieve the task.\r
+                                *\r
+                                * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
+                                *                                                      throws one of the exceptions described below:\r
+                                *\r
+                                * \exception                           [NullPointerException]  if the parameter alias is NULL.\r
+                                *\r
+                                *                                                      [MsgException]                  if an internal exception occurs.\r
+                                */\r
+                               Task* receiveTask(const char* alias) \r
+                               throw(NullPointerException, MsgException);\r
+                       \r
+                               /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the default alias.\r
+                                *\r
+                                * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
+                                *                                                      throws one of the exceptions described below:\r
+                                *\r
+                                * \exception                           [BadAllocException]             if there is not enough memory to build the alias.                       \r
+                                *                                                      [MsgException]                  if an internal exception occurs.\r
+                                */\r
+                               Task* receiveTask(void) \r
+                               throw(BadAllocException, MsgException);\r
+                       \r
+                               /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
+                                * parameter(waiting at most given time).\r
+                                *\r
+                                * \param alias                         The alias of the mailbox where to retrieve the task.\r
+                                * \param timeout                       The timeout value.\r
+                                *\r
+                                * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
+                                *                                                      throws one of the exceptions described below.\r
+                                *\r
+                                * \exception                           [InvalidArgumentException]      if the timeout value is negative or different of -1.0.\r
+                                *\r
+                                *                                                      [NullPointerException]          if the parameter alias is NULL.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               Task* receiveTask(const char* alias, double timeout) \r
+                               throw(NullPointerException, InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the default alias\r
+                                * (waiting at most given time).\r
+                                *\r
+                                * \param timeout                       The timeout value.\r
+                                *\r
+                                * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
+                                *                                                      throws one of the exceptions described below:\r
+                                *\r
+                                * \exception                           [InvalidArgumentException]      if the timeout value is negative or different than -1.0.\r
+                                *\r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the alias.\r
+                                *                      \r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               Task* receiveTask(double timeout) \r
+                               throw(InvalidArgumentException, BadAllocException, MsgException);\r
+                       \r
+                               /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
+                                * parameter located on a given host (waiting at most given time).\r
+                                *\r
+                                * \param alias                         The alias of the mailbox where to retrieve the task.\r
+                                * \param timeout                       The timeout value.\r
+                                * \param rHost                         A reference to the host object owning the mailbox.\r
+                                *\r
+                                * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
+                                *                                                      throws one of the exceptions described below:\r
+                                *\r
+                                * \exception                           [InvalidArgumentException]      if the timeout value is negative or different of -1.0.\r
+                                *\r
+                                *                                                      [NullPointerException]          if the parameter alias is NULL.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               Task* receiveTask(const char* alias, double timeout, const Host& rHost) \r
+                               throw(NullPointerException, InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by default alias\r
+                                *  and located on a given host (waiting at most given time).\r
+                                *\r
+                                * \param timeout                       The timeout value.\r
+                                * \param rHost                         A reference to the host object owning the mailbox.\r
+                                *\r
+                                * \return                                      If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
+                                *                                                      throws one of the exceptions described below:\r
+                                *\r
+                                * \exception                           [InvalidArgumentException]      if the timeout value is negative and different than -1.0.\r
+                                *\r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the default alias.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               Task* receiveTask(double timeout, const Host& rHost) \r
+                               throw(BadAllocException, InvalidArgumentException, MsgException);\r
+                       \r
+                               /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias\r
+                                *  specified as parameter and located on a given host.\r
+                                *\r
+                                * \param alias                 The alias using to identify the mailbox from which to get the task.\r
+                                * \param rHost                 A reference to the host object owning the mailbox.\r
+                                *\r
+                                * \return                              If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
+                                *                                              throws one of the exceptions described below:\r
+                                *\r
+                                * \exception                   [NullPointerException]                  if the parameter alias is NULL.\r
+                                *\r
+                                *                                              [MsgException]                                  if an internal exception occurs.\r
+                                */\r
+                               Task* receiveTask(const char* alias, const Host& rHost) \r
+                               throw(NullPointerException, MsgException);\r
+                       \r
+                               /*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by default alias\r
+                                *  and located on a given host.\r
+                                *\r
+                                * \param rHost                 A reference to the host object owning the mailbox.\r
+                                *\r
+                                * \return                              If succcessful, the method returns a task of the mailbox. Otherwise, the method\r
+                                *                                              throws one of the exceptions described below:\r
+                                *\r
+                                * \exception                   [BadAllocException]                             if there is not enough memory to build the alias.\r
+                                *\r
+                                *                                              [MsgException]                                  if an internal exception occurs.\r
+                                */\r
+                               Task* receiveTask(const Host& rHost) \r
+                               throw(BadAllocException, MsgException);\r
+                       \r
+                               \r
+                       private:\r
+                       \r
+                               /* Process::create() - Creates a process on a given host.\r
+                                *\r
+                                * param rHost                  A reference to a host object where to create the process.\r
+                                * param name                   The name of the process to create.\r
+                                * param argc                   The number of argument to pass to the main function of the process.\r
+                                * param argv                   The list of the arguments of the main function of the process.\r
+                                *\r
+                                * exception                    If this method failed, it throws one of the exceptions described below:\r
+                                *\r
+                                *                                              [HostNotFoundException] if the host specified as parameter doesn't exist.\r
+                                */\r
+                               void create(const Host& rHost, const char* name, int argc, char** argv) \r
+                               throw(InvalidArgumentException);\r
+                               \r
+                               /* Process::fromNativeProcess() - Retrieves the process wrapper associated with a native process.\r
+                                *\r
+                                * \param nativeProcess The native process to get the wrapper.\r
+                                *\r
+                                * \return                              The wrapper associated with the native process specified as parameter.\r
+                                */\r
+                               static Process* fromNativeProcess(m_process_t nativeProcess);\r
+                       \r
+                       \r
+                       public:\r
+                       \r
+                               /* Process::run() - used to set the field code of the context of the process.\r
+                                */ \r
+                               static int run(int argc, char** argv);\r
+                               \r
+                               /*! \brief Process::main() - This virtual pure function is the main function of the process.\r
+                                * You must override this function for each new class of process that you create.\r
+                                *\r
+                                * \param argc                  The number of parameters of the main function.\r
+                                * \param argv                  The list of the parameter of the main function.\r
+                                *\r
+                                * \return                              The exit code of the main function.\r
+                                */\r
+                               virtual int main(int argc, char** argv);\r
+\r
+                       // Operators.\r
+                                       \r
+                               /*\r
+                                       // Override the operator new().\r
+                                       void* operator new(size_t size);\r
+                                       \r
+                                       // Override the operator delete().\r
+                                       void operator delete(void* p);\r
+                                */\r
+                               \r
+                       private:\r
+                               \r
+                               // Attributes.\r
+                               \r
+                               m_process_t nativeProcess;      // pointer to the native msg process.\r
+                       \r
+               };\r
+       \r
+       } //namepace Msg\r
+\r
+} // namespace SimGrid\r
+\r
+#endif // !MSG_PROCESS_HPP\r
 \r
-}
\ No newline at end of file