Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use pointers instead references.
[simgrid.git] / src / cxx / Task.hpp
index a158f4f..e78d9dd 100644 (file)
 \r
 #include <msg/datatypes.h>\r
 \r
-#include <Config.hpp>\r
+#include <MsgException.hpp>\r
+#include <InvalidArgumentException.hpp>\r
+#include <NullPointerException.hpp>\r
+#include <MsgException.hpp>\r
+#include <BadAllocException.hpp>\r
 \r
 #include <Object.hpp>\r
 \r
@@ -30,12 +34,6 @@ namespace SimGrid
 {\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
@@ -44,39 +42,12 @@ namespace SimGrid
                {\r
                        MSG_DECLARE_DYNAMIC(Task);\r
 \r
-                       friend Process;\r
-                       friend Host;\r
+                       friend class Process;\r
+                       friend class 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
@@ -191,9 +162,6 @@ namespace SimGrid
                                 *                                      \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
@@ -209,7 +177,7 @@ namespace SimGrid
                                 *\r
                                 *                                                      [MsgException]                          if an internal exception occurs.\r
                                 */\r
-                               static Task& get(int channel, const Host& rHost) \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
@@ -227,7 +195,7 @@ namespace SimGrid
                                 *                                                                                                              different than -1.0.\r
                                 *                                                      [MsgException]                          if an internal exception occurs.\r
                                 */\r
-                               static Task& get(int channel, double timeout, const Host& rHost) \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
@@ -424,7 +392,7 @@ namespace SimGrid
                                 *\r
                                 *                                                      [MsgException]                          if an internal exception occurs.\r
                                 */\r
-                               static Task& receive(const char* alias, double timeout) \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
@@ -441,7 +409,7 @@ namespace SimGrid
                                 *\r
                                 *                                                      [MsgException]                          if an internal exception occurs.\r
                                 */\r
-                               static Task& receive(const char* alias, const Host& rHost) \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
@@ -462,7 +430,7 @@ namespace SimGrid
                                 *\r
                                 *                                                      [MsgException]                          if an internal exception occurs.\r
                                 */\r
-                               static Task& receive(const char* alias, double timeout, const Host& rHost) \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
@@ -552,7 +520,7 @@ namespace SimGrid
                                 *                                                                                                              alias.\r
                                 */\r
                                static int listenFromHost(const char* alias, const Host& rHost) \r
-                               throw(NullPointerException, MsgException);\r
+                               throw(NullPointerException);\r
 \r
                                virtual const Task& operator= (const Task& rTask);\r
                        \r
@@ -561,8 +529,6 @@ namespace SimGrid
                                // Attributes.\r
                                \r
                                m_task_t nativeTask;    // the native MSG task.\r
-\r
-                               Ref* ref;\r
                };\r
        \r
        } // namespace Msg \r
@@ -570,4 +536,5 @@ namespace SimGrid
 \r
 typedef Task* TaskPtr;\r
 \r
-#endif // §MSG_TASK_HPP
\ No newline at end of file
+#endif // §MSG_TASK_HPP\r
+\r