Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
started of C++ wrappers for Msg
[simgrid.git] / src / cxx / Process.hpp
diff --git a/src/cxx/Process.hpp b/src/cxx/Process.hpp
new file mode 100644 (file)
index 0000000..1ee45b3
--- /dev/null
@@ -0,0 +1,148 @@
+#ifndef MSG_PROCESS_HPP\r
+#define MSG_PROCESS_HPP\r
+\r
+// Compilation C++ recquise\r
+#ifndef __cplusplus\r
+       #error Process.hpp requires C++ compilation (use a .cxx suffix)\r
+#endif\r
+\r
+namespace msg\r
+{\r
+       \r
+class Process\r
+{\r
+       \r
+       friend ApplicationHandler;\r
+       \r
+       private;\r
+       \r
+       // Default constructor.\r
+       Process();\r
+       \r
+       public:\r
+       \r
+       // Construct a process from the name of the host and its name.  \r
+       Process(const char* hostName, const char* name)\r
+       throw(HostNotFoundException);\r
+       \r
+       Process(const Host& rHost, const char* name)\r
+       throw(HostNotFoundException);\r
+       \r
+       Process(const char* hostName, const char* name, int argc, char** argv)\r
+       throw(HostNotFoundException);\r
+       \r
+       Process(const Host& rHost, const char* name, int argc, char** argv)\r
+       throw(HostNotFoundException);\r
+       \r
+       static int killAll(int resetPID);\r
+       \r
+       void Process::suspend(void)\r
+       throw(NativeException);\r
+       \r
+       void Process::resume(void) \r
+       throw(NativeException);\r
+       \r
+       bool isSuspended(void);\r
+       \r
+       Host& getHost(void) \r
+       throw(NativeException);\r
+       \r
+       static Process& fromPID(int PID); \r
+       \r
+       \r
+       int getPID(void);\r
+               \r
+       int getPPID(void);\r
+       \r
+       const char* getName(void) const;\r
+       \r
+       static Process& currentProcess(void);\r
+       \r
+       static int currentProcessPID(void);\r
+       \r
+       static int currentProcessPPID(void);\r
+       \r
+       void migrate(const Host& rHost)\r
+       throw(NativeException);\r
+       \r
+       static void sleep(double seconds)\r
+       throw(NativeException);\r
+       \r
+       void putTask(const Host& rHost, int channel, const Task& rTask)\r
+       throw( NativeException);\r
+       \r
+       void putTask(const Host& rHost, int channel, const Task& rTask, double timeout) \r
+       throw(NativeException);\r
+       \r
+       Task& getTask(int channel) \r
+       throw(NativeException);\r
+       \r
+       Task& getTask(int channel, double timeout) \r
+       throw(NativeException);\r
+       \r
+       Task& getTask(int channel, const Host& rHost) \r
+       throw(NativeException);\r
+       \r
+       Task& getTask(int channel, double timeout, const Host& rHost)\r
+       throw(NativeException);\r
+       \r
+       void sendTask(const char* alias, const Task& rTask, double timeout) \r
+       throw(NativeException);\r
+       \r
+       void sendTask(const char* alias, const Task& rTask) \r
+       throw(NativeException);\r
+       \r
+       void sendTask(const Task& rTask) \r
+       throw(NativeException);\r
+       \r
+       void sendTask(const Task& rTask, double timeout) \r
+       throw(NativeException);\r
+       \r
+       Task& receiveTask(const char* alias) \r
+       throw(NativeException);\r
+       \r
+       Task& receiveTask(void) \r
+       throw(NativeException);\r
+       \r
+       Task& receiveTask(const char* alias, double timeout) \r
+       throw(NativeException);\r
+       \r
+       Task& receiveTask(double timeout) \r
+       throw(NativeException);\r
+       \r
+       Task& receiveTask(const char* alias, double timeout, const Host& rHost) \r
+       throw(NativeException);\r
+       \r
+       Task& Process::receiveTask(double timeout, const Host& rHost) \r
+       throw(NativeException);\r
+       \r
+       Task& receiveTask(const char* alias, const Host& rHost) \r
+       throw(NativeException);\r
+       \r
+       Task& receiveTask(const Host& rHost) \r
+       throw(NativeException);\r
+       \r
+               \r
+       private:\r
+       void create(const Host& rHost, const char* name, int argc, char** argv) \r
+       throw(HostNotFoundException);\r
+       \r
+       \r
+       static Process& fromNativeProcess(m_process_t nativeProcess);\r
+       \r
+       \r
+       public:\r
+               \r
+       static int run(int argc, char** argv);\r
+       \r
+       virtual int main(int argc, char** argv) = 0;\r
+               \r
+       private:\r
+               \r
+       // Attributes.\r
+       \r
+       m_process_t nativeProcess;      // pointer to the native msg process.\r
+       \r
+};\r
+\r
+}
\ No newline at end of file