Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some new classes of CPP version of Msg
[simgrid.git] / src / cxx / Task.hpp
index 173f4a7..a158f4f 100644 (file)
+/*\r
+ * Task.hpp\r
+ *\r
+ * This file contains the declaration of the wrapper class of the native MSG task type.\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_TASK_HPP\r
 #define MSG_TASK_HPP\r
 \r
 // Compilation C++ recquise\r
 #ifndef __cplusplus\r
-       #error Process.hpp requires C++ compilation (use a .cxx suffix)\r
+       #error Task.hpp requires C++ compilation (use a .cxx suffix)\r
 #endif\r
 \r
-namespace msg\r
-{\r
-class Task\r
+#include <msg/datatypes.h>\r
+\r
+#include <Config.hpp>\r
+\r
+#include <Object.hpp>\r
+\r
+namespace SimGrid\r
 {\r
-       protected:\r
-               // Default constructor.\r
-               Task();\r
-               \r
-       public:\r
-               // Copy constructor.\r
-               Task(const Task& rTask);\r
-               \r
-               // Destructor.\r
-               virtual ~Task()\r
-               throw(NativeException);\r
-               \r
-       // Other constructors.\r
-       Task(const char* name, double computeDuration, double messageSize);\r
-       \r
-       Task(const char* name, Host* hosts, double* computeDurations, double* messageSizes);\r
-       \r
-       \r
-       // Getters/setters.\r
-       const char* getName(void) const;\r
-       \r
-       \r
-       Process& getSender(void) const;\r
-       \r
-       Host& getSource(void) const \r
-       throw(NativeException);\r
-       \r
-       double getComputeDuration(void) const;\r
-       \r
-       double getRemainingDuration(void) const;\r
-       \r
-       void setPriority(double priority);\r
-       \r
-       static Task& get(int channel) \r
-       throw(NativeException); \r
-       \r
-       static Task& get(int channel, const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       static Task& get(int channel, double timeout, const Host& rHost) \r
-       throw(NativeException);  \r
-       \r
-       static bool probe(int channel);\r
-       \r
-       static int probe(int channel, const Host& rHost);\r
-       \r
-       void execute(void) \r
-       throw(NativeException);\r
-       \r
-       void cancel(void) \r
-       throw(NativeException);\r
-       \r
-       \r
-       void send(void) \r
-       throw(NativeException);\r
-       \r
-       void send(const char* alias) \r
-       throw(NativeException);\r
-       \r
-       void send(double timeout) \r
-       throw(NativeException);\r
-       \r
-       void send(const char* alias, double timeout) \r
-       throw(NativeException);\r
-       \r
-       void sendBounded(double maxRate) \r
-       throw(NativeException);\r
-       \r
-       void sendBounded(const char* alias, double maxRate) \r
-       throw(NativeException);\r
-       \r
-       static Task& receive(void) \r
-       throw(NativeException);\r
-       \r
-       static Task& receive(const char* alias) \r
-       throw(NativeException);\r
-       \r
-       static Task& receive(const char* alias, double timeout) \r
-       throw(NativeException);\r
-       \r
-       static Task& receive(const char* alias, const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       static Task& receive(const char* alias, double timeout, const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       static bool listen(void) \r
-       throw(NativeException);\r
-       \r
-       static bool listen(const char* alias) \r
-       throw(NativeException);\r
-       \r
-       static bool listenFrom(void) \r
-       throw(NativeException);\r
-       \r
-       static bool listenFrom(const char* alias) \r
-       throw(NativeException);\r
-       \r
-       \r
-       static bool listenFromHost(const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       static bool listenFromHost(const char* alias, const Host& rHost) \r
-       throw(NativeException);\r
-       \r
-       \r
-       \r
-       private:\r
-               \r
-               m_task_t nativeTask;\r
+       namespace Msg\r
+       {\r
+               class MsgException;\r
+               class InvalidArgumentException;\r
+               class NullPointerException;\r
+               class MsgException;\r
+               class BadAllocException;\r
+\r
+               class Process;\r
+               class Host;\r
+\r
+               // SimGrid::Msg::Task wrapper class declaration.\r
+               class SIMGRIDX_EXPORT Task : public Object\r
+               {\r
+                       MSG_DECLARE_DYNAMIC(Task);\r
+\r
+                       friend Process;\r
+                       friend Host;\r
+\r
+                       protected:\r
+                               // Default constructor.\r
+                               Task();\r
+\r
+                       class Ref\r
+                       {\r
+                       public:\r
+                               Ref(Task* task)\r
+                               {\r
+                                       count = 1;\r
+                                       this->task = task;\r
+                               }\r
+\r
+                               virtual ~Ref(){}\r
+\r
+                               void operator++(void){\r
+                                       count++;\r
+                                       \r
+                               }\r
+\r
+                               void operator--(void){\r
+                                       if(--count <= 0)\r
+                                               delete p;\r
+                               }\r
+\r
+                       private:\r
+                               int count;\r
+                               Task* task;\r
+\r
+                       };\r
+                               \r
+                       public:\r
+                               /*! \brief Copy constructor.\r
+                                */\r
+                               Task(const Task& rTask);\r
+                               \r
+                               /*! \brief Destructor.\r
+                                *\r
+                                * \exception                           If the destructor failed, it throw the exception described below:\r
+                                *\r
+                                *                                                      [MsgException]                          if a native exception occurs.\r
+                                */\r
+                               virtual ~Task()\r
+                               throw(MsgException);\r
+                               \r
+                               /*! \brief Constructs an new task with the specified processing amount and amount\r
+                                * of data needed.\r
+                                *\r
+                                * \param name                          Task's name\r
+                                * \param computeDuration       A value of the processing amount (in flop) needed to process the task. \r
+                                *                                                      If 0, then it cannot be executed with the execute() method.\r
+                                *                                                      This value has to be >= 0.\r
+                                * \param messageSize           A value of amount of data (in bytes) needed to transfert this task.\r
+                                *                                                      If 0, then it cannot be transfered with the get() and put() methods.\r
+                                *                                                      This value has to be >= 0.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exceptions described below:\r
+                                *\r
+                                *                                                      [InvalidArgumentException]      if the parameter computeDuration or messageSize\r
+                                *                                                                                                              is negative.\r
+                                *                                                      [NullPointerException]          if the parameter name is NULL.\r
+                                *\r
+                                *                                                      [MsgException]                          if a internal exception occurs.\r
+                                */\r
+                               Task(const char* name, double computeDuration, double messageSize)\r
+                               throw (InvalidArgumentException, NullPointerException);\r
+                               \r
+                               /*! \Constructs an new parallel task with the specified processing amount and amount for each host\r
+                            * implied.\r
+                            *\r
+                            * \param name                              The name of the parallel task.\r
+                            * \param hosts                             The list of hosts implied by the parallel task.\r
+                            * \param computeDurations  The amount of operations to be performed by each host of \a hosts.\r
+                            * \param messageSizes              A matrix describing the amount of data to exchange between hosts.\r
+                            * \hostCount                               The number of hosts implied in the parallel task.\r
+                            * \r
+                            * \exception                               If this method fails, it throws one of the exceptions described below:\r
+                            *\r
+                            *                                                  [NullPointerException]          if the parameter name is NULL or\r
+                            *                                                                                                          if the parameter computeDurations is NULL or\r
+                            *                                                                                                          if the parameter messageSizes is NULL\r
+                            *\r
+                            *                                                  [InvalidArgumentException]      if the parameter hostCount is negative or zero.                                                 \r
+                            */\r
+                               Task(const char* name, Host* hosts, double* computeDurations, double* messageSizes, int hostCount)\r
+                               throw(NullPointerException, InvalidArgumentException);\r
+                       \r
+                       \r
+                               /*! \brief Task::getName() - Gets the names of the task.\r
+                                *\r
+                                * \return                                      The name of the task.\r
+                                */\r
+                               const char* getName(void) const;\r
+                       \r
+                               /*! \brief Task::getSender() - Gets the sender of the task.\r
+                                *\r
+                                * \return                                      A reference to the sender of the task.\r
+                                */\r
+                               Process& getSender(void) const;\r
+                               \r
+                               /*! \brief Task::getSource() - Gets the source of the task.\r
+                                * \r
+                                * \return                                      A reference to the source of the task.\r
+                                */\r
+                               Host& getSource(void) const;\r
+                               \r
+                               /*! \brief Task::getComputeDuration() - Get the computing amount of the task.\r
+                                *\r
+                                * \return                                      The computing amount of the task.\r
+                                */\r
+                       \r
+                               double getComputeDuration(void) const;\r
+                               \r
+                               /*! \brief Task::getRemainingDuration() - Gets the remaining computation.\r
+                                *\r
+                                * \return                                      The remining computation of the task.\r
+                                */\r
+                               double getRemainingDuration(void) const;\r
+                       \r
+                               /*! \brief Task::setPrirority() -  Sets the priority of the computation of the task.\r
+                        * The priority doesn't affect the transfert rate. For example a\r
+                        * priority of 2 will make the task receive two times more cpu than\r
+                        * the other ones.\r
+                        *\r
+                        * \param priority                      The new priority of the task.\r
+                        *\r
+                        * execption                            If this method fails, it throws the exception described below:\r
+                        *\r
+                        *                                                      [InvalidArgumentException]      if the parameter priority is negative.\r
+                        */\r
+                               void setPriority(double priority)\r
+                               throw(InvalidArgumentException);\r
+                               \r
+                               /*! \brief Task::get() - Gets a task from the specified channel of the host of the current process.\r
+                                *\r
+                                * \param channel                       The channel number to get the task.\r
+                                *\r
+                                * \return                                      If successful the method returns the task. Otherwise the method throws one\r
+                                *                                                      of the exceptions described below:\r
+                                *\r
+                                * \exception                           [InvalidArgumentException]      if the channel parameter is negative.\r
+                                *                                      \r
+                                *                                                      [MsgException]                          if an internal excpetion occurs.\r
+                                */\r
+                               /*static Task& get(int channel) \r
+                               throw(InvalidArgumentException, MsgException);*/\r
+\r
+                               static Task* get(int channel) \r
+                               throw(InvalidArgumentException, MsgException);\r
+\r
+                               /*! \brief      Task::get() - Gets a task from the given channel number of the given host.      \r
+                                *\r
+                                * \param channel                       The channel number.\r
+                                * \param rHost                         A reference of the host owning the channel.\r
+                                *\r
+                                * \return                                      If successful, the method returns the task. Otherwise the method\r
+                                *                                                      throw one 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
+                               static Task& get(int channel, const Host& rHost) \r
+                               throw(InvalidArgumentException, MsgException);\r
+                               \r
+                               /*! \brief Task::get() - Gets a task from the specified channel of the specified host\r
+                                *  (waiting at most given time).\r
+                                *\r
+                                * \param channel                       The channel number.\r
+                                * \param timeout                       The timeout value.\r
+                                * \param rHost                         A reference to the host owning the channel.\r
+                                *\r
+                                * \return                                      If successful, the method returns the task. Otherwise the method returns\r
+                                *                                                      one of the exceptions described below:\r
+                                *\r
+                                * \exception                           [InvalidArgumentException]      if the channel number is negative or\r
+                                *                                                                                                              if the timeout value is negative and \r
+                                *                                                                                                              different than -1.0.\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               static Task& get(int channel, double timeout, const Host& rHost) \r
+                               throw(InvalidArgumentException, MsgException);  \r
+                               \r
+                               /*! \brief Task::probe() - Probes whether there is a waiting task on the given channel of local host.\r
+                                *\r
+                                * \param channel                       The channel number.\r
+                                *\r
+                                * \return                                      If there is a waiting task on the channel the method returns 1. Otherwise\r
+                                *                                                      the method returns 0.\r
+                                *\r
+                                * \exception                           If this method fails, it throws the exception described below:\r
+                                *\r
+                                *                                                      [InvalidArgumentException]      if the parameter channel is negative.\r
+                                */\r
+                               static int probe(int channel)\r
+                               throw(InvalidArgumentException);\r
+                               \r
+                               /*! \brief Task::probe() - Counts tasks waiting on the given channel of local host and sent by given host.\r
+                                *\r
+                                * \param channel                       The channel id.\r
+                                * \param rHost                         A reference to the host that has sent the task.\r
+                                *\r
+                                * \return                                      The number of tasks.\r
+                                *\r
+                                * \exception                           [InvalidArgumentException]      if the parameter channel is negative.\r
+                                */\r
+                               static int probe(int channel, const Host& rHost)\r
+                               throw(InvalidArgumentException);\r
+                               \r
+                               /*! \brief Task::execute() - This method executes a task on the location on which the\r
+                                * process is running.\r
+                                *\r
+                                * \exception                           If this method fails, it returns the exception described below:\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               void execute(void) \r
+                               throw(MsgException);\r
+                               \r
+                               /*! \brief Task::cancel() - This method cancels a task.\r
+                                *\r
+                                * \exception                           If this method fails, it returns the exception described below:\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               void cancel(void) \r
+                               throw(MsgException);\r
+                       \r
+                               /*! \brief Task::send() - Send the task on the mailbox identified by the default alias.\r
+                                *\r
+                                * \exception                           If this method failed, it returns one of the exceptions described\r
+                                *                                                      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
+                               void send(void) \r
+                               throw(BadAllocException, MsgException);\r
+                               \r
+                               /*! \brief Task::send() - Send the task on the mailbox identified by the given alias.\r
+                                *\r
+                                * \param alias                         The alias of the mailbox where to send the task.\r
+                                *\r
+                                * \exception                           If this method failed, it returns one of the exceptions described\r
+                                *                                                      below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if there parameter alias is NULL.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */ \r
+                               void send(const char* alias) \r
+                               throw(NullPointerException, MsgException);\r
+                               \r
+                               /*! \brief Task::send() - Send the task on the mailbox identified by the default alias\r
+                                * (waiting at most given time).\r
+                                *\r
+                                * \param timeout                       The timeout value.\r
+                                *\r
+                                * \exception                           If this method failed, it returns one of the exceptions described\r
+                                *                                                      below:\r
+                                *\r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the default alias.\r
+                                *\r
+                                *                                                      [InvalidArgumentException]      if the timeout value is negative or different -1.0.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               void send(double timeout) \r
+                               throw(BadAllocException, InvalidArgumentException, MsgException);\r
+                               \r
+                               /*! \brief Task::send() - Send the task on the mailbox identified by a given alias\r
+                                * (waiting at most given time).\r
+                                *\r
+                                * \param alias                         The alias of the mailbox where to send the task.\r
+                                * \param timeout                       The timeout value.\r
+                                *\r
+                                * \exception                           If this method failed, it returns one of the exceptions described\r
+                                *                                                      below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if alias parameter is NULL.\r
+                                *\r
+                                *                                                      [InvalidArgumentException]      if the timeout value is negative or different -1.0.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               void send(const char* alias, double timeout) \r
+                               throw(NullPointerException, InvalidArgumentException, MsgException);\r
+                               \r
+                               /*! \brief Task::sendBounded() - Sends the task on the mailbox identified by the default alias.\r
+                                * (capping the emision rate to maxrate).\r
+                                *\r
+                                * \param maxRate                       The maximum rate 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 parameter maxRate is negative and different\r
+                                *                                                                                                              than -1.0.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               void sendBounded(double maxRate) \r
+                               throw(BadAllocException, InvalidArgumentException, MsgException);\r
+                               \r
+                               /*! \brief Task::sendBounded() - Sends the task on the mailbox identified by the given alias.\r
+                                * (capping the emision rate to maxrate).\r
+                                *\r
+                                *\ param alias                         The alias of the mailbox where to send the task.\r
+                                * \param maxRate                       The maximum rate value.\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
+                                *                                                      [InvalidArgumentException]      if the parameter maxRate is negative and different\r
+                                *                                                                                                              than -1.0.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               void sendBounded(const char* alias, double maxRate) \r
+                               throw(NullPointerException, InvalidArgumentException, MsgException);\r
+                               \r
+                               \r
+                               /*! \brief Task::receive() - Receives a task from the mailbox identified by the default alias (located\r
+                                * on the local host).\r
+                                *\r
+                                * \return                                      A reference to the task.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exception 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
+                               /*static Task& receive(void) \r
+                               throw(BadAllocException, MsgException);*/\r
+\r
+                               static Task* receive(void) \r
+                               throw(BadAllocException, MsgException);\r
+                               \r
+                               /*! \brief Task::receive() - Receives a task from the mailbox identified by a given alias (located\r
+                                * on the local host).\r
+                                *\r
+                                * \alias                                       The alias of the mailbox.\r
+                                *\r
+                                * \return                                      A reference to the task.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exception described below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if the alias parameter is NULL.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               /*static Task& receive(const char* alias) \r
+                               throw(NullPointerException, MsgException);*/\r
+                               static Task* receive(const char* alias) \r
+                               throw(NullPointerException, MsgException);\r
+                               \r
+                               /*! \brief Task::receive() - Receives a task from the mailbox identified by a given alias (located\r
+                                * on the local host and waiting at most given time).\r
+                                *\r
+                                * \alias                                       The alias of the mailbox.\r
+                                * \timeout                                     The timeout value.\r
+                                *\r
+                                * \return                                      A reference to the task.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exception described below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if the alias parameter is NULL.\r
+                                *\r
+                                *                                                      [InvalidArgumentException]      if the timeout value is negatif and different than\r
+                                *                                                                                                              -1.0.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               static Task& receive(const char* alias, double timeout) \r
+                               throw(NullPointerException, InvalidArgumentException, MsgException);\r
+                               \r
+                               /*! \brief Task::receive() - Receives a task from the mailbox identified by a given alias located\r
+                                * on the given host.\r
+                                *\r
+                                * \alias                                       The alias of the mailbox.\r
+                                * \rHost                                       The location of the mailbox.\r
+                                *\r
+                                * \return                                      A reference to the task.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exception described below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if the alias parameter is NULL.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               static Task& receive(const char* alias, const Host& rHost) \r
+                               throw(NullPointerException, MsgException);\r
+                               \r
+                               /*! \brief Task::receive() - Receives a task from the mailbox identified by a given alias located\r
+                                * on the given host (and waiting at most given time).\r
+                                *\r
+                                * \alias                                       The alias of the mailbox.\r
+                                * \timeout                                     The timeout value.\r
+                                * \rHost                                       The location of the mailbox.\r
+                                *\r
+                                * \return                                      A reference to the task.\r
+                                *\r
+                                * \exception                           If this method failed, it throws one of the exception described below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if the alias parameter is NULL.\r
+                                *\r
+                                *                                                      [InvalidArgumentException]      if the timeout value is negatif and different than\r
+                                *                                                                                                              -1.0.\r
+                                *\r
+                                *                                                      [MsgException]                          if an internal exception occurs.\r
+                                */\r
+                               static Task& receive(const char* alias, double timeout, const Host& rHost) \r
+                               throw(NullPointerException, InvalidArgumentException, MsgException);\r
+                               \r
+                               /*! \brief Task::listen() - Listen whether there is a waiting task on the mailbox \r
+                                * identified by the default alias of local host.\r
+                                *\r
+                                * \return                                      If there is a waiting task on the mailbox the method returns true.\r
+                                *                                                      Otherwise the method returns false.\r
+                                *\r
+                                * \exception                           If this method fails, it throws one of the exceptions described below:\r
+                                *\r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the default alias.\r
+                                */\r
+                               static int listen(void) \r
+                               throw(BadAllocException);\r
+                               \r
+                               /*! \brief Task::listen() - Listen whether there is a waiting task on the mailbox \r
+                                * identified by the given alias of local host.\r
+                                *\r
+                                * \param alias                         The alias of the mailbox.\r
+                                *\r
+                                * \return                                      If there is a waiting task on the mailbox the method returns 1.\r
+                                *                                                      Otherwise the method returns 0.\r
+                                *\r
+                                * \exception                           If this method fails, it throws one of the exceptions described below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if the parameter alias is NULL.\r
+                                */\r
+                               static int listen(const char* alias) \r
+                               throw(NullPointerException);\r
+                               \r
+                               /*! \brief Task::listenFrom() - Tests whether there is a pending communication on the mailbox \r
+                                * identified by the default alias, and who sent it.\r
+                                *\r
+                                * \return                                      If there is a pending communication on the mailbox, the method returns\r
+                                *                                                      the PID of it sender. Otherwise the method returns -1.\r
+                                *\r
+                                * \exception                           If this method fails, it throws the exception described below:\r
+                                *\r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the default\r
+                                *                                                                                                              alias.\r
+                                */\r
+                               static int listenFrom(void) \r
+                               throw(BadAllocException);\r
+                               \r
+                               /*! \brief Task::listenFrom() - Tests whether there is a pending communication on the mailbox \r
+                                * identified by the specified alias, and who sent it.\r
+                                *\r
+                                * \alias                                       The alias of the mailbox.\r
+                                *\r
+                                * \return                                      If there is a pending communication on the mailbox, the method returns\r
+                                *                                                      the PID of it sender. Otherwise the method returns -1.\r
+                                *\r
+                                * \exception                           If this method fails, it throws the exception described below:\r
+                                *\r
+                                *                                                      [NullPointerException]          if the alias parameter is NULL.\r
+                                */\r
+                               static int listenFrom(const char* alias) \r
+                               throw(NullPointerException);\r
+                               \r
+                               /*! \brief Task::listenFromHost() - Tests whether there is a pending communication on the mailbox \r
+                                * identified by the default alias and located on the host of the current process, and who sent it.\r
+                                *\r
+                                * \param rHost                         The location of the mailbox.\r
+                                *\r
+                                * \return                                      If there is a pending communication on the mailbox, the method returns\r
+                                *                                                      the PID of it sender. Otherwise the method returns -1.\r
+                                *\r
+                                * \exception                           If this method fails, it throws the exception described below:\r
+                                *\r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the default\r
+                                *                                                                                                              alias.\r
+                                */\r
+                               static int listenFromHost(const Host& rHost) \r
+                               throw(BadAllocException);\r
+                               \r
+                               /*! \brief Task::listenFromHost() - Tests whether there is a pending communication on the mailbox \r
+                                * identified by the default alias and located on the host of the current process, and who sent it.\r
+                                *\r
+                                * \param rHost                         The location of the mailbox.\r
+                                *\r
+                                * \return                                      If there is a pending communication on the mailbox, the method returns\r
+                                *                                                      the PID of it sender. Otherwise the method returns -1.\r
+                                *\r
+                                * \exception                           If this method fails, it throws the exception described below:\r
+                                *\r
+                                *                                                      [BadAllocException]                     if there is not enough memory to build the default\r
+                                *                                                                                                              alias.\r
+                                */\r
+                               static int listenFromHost(const char* alias, const Host& rHost) \r
+                               throw(NullPointerException, MsgException);\r
+\r
+                               virtual const Task& operator= (const Task& rTask);\r
+                       \r
+                       protected:\r
+                               \r
+                               // Attributes.\r
+                               \r
+                               m_task_t nativeTask;    // the native MSG task.\r
+\r
+                               Ref* ref;\r
+               };\r
        \r
-               \r
-};\r
+       } // namespace Msg \r
+} // namespace SimGrid\r
 \r
-}\r
+typedef Task* TaskPtr;\r
 \r
 #endif // §MSG_TASK_HPP
\ No newline at end of file