Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some code refactoring
[simgrid.git] / src / cxx / Host.hpp
index 881bebb..0228097 100644 (file)
@@ -54,7 +54,12 @@ catch(HostNotFoundException e)
 \r
 #include <msg/datatypes.h>\r
 \r
-#include <Config.hpp>\r
+#include <InvalidArgumentException.hpp>\r
+#include <BadAllocException.hpp>\r
+#include <HostNotFoundException.hpp>\r
+#include <MsgException.hpp>\r
+#include <NullPointerException.hpp>\r
+\r
 \r
 \r
 // namespace SimGrid::Msg\r
@@ -62,19 +67,14 @@ namespace SimGrid
 {\r
        namespace Msg\r
        {\r
-               class InvalidArgumentException;\r
-               class BadAllocException;\r
-               class HostNotFoundException;\r
-               class MsgException;\r
-\r
                class Task;\r
                class Process;\r
 \r
                // Declaration of the class SimGrid::Msg::Host.\r
                class SIMGRIDX_EXPORT Host // final class.\r
                {\r
-                       friend Process;\r
-                       friend Task;\r
+                       friend class Process;\r
+                       friend class Task;\r
 \r
                        // Desable the default constructor.\r
                        // The best way to get an host instance is to use the static method Host::getByName().\r
@@ -112,7 +112,7 @@ namespace SimGrid
                                 *                                      [BadAllocException]                     if there is not enough memory to allocate the host.\r
                                 */ \r
                                static Host& getByName(const char* hostName)\r
-                               throw(HostNotFoundException, InvalidArgumentException, BadAllocException);\r
+                               throw(HostNotFoundException, NullPointerException, BadAllocException);\r
                                \r
                                /*! \brief Host::getNumber() - returns the number of the installed hosts.\r
                                 *\r
@@ -128,8 +128,7 @@ namespace SimGrid
                                 *\r
                                 * \see                         Process::currentProcess().\r
                                 */\r
-                               static Host& currentHost(void)\r
-                               throw(InvalidArgumentException, BadAllocException);\r
+                               static Host& currentHost(void);\r
                                \r
                                /*! \brief Host::all() - This static method retrieves all of the hosts of the installed platform.\r
                                 *\r
@@ -195,7 +194,8 @@ namespace SimGrid
                                 *      delete[] ar;\r
                                 *\r
                                 */ \r
-                               static void all(Host*** hosts /*in|out*/, int* len /*in|out*/);\r
+                               static void all(Host*** hosts /*in|out*/, int* len /*in|out*/)\r
+                               throw(InvalidArgumentException, BadAllocException) ;\r
                                \r
                                /*! \brief Host::getName() - This method return the name of the Msg host object.\r
                                 *\r
@@ -257,10 +257,7 @@ namespace SimGrid
                                 *                                      [InvalidArgumentException]      if the value of the channel specified as\r
                                 *                                                                                              parameter is negative.\r
                                 */\r
-                               void put(int channel, const Task& rTask)\r
-                               throw(MsgException, InvalidArgumentException);\r
-\r
-                               void Host::put(int channel, Task* task) \r
+                               void put(int channel, Task* task) \r
                                throw(MsgException, InvalidArgumentException);\r
                                \r
                                /* ! \brief Host::put() - put a task on the given channel of a host object (waiting at most timeout seconds).\r
@@ -280,7 +277,7 @@ namespace SimGrid
                                 *\r
                                 * \remark                      To specify no timeout set the timeout value with -1.0.\r
                                 */\r
-                               void put(int channel, const Task& rTask, double timeout) \r
+                               void put(int channel, Task* task, double timeout) \r
                                throw(MsgException, InvalidArgumentException);\r
                                \r
                                /* ! \brief Host::putBounded() - put a task on the given channel of a host object (capping the emission rate to maxrate).\r
@@ -300,7 +297,7 @@ namespace SimGrid
                                 *\r
                                 * \remark                      To specify no rate set the maxRate parameter value with -1.0.\r
                                 */\r
-                               void putBounded(int channel, const Task& rTask, double maxRate) \r
+                               void putBounded(int channel, Task* task, double maxRate) \r
                                throw(MsgException, InvalidArgumentException);\r
                                \r
                                /* ! brief Host::send() - sends the given task to mailbox identified by the default alias.\r
@@ -314,8 +311,8 @@ namespace SimGrid
                                 *                                                                                              the default alias variable.\r
                                 *                                      [MsgException]                          if an internal error occurs.\r
                                 */\r
-                               void send(const Task& rTask) \r
-                               throw(BadAllocException, MsgException);\r
+                               void send(Task* task) \r
+                               throw(MsgException, BadAllocException);\r
                                \r
                                /* ! brief Host::send() - sends the given task to mailbox identified by the specified alias parameter.\r
                                 *\r
@@ -330,8 +327,8 @@ namespace SimGrid
                                 *                                                                                              the default alias variable.\r
                                 *                                      [MsgException]                          if an internal error occurs.\r
                                 */\r
-                               void send(const char* alias, const Task& rTask) \r
-                               throw(InvalidArgumentException, BadAllocException, MsgException);\r
+                               void send(const char* alias, Task* task) \r
+                               throw(InvalidArgumentException, MsgException);\r
                                \r
                                /* ! brief Host::send() - sends the given task to mailbox identified by the default alias\r
                                 *  (waiting at most timeout seconds).\r
@@ -352,8 +349,8 @@ namespace SimGrid
                                 *                                      version of this method.\r
                                 *\r
                                 */\r
-                               void send(const Task& rTask, double timeout) \r
-                               throw(MsgException);\r
+                               void send(Task* task, double timeout) \r
+                               throw(InvalidArgumentException, BadAllocException, MsgException);\r
                                \r
                                /* ! brief Host::send() - sends the given task to mailbox identified by the parameter alias\r
                                 *  (waiting at most timeout seconds).\r
@@ -373,7 +370,7 @@ namespace SimGrid
                                 *                                      version of this method.\r
                                 *\r
                                 */\r
-                               void send(const char* alias, const Task& rTask, double timeout) \r
+                               void send(const char* alias, Task* task, double timeout) \r
                                throw(InvalidArgumentException, MsgException);\r
                                \r
                                /* ! brief Host::sendBounded() - sends the given task to mailbox associated to the default alias\r
@@ -394,7 +391,7 @@ namespace SimGrid
                                 * \remark                      To specify no rate set its value with -1.0.\r
                                 *\r
                                 */\r
-                               void sendBounded(const Task& rTask, double maxRate) \r
+                               void sendBounded(Task* task, double maxRate) \r
                                throw(InvalidArgumentException, BadAllocException, MsgException);\r
                                \r
                                /* ! brief Host::sendBounded() - sends the given task to mailbox identified by the parameter alias\r
@@ -414,7 +411,7 @@ namespace SimGrid
                                 * \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
+                               void sendBounded(const char* alias, Task* task, double maxRate) \r
                                throw(InvalidArgumentException, MsgException);\r
                        \r
                        protected:\r
@@ -440,4 +437,4 @@ namespace SimGrid
        } // namespace Msg\r
 } // namespace SimGrid\r
 \r
-#endif // !MSG_HOST_HPP
\ No newline at end of file
+#endif // !MSG_HOST_HPP\r