Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add comment and exception mechanism to the Host class.
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 16 May 2008 09:52:21 +0000 (09:52 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 16 May 2008 09:52:21 +0000 (09:52 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5432 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/cxx/Host.cxx
src/cxx/Host.hpp

index 8cb4a08..07ec58c 100644 (file)
+/*\r
+ * Host.cxx\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
+ /* Host class member functions implementation.\r
+  */  \r
 #include <Host.hpp>\r
 \r
 namespace SimGrid\r
 {\r
-namespace Msg\r
-{\r
-\r
-\r
-Host::Host()\r
-{\r
-       nativeHost = NULL;\r
-       data = NULL;\r
-}\r
-\r
-Host::Host(const Host& rHost)\r
-{\r
-       this->nativeHost = rHost.nativeHost;\r
-       this->data = rHost.getData();   \r
-}\r
-\r
-Host::~Host()\r
-{\r
-       // NOTHING TODO\r
-}\r
-\r
-\r
-Host& Host::getByName(const char* hostName)\r
-throw(HostNotFoundException, InvalidParameterException, BadAllocException)\r
-{\r
-       // check the parameters\r
-       if(!hostName)\r
-               throw InvalidParmeterException("hostName");\r
+       namespace Msg\r
+       {\r
+               Host::Host()\r
+               {\r
+                       nativeHost = NULL;\r
+                       data = NULL;\r
+               }\r
                \r
-       m_host_t nativeHost = NULL;     // native host.\r
-       Host* host = NULL;                      // wrapper host.\r
-       \r
-       if(!(nativeHost = MSG_get_host_by_name(hostName))) \r
-               throw HostNotFoundException(hostName);\r
-       \r
-       if(!nativeHost->data) \r
-       { // native host not associated yet with  its wrapper\r
-       \r
-               // instanciate a new wrapper \r
-               if(!(host = new Host())\r
-                       throw BadAllocException(hostName);\r
+               Host::Host(const Host& rHost)\r
+               {\r
+                       this->nativeHost = rHost.nativeHost;\r
+                       this->data = rHost.getData();   \r
+               }\r
                \r
-               host->nativeHost = nativeHost; \r
-       \r
-               // the native host data field is set with its wrapper returned \r
-               nativeHost->data = (void*)host;\r
-       }\r
-       \r
-       // return the reference to cxx wrapper\r
-       return *((Host*)nativeHost->data);                              \r
-}\r
-\r
-int Host::getNumber(void)\r
-{\r
-       return MSG_get_host_number();\r
-}\r
-\r
-Host& Host::currentHost(void)\r
-{\r
-       Host* host = NULL;\r
-       m_host_t nativeHost = MSG_host_self();\r
-       \r
-       if(!nativeHost->data) \r
-       {\r
-               // the native host not yet associated with its wrapper\r
-       \r
-               // instanciate a new wrapper\r
-               host = new Host();\r
-       \r
-               host->nativeHost = nativeHost;\r
-       \r
-               nativeHost->data = (void*)host;\r
-       } \r
-       else \r
-       {\r
-               host = (Host*)nativeHost->data;\r
-       }\r
-       \r
-       return *host;\r
-}\r
-\r
-void Host::all(Host*** hosts, int* len) \r
-throw(InvalidParameterException, BadAllocException) \r
-{\r
-       /* check the parameters */\r
-       if(!hosts)\r
-               throw InvalidParameterException("hosts");\r
+               Host::~Host()\r
+               {\r
+                       // NOTHING TODO\r
+               }\r
                \r
-       if(len < 0)\r
-               throw InvalidParameterException("len parameter must be positive");\r
-       \r
-       int count = xbt_fifo_size(msg_global->host);\r
-       \r
-       if(*len < count)\r
-               throw InvalidParameterException("len parameter must be more than the number of installed host\n (use Host::getNumber() to get the number of hosts)");\r
-       \r
-       int index;\r
-       m_host_t nativeHost;\r
-       Host* host;\r
-\r
-       m_host_t* table = (m_host_t *)xbt_fifo_to_array(msg_global->host);\r
-       \r
-       for(index = 0; index < count; index++) \r
-       {\r
-               nativeHost = table[index];\r
-               host = (Host*)(nativeHost->data);\r
-       \r
-               if(!host) \r
+               \r
+               Host& Host::getByName(const char* hostName)\r
+               throw(HostNotFoundException, InvalidParameterException, BadAllocException)\r
                {\r
-                       if(!(host = new Host())\r
-                       {\r
-                               // release all allocated memory.\r
-                               for(int i = 0; i < index; i++)\r
-                                       delete (*(hosts)[i]);\r
+                       // check the parameters\r
+                       if(!hostName)\r
+                               throw InvalidParmeterException("hostName");\r
+                               \r
+                       m_host_t nativeHost = NULL;     // native host.\r
+                       Host* host = NULL;                      // wrapper host.\r
+                       \r
+                       if(!(nativeHost = MSG_get_host_by_name(hostName))) \r
+                               throw HostNotFoundException(hostName);\r
+                       \r
+                       if(!nativeHost->data) \r
+                       { // native host not associated yet with  its wrapper\r
+                       \r
+                               // instanciate a new wrapper \r
+                               if(!(host = new Host())\r
+                                       throw BadAllocException(hostName);\r
                                \r
-                               throw BadAllocException("to fill the table of the hosts installed on your platform");\r
+                               host->nativeHost = nativeHost; \r
+                       \r
+                               // the native host data field is set with its wrapper returned \r
+                               nativeHost->data = (void*)host;\r
                        }\r
                        \r
-                       host->nativeHost = nativeHost;\r
-                       nativeHost->data = (void*)host;\r
+                       // return the reference to cxx wrapper\r
+                       return *((Host*)nativeHost->data);                              \r
                }\r
                \r
-               (*hosts)[index] = host;\r
-  }\r
-\r
-  *len = count;  \r
-}\r
-\r
-\r
-const char* Host::getName(void) const\r
-{\r
-       return nativeHost->name;\r
-}\r
-\r
-\r
-void Host::setData(void* data)\r
-{\r
-       this->data = data;\r
-}\r
-\r
-// Getters/setters\r
-\r
-void* Host::getData(void) const\r
-{\r
-       return this->data;\r
-}\r
-\r
-int Host::getRunningTaskNumber(void) const\r
-{\r
-       return MSG_get_host_msgload(nativeHost); \r
-}\r
-\r
-double Host::getSpeed(void) const\r
-{\r
-       return MSG_get_host_speed(nativeHost->simdata->smx_host);\r
-}\r
-\r
-bool Host::hasData(void) const\r
-{\r
-       return (NULL != this->data);\r
-}\r
-\r
-bool Host::isAvailable(void) const\r
-{\r
-       return (bool)SIMIX_host_get_state(nativeHost->simdata->smx_host);\r
-}\r
-\r
-void Host::put(int channel, const Task& rTask) \r
-throw(NativeException)\r
-{\r
-       if(MSG_OK != MSG_task_put_with_timeout(rTask.nativeTask, nativeHost, channel , -1.0))\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-} \r
-\r
-void Host::put(int channel, const Task& rTask, double timeout) \r
-throw(NativeException) \r
-{\r
-    if(MSG_OK != MSG_task_put_with_timeout(rTask.nativeTask, nativeHost, channel , timeout))\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-}\r
-\r
-void Host::putBounded(int channel, const Task& rTask, double maxRate) \r
-throw(NativeException)\r
-{\r
-    MsgNative.hostPutBounded(this, channel, task, maxrate);\r
-    \r
-       if(MSG_OK != MSG_task_put_bounded(rTask.nativeTask, nativeHost, channel, maxRate))\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-}\r
-\r
-void Host::send(const Task& rTask) \r
-throw(NativeException)  \r
-{      \r
-       MSG_error_t rv;\r
-       \r
-       char* alias = (char*)calloc(strlen(this->getName() + strlen(Process::currentProcess().getName()) + 2);\r
-       sprintf(alias,"%s:%s", this->getName(),Process::currentProcess().getName());\r
+               int Host::getNumber(void)\r
+               {\r
+                       return MSG_get_host_number();\r
+               }\r
                \r
+               Host& Host::currentHost(void)\r
+               {\r
+                       Host* host = NULL;\r
+                       m_host_t nativeHost = MSG_host_self();\r
+                       \r
+                       if(!nativeHost->data) \r
+                       {\r
+                               // the native host not yet associated with its wrapper\r
+                       \r
+                               // instanciate a new wrapper\r
+                               host = new Host();\r
+                       \r
+                               host->nativeHost = nativeHost;\r
+                       \r
+                               nativeHost->data = (void*)host;\r
+                       } \r
+                       else \r
+                       {\r
+                               host = (Host*)nativeHost->data;\r
+                       }\r
+                       \r
+                       return *host;\r
+               }\r
                \r
-       rv = MSG_task_send_with_timeout(rTask.nativeTask, alias, -1.0);\r
-       \r
-       free(alias);\r
-       \r
-       if(MSG_OK != rv)\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-} \r
-\r
-void Host::send(const char* alias, const Task& rTask) \r
-throw(NativeException) \r
-{\r
-       \r
-       if(MSG_OK != MSG_task_send_with_timeout(rTask.nativeTask, alias, -1.0))\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-}\r
-\r
-void Host::send(const Task& rTask, double timeout) \r
-throw(NativeException) \r
-{\r
-       MSG_error_t rv;\r
-       \r
-       char* alias = (char*)calloc(strlen(this->getName() + strlen(Process::currentProcess().getName()) + 2);\r
-       sprintf(alias,"%s:%s", this->getName(),Process::currentProcess().getName());\r
+               void Host::all(Host*** hosts, int* len) \r
+               throw(InvalidParameterException, BadAllocException) \r
+               {\r
+                       /* check the parameters */\r
+                       if(!hosts)\r
+                               throw InvalidParameterException("hosts");\r
+                               \r
+                       if(len < 0)\r
+                               throw InvalidParameterException("len parameter must be positive");\r
+                       \r
+                       int count = xbt_fifo_size(msg_global->host);\r
+                       \r
+                       if(*len < count)\r
+                               throw InvalidParameterException("len parameter must be more than the number of installed host\n (use Host::getNumber() to get the number of hosts)");\r
+                       \r
+                       int index;\r
+                       m_host_t nativeHost;\r
+                       Host* host;\r
                \r
+                       m_host_t* table = (m_host_t *)xbt_fifo_to_array(msg_global->host);\r
+                       \r
+                       for(index = 0; index < count; index++) \r
+                       {\r
+                               nativeHost = table[index];\r
+                               host = (Host*)(nativeHost->data);\r
+                       \r
+                               if(!host) \r
+                               {\r
+                                       if(!(host = new Host())\r
+                                       {\r
+                                               // release all allocated memory.\r
+                                               for(int i = 0; i < index; i++)\r
+                                                       delete (*(hosts)[i]);\r
+                                               \r
+                                               throw BadAllocException("to fill the table of the hosts installed on your platform");\r
+                                       }\r
+                                       \r
+                                       host->nativeHost = nativeHost;\r
+                                       nativeHost->data = (void*)host;\r
+                               }\r
+                               \r
+                               (*hosts)[index] = host;\r
+                 }\r
                \r
-       rv = MSG_task_send_with_timeout(rTask.nativeTask, alias, timeout);\r
-       \r
-       free(alias);\r
-       \r
-       if(MSG_OK != rv)\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-}\r
-\r
-void Host::send(const char* alias, const Task& rTask, double timeout) \r
-throw(NativeException) \r
-{\r
-       if(MSG_OK != MSG_task_send_with_timeout(rTask.nativeTask, alias, timeout))\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-}\r
-\r
-\r
-void Host::sendBounded(const Task& rTask, double maxRate) \r
-throw(NativeException) \r
-{\r
-       \r
-       MSG_error_t rv;\r
-       \r
-       char* alias = (char*)calloc(strlen(this->getName() + strlen(Process::currentProcess().getName()) + 2);\r
-       sprintf(alias,"%s:%s", this->getName(),Process::currentProcess().getName());\r
+                 *len = count;  \r
+               }\r
                \r
-       rv = MSG_task_send_bounded(rTask.nativeTask, alias, maxRate);\r
-       \r
-       free(alias);\r
-       \r
-       if(MSG_OK != rv)\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-}  \r
-\r
-void Host::sendBounded(const char* alias, const Task& rTask, double maxRate) \r
-throw(NativeException) \r
-{\r
-       if(MSG_OK != MSG_task_send_bounded(rTask.nativeTask, alias, maxRate))\r
-       {\r
-               // TODO throw NativeException\r
-       }\r
-} \r
-\r
-       \r
-} // namspace Msg\r
+               const char* Host::getName(void) const\r
+               {\r
+                       return nativeHost->name;\r
+               }\r
+               \r
+               void Host::setData(void* data)\r
+               {\r
+                       this->data = data;\r
+               }\r
+               \r
+               void* Host::getData(void) const\r
+               {\r
+                       return this->data;\r
+               }\r
+               \r
+               int Host::getRunningTaskNumber(void) const\r
+               {\r
+                       return MSG_get_host_msgload(nativeHost); \r
+               }\r
+               \r
+               double Host::getSpeed(void) const\r
+               {\r
+                       return MSG_get_host_speed(nativeHost->simdata->smx_host);\r
+               }\r
+               \r
+               bool Host::hasData(void) const\r
+               {\r
+                       return (NULL != this->data);\r
+               }\r
+               \r
+               bool Host::isAvailable(void) const\r
+               {\r
+                       return (bool)SIMIX_host_get_state(nativeHost->simdata->smx_host);\r
+               }\r
+               \r
+               void Host::put(int channel, const Task& rTask) \r
+               throw(MsgException, InvalidParameterException)\r
+               {\r
+                       // checks the parameters\r
+                       if(channel < 0)\r
+                               throw InvalidParameterException("channel (must be more or equal to zero)");\r
+                               \r
+                       if(MSG_OK != MSG_task_put_with_timeout(rTask.nativeTask, nativeHost, channel , -1.0))\r
+                               throw MsgException("MSG_task_put_with_timeout() failed");\r
+               } \r
+               \r
+               void Host::put(int channel, const Task& rTask, double timeout) \r
+               throw(MsgException, InvalidParameterException) \r
+               {\r
+                       // checks the parameters\r
+                       if(channel < 0)\r
+                               throw InvalidParameterException("channel (must be more or equal to zero)");\r
+                               \r
+                       if(timeout < 0.0 && timeout != -1.0)\r
+                               throw InvalidParameterException("timeout (must be more or equal to zero or equal to -1.0)");    \r
+                               \r
+                               \r
+                   if(MSG_OK != MSG_task_put_with_timeout(rTask.nativeTask, nativeHost, channel , timeout))\r
+                               throw MsgException("MSG_task_put_with_timeout() failed");\r
+               }\r
+               \r
+               void Host::putBounded(int channel, const Task& rTask, double maxRate) \r
+               throw(MsgException, InvalidParameterException)\r
+               {\r
+                   // checks the parameters\r
+                       if(channel < 0)\r
+                               throw InvalidParameterException("channel (must be more or equal to zero)");\r
+                               \r
+                       if(maxRate < 0.0 && maxRate != -1.0)\r
+                               throw InvalidParameterException("maxRate (must be more or equal to zero or equal to -1.0)");    \r
+                   \r
+                       if(MSG_OK != MSG_task_put_bounded(rTask.nativeTask, nativeHost, channel, maxRate))\r
+                               throw MsgException("MSG_task_put_bounded() failed");\r
+               }\r
+               \r
+               void Host::send(const Task& rTask) \r
+               throw(NativeException)  \r
+               {       \r
+                       MSG_error_t rv;\r
+                       \r
+                       char* alias = (char*)calloc(strlen(this->getName() + strlen(Process::currentProcess().getName()) + 2);\r
+                               \r
+                       if(!alias)\r
+                               throw BadAllocException("alias");\r
+                               \r
+                       sprintf(alias,"%s:%s", this->getName(),Process::currentProcess().getName());\r
+                               \r
+                       rv = MSG_task_send_with_timeout(rTask.nativeTask, alias, -1.0);\r
+                       \r
+                       free(alias);\r
+                       \r
+                       if(MSG_OK != rv)\r
+                               throw MsgException("MSG_task_send_with_timeout() failed");\r
+               } \r
+               \r
+               void Host::send(const char* alias, const Task& rTask) \r
+               throw(InvalidParameterException, MsgException) \r
+               {\r
+                       // check the parameters\r
+                       if(!alias)\r
+                               throw InvalidParmeterException("alias (must not be NULL)");\r
+                       \r
+                       if(MSG_OK != MSG_task_send_with_timeout(rTask.nativeTask, alias, -1.0))\r
+                               throw MsgException("MSG_task_send_with_timeout() failed");\r
+               }\r
+               \r
+               void Host::send(const Task& rTask, double timeout) \r
+               throw(InvalidParameterException, BadAllocException, MsgException) \r
+               {\r
+                       // check the parameters\r
+                       if(timeout < 0 && timeout != -1.0)\r
+                               throw InvalidParameterException("timeout (must be positive or equal to zero or equal to -1.0)");\r
+                       MSG_error_t rv;\r
+                       \r
+                       char* alias = (char*)calloc(strlen(this->getName() + strlen(Process::currentProcess().getName()) + 2);\r
+                               \r
+                       if(!alias)\r
+                               throw BadAllocException("alias");\r
+                               \r
+                       sprintf(alias,"%s:%s", this->getName(),Process::currentProcess().getName());\r
+                               \r
+                               \r
+                       rv = MSG_task_send_with_timeout(rTask.nativeTask, alias, timeout);\r
+                       \r
+                       free(alias);\r
+                       \r
+                       if(MSG_OK != rv)\r
+                               throw MsgException("MSG_task_send_with_timeout() failed");\r
+               }\r
+               \r
+               void Host::send(const char* alias, const Task& rTask, double timeout) \r
+               throw(InvalidParameterException, MsgException) \r
+               {\r
+                       // check the parameter\r
+                       \r
+                       if(!alias)\r
+                               throw InvalidParmeterException("alias (must not be NULL)");\r
+                               \r
+                       if(timeout < 0 && timeout != -1.0)\r
+                               throw InvalidParameterException("timeout (must be positive or equal to zero or equal to -1.0)");\r
+                                       \r
+                       if(MSG_OK != MSG_task_send_with_timeout(rTask.nativeTask, alias, timeout))\r
+                               throw MsgException("MSG_task_send_with_timeout() failed");\r
+               }\r
+               \r
+               \r
+               void Host::sendBounded(const Task& rTask, double maxRate) \r
+               throw(InvalidParameterException, BadAllocException, MsgException) \r
+               {\r
+                       if(maxRate < 0 && maxRate != -1.0)\r
+                               throw InvalidParameterException("maxRate (must be positive or equal to zero or equal to -1.0)");\r
+                       \r
+                       MSG_error_t rv;\r
+                       \r
+                       char* alias = (char*)calloc(strlen(this->getName() + strlen(Process::currentProcess().getName()) + 2);\r
+                       \r
+                       if(!alias)\r
+                               throw BadAllocException("alias");\r
+                               \r
+                       sprintf(alias,"%s:%s", this->getName(),Process::currentProcess().getName());\r
+                               \r
+                       rv = MSG_task_send_bounded(rTask.nativeTask, alias, maxRate);\r
+                       \r
+                       free(alias);\r
+                       \r
+                       if(MSG_OK != rv)\r
+                               throw MsgException("MSG_task_send_bounded() failed");\r
+               }  \r
+               \r
+               void Host::sendBounded(const char* alias, const Task& rTask, double maxRate) \r
+               throw(InvalidParameterException, MsgException) \r
+               {\r
+                       // check the parameters\r
+                       if(!alias)\r
+                               throw InvalidParameterException("alias (must not be NULL)");\r
+                       \r
+                       if(maxRate < 0 && maxRate != -1)\r
+                               throw InvalidParameterException("maxRate (must be positive or equal to zero or equal to -1.0)");\r
+                       \r
+                       if(MSG_OK != MSG_task_send_bounded(rTask.nativeTask, alias, maxRate))\r
+                               throw MsgException("MSG_task_send_bounded() failed");\r
+                       \r
+               } \r
+       } // namspace Msg\r
 } // namespace SimGrid
\ No newline at end of file
index e8b2854..53ca4df 100644 (file)
@@ -55,6 +55,7 @@ catch(HostNotFoundException e)
 #include <InvalidArgumentException.hpp>\r
 #include <BadAllocException.hpp>\r
 #include <HostNotFoundException.hpp>\r
+#include <MsgException.hpp>\r
 \r
 // namespace SimGrid::Msg\r
 namespace SimGrid\r
@@ -62,7 +63,7 @@ namespace SimGrid
        namespace Msg\r
        {\r
                // Declaration of the class SimGrid::Msg::Host.\r
-               class Host\r
+               class Host // final class.\r
                {\r
                        // Desable the default constructor.\r
                        // The best way to get an host instance is to use the static method Host::getByName().\r
@@ -185,53 +186,222 @@ namespace SimGrid
                                 */ \r
                                static void all(Host*** hosts /*in|out*/, int* len /*in|out*/);\r
                                \r
-                               \r
+                               /*! \brief Host::getName() - This method return the name of the Msg host object.\r
+                                *\r
+                                * \return                      The name of the host object.\r
+                                */\r
                                const char* getName(void) const;\r
                                \r
+                               /*! \brief Host::setData() - Set the user data of an host object.\r
+                                *\r
+                                * \param data          The user data to set.\r
+                                */\r
                                void setData(void* data);\r
                                \r
-                               // Getters/setters\r
-                               \r
+                               /*! \brief Host::getData() - Get the user data of a host object.\r
+                                *\r
+                                * \return                      The user data of the host object.\r
+                                */\r
                                void* getData(void) const;\r
                                \r
-                               int Host::getRunningTaskNumber(void) const;\r
+                               /*! \brief Host::hasData() - Test if an host object has some data.\r
+                                *\r
+                                * \return                      This method returns true if the host object has some user data.\r
+                                *                                      Otherwise the method returns false.\r
+                                */\r
+                               bool hasData(void) const;\r
                                \r
-                               double getSpeed(void) const;\r
+                               /*! \brief Host::getRunningTaskNumber() - returns the number of tasks currently running on a host.\r
+                                *\r
+                                * \return                      The number of task currently running of the host object.\r
+                                *\r
+                                * \remark                      The external load is not taken in account.\r
+                                */\r
+                               int getRunningTaskNumber(void) const;\r
                                \r
-                               bool hasData(void) const;\r
+                               /*! \brief Host::getSpeed() - returns the speed of the processor of a host,\r
+                                * regardless of the current load of the machine.\r
+                                *\r
+                                * \return                      The speed of the processor of the host in flops.\r
+                                */ \r
+                               double getSpeed(void) const;\r
                                \r
+                               /*! \brief Host::isAvailable - tests if an host is availabled.\r
+                                * \r
+                                * \return                      Is the host is availabled the method returns\r
+                                *                                      true. Otherwise the method returns false.\r
+                                */ \r
                                bool isAvailble(void) const;\r
                                \r
+                               /* ! \brief Host::put() - put a task on the given channel of a host .\r
+                                *\r
+                                * \param channel       The channel where to put the task.\r
+                                * \param rTask         A refercence to the task object containing the native task to\r
+                                *                                      put on the channel specified by the parameter channel.\r
+                                *\r
+                                * \return                      If successful the task is puted on the specified channel. Otherwise\r
+                                *                                      the method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [MsgException]                          if an internal error occurs.\r
+                                *                                      [InvalidParameterException]     if the value of the channel specified as\r
+                                *                                                                                              parameter is negative.\r
+                                */\r
                                void put(int channel, const Task& rTask)\r
-                               throw(NativeException);\r
+                               throw(MsgException, InvalidParameterException);\r
                                \r
+                               /* ! \brief Host::put() - put a task on the given channel of a host object (waiting at most timeout seconds).\r
+                                *\r
+                                * \param channel       The channel where to put the task.\r
+                                * \param rTask         A refercence to the task object containing the native task to\r
+                                *                                      put on the channel specified by the parameter channel.\r
+                                * \param timeout       The timeout in seconds.\r
+                                *\r
+                                * \return                      If successful the task is puted on the specified channel. Otherwise\r
+                                *                                      the method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [MsgException]                          if an internal error occurs.\r
+                                *                                      [InvalidParameterException]     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                      To specify no timeout set the timeout value with -1.0.\r
+                                */\r
                                void put(int channel, Task task, double timeout) \r
-                               throw(NativeException);\r
+                               throw(MsgException, InvalidParameterException);\r
                                \r
+                               /* ! \brief Host::putBounded() - put a task on the given channel of a host object (capping the emission rate to maxrate).\r
+                                *\r
+                                * \param channel       The channel where to put the task.\r
+                                * \param rTask         A refercence to the task object containing the native task to\r
+                                *                                      put on the channel specified by the parameter channel.\r
+                                * \param maxRate       The maximum rate.\r
+                                *\r
+                                * \return                      If successful the task is puted on the specified channel. Otherwise\r
+                                *                                      the method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [MsgException]                          if an internal error occurs.\r
+                                *                                      [InvalidParameterException]     if the value of the channel specified as\r
+                                *                                                                                              parameter is negative or if the maxRate parameter value\r
+                                *                                                                                              is less than zero and diffĂ©rent of -1.0.\r
+                                *\r
+                                * \remark                      To specify no rate set the maxRate parameter value with -1.0.\r
+                                */\r
                                void Host::putBounded(int channel, const Task& rTask, double maxRate) \r
-                               throw(NativeException);\r
-                               \r
+                               throw(MsgException, InvalidParameterException);\r
                                \r
+                               /* ! brief Host::send() - sends the given task to mailbox identified by the default alias.\r
+                                *\r
+                                * \param rTask         A reference to the task object containing the native msg task to send.\r
+                                *\r
+                                * \return                      If successful the task is sended to the default mailbox. Otherwise the\r
+                                *                                      method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [BadAllocException]                     if there is not enough memory to allocate\r
+                                *                                                                                              the default alias variable.\r
+                                *                                      [MsgException]                          if an internal error occurs.\r
+                                */\r
                                void send(const Task& rTask) \r
-                               throw(NativeException);\r
+                               throw(BadAllocException, MsgException);\r
                                \r
+                               /* ! brief Host::send() - sends the given task to mailbox identified by the specified alias parameter.\r
+                                *\r
+                                * \param rTask         A reference to the task object containing the native msg task to send.\r
+                                * \param alias         The alias of the mailbox where to send the task.\r
+                                *\r
+                                * \return                      If successful the task is sended to the default mailbox. Otherwise the\r
+                                *                                      method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [InvalidParameterException]     if alias parameter is invalid (NULL).\r
+                                *                                      [BadAllocException]                     if there is not enough memory to allocate\r
+                                *                                                                                              the default alias variable.\r
+                                *                                      [MsgException]                          if an internal error occurs.\r
+                                */\r
                                void send(const char* alias, const Task& rTask) \r
-                               throw(NativeException);\r
+                               throw(InvalidParameterException, BadAllocException, MsgException);\r
                                \r
+                               /* ! brief Host::send() - sends the given task to mailbox identified by the default alias\r
+                                *  (waiting at most timeout seconds).\r
+                                *\r
+                                * \param rTask         A reference to the task object containing the native msg task to send.\r
+                                * \param timeout       The timeout value to wait for.\r
+                                *\r
+                                * \return                      If successful the task is sended to the default mailbox. Otherwise the\r
+                                *                                      method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [BadAllocException]                     if there is not enough memory to allocate\r
+                                *                                                                                              the default alias variable.\r
+                                *                                      [InvalidParameterException]     if the timeout value is negative and different of\r
+                                *                                                                                              -1.0.                   \r
+                                *                                      [MsgException]                          if an internal error occurs.\r
+                                *\r
+                                * \remark                      To specify no timeout set the timeout value with -1.0 or use the previous \r
+                                *                                      version of this method.\r
+                                *\r
+                                */\r
                                void send(const Task& rTask, double timeout) \r
                                throw(NativeException);\r
                                \r
+                               /* ! brief Host::send() - sends the given task to mailbox identified by the parameter alias\r
+                                *  (waiting at most timeout seconds).\r
+                                *\r
+                                * \param alias         The alias of the mailbox to send the task.\r
+                                * \param rTask         A reference to the task object containing the native msg task to send.\r
+                                * \param timeout       The timeout value to wait for.\r
+                                *\r
+                                * \return                      If successful the task is sended to the default mailbox. Otherwise the\r
+                                *                                      method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [InvalidParameterException]     if the timeout value is negative and different of\r
+                                *                                                                                              -1.0 or if the alias parameter is invalid (NULL).                       \r
+                                *                                      [MsgException]                          if an internal error occurs.\r
+                                *\r
+                                * \remark                      To specify no timeout set the timeout value with -1.0 or use the previous \r
+                                *                                      version of this method.\r
+                                *\r
+                                */\r
                                void send(const char* alias, const Task& rTask, double timeout) \r
-                               throw(NativeException);\r
+                               throw(InvalidParameterException, MsgException);\r
                                \r
+                               /* ! brief Host::sendBounded() - sends the given task to mailbox associated to the default alias\r
+                                *  (capping the emission rate to maxRate).\r
+                                *\r
+                                * \param rTask         A reference to the task object containing the native msg task to send.\r
+                                * \param maxRate       The maximum rate value.\r
+                                *\r
+                                * \return                      If successful the task is sended to the default mailbox. Otherwise the\r
+                                *                                      method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [InvalidParameterException]     if the maximum rate value is negative and different of\r
+                                *                                                                                              -1.0.                   \r
+                                *                                      [MsgException]                          if an internal error occurs.\r
+                                *                                      [BadAllocException]                     if there is not enough memory to allocate\r
+                                *                                                                                              the default alias variable.\r
+                                *\r
+                                * \remark                      To specify no rate set its value with -1.0.\r
+                                *\r
+                                */\r
                                void sendBounded(const Task& rTask, double maxRate) \r
-                               throw(NativeException);\r
+                               throw(InvalidParameterException, BadAllocException, MsgException);\r
                                \r
+                               /* ! brief Host::sendBounded() - sends the given task to mailbox identified by the parameter alias\r
+                                *  (capping the emission rate to maxRate).\r
+                                *\r
+                                * \param alias         The alias of the mailbox where to send the task.\r
+                                * \param rTask         A reference to the task object containing the native msg task to send.\r
+                                * \param maxRate       The maximum rate value.\r
+                                *\r
+                                * \return                      If successful the task is sended to the default mailbox. Otherwise the\r
+                                *                                      method throws one of the exceptions described below.\r
+                                *\r
+                                * \exception           [InvalidParameterException]     if the maximum rate value is negative and different of\r
+                                *                                                                                              -1.0 or if the alias parameter is invalid (NULL).                       \r
+                                *                                      [MsgException]                          if an internal error occurs.\r
+                                *\r
+                                * \remark                      To specify no rate set its value with -1.0.\r
+                                *\r
+                                */\r
                                void sendBounded(const char* alias, const Task& rTask, double maxRate) \r
-                               throw(NativeException);\r
-                               \r
-                        \r
-                       \r
+                               throw(InvalidParameterException, MsgException);\r
                        \r
                        protected:\r
                        // Attributes.\r
@@ -241,7 +411,7 @@ namespace SimGrid
                                 * It is set automaticatly during the call of the static \r
                                 * method Host::getByName().\r
                                 *\r
-                                * @see                         Host::getByName().\r
+                                * \see                         Host::getByName().\r
                                 */ \r
                                m_host_t nativeHost;\r
                        \r