Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Examples of CPP versions of Msg
[simgrid.git] / examples / cxx / ping_pong / PingPongTask.hpp
diff --git a/examples/cxx/ping_pong/PingPongTask.hpp b/examples/cxx/ping_pong/PingPongTask.hpp
new file mode 100644 (file)
index 0000000..53cc4d8
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef PINGPONG_TASK_HPP\r
+#define PINGPONG_TASK_HPP\r
+\r
+#include <Task.hpp>\r
+using namespace SimGrid::Msg;\r
+\r
+class PingPongTask : public Task\r
+{\r
+       MSG_DECLARE_DYNAMIC(PingPongTask);\r
+\r
+public:\r
+\r
+       PingPongTask()\r
+       :Task(NULL, 0.0, 0.0){}\r
+       \r
+       // Default constructor.\r
+       PingPongTask(const char* name, double computeDuration, double messageSize)\r
+       throw (InvalidArgumentException, NullPointerException)\r
+       :Task(name, computeDuration, messageSize){}\r
+       \r
+       // Destructor\r
+       virtual ~PingPongTask() {}\r
+       \r
+       void setTime(double timeVal)\r
+       {\r
+               this->timeVal = timeVal;\r
+       }\r
+       \r
+       double getTime() \r
+       {\r
+               return timeVal;\r
+       }\r
+       \r
+private :\r
+       \r
+       double timeVal;\r
+};\r
+\r
+\r
+#endif // !PINGPONG_TASK_HPP
\ No newline at end of file