Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some new files of the cxx version of the MSG API
[simgrid.git] / src / cxx / Process.hpp
1 #ifndef MSG_PROCESS_HPP\r
2 #define MSG_PROCESS_HPP\r
3 \r
4 // Compilation C++ recquise\r
5 #ifndef __cplusplus\r
6         #error Process.hpp requires C++ compilation (use a .cxx suffix)\r
7 #endif\r
8 \r
9 namespace msg\r
10 {\r
11         \r
12 class Process\r
13 {\r
14         \r
15         friend ApplicationHandler;\r
16         \r
17         private;\r
18         \r
19         // Default constructor.\r
20         Process();\r
21         \r
22         public:\r
23         \r
24         // Construct a process from the name of the host and its name.  \r
25         Process(const char* hostName, const char* name)\r
26         throw(HostNotFoundException);\r
27         \r
28         Process(const Host& rHost, const char* name)\r
29         throw(HostNotFoundException);\r
30         \r
31         Process(const char* hostName, const char* name, int argc, char** argv)\r
32         throw(HostNotFoundException);\r
33         \r
34         Process(const Host& rHost, const char* name, int argc, char** argv)\r
35         throw(HostNotFoundException);\r
36         \r
37         static int killAll(int resetPID);\r
38         \r
39         void Process::suspend(void)\r
40         throw(NativeException);\r
41         \r
42         void Process::resume(void) \r
43         throw(NativeException);\r
44         \r
45         bool isSuspended(void);\r
46         \r
47         Host& getHost(void) \r
48         throw(NativeException);\r
49         \r
50         static Process& fromPID(int PID); \r
51         \r
52         \r
53         int getPID(void);\r
54                 \r
55         int getPPID(void);\r
56         \r
57         const char* getName(void) const;\r
58         \r
59         static Process& currentProcess(void);\r
60         \r
61         static int currentProcessPID(void);\r
62         \r
63         static int currentProcessPPID(void);\r
64         \r
65         void migrate(const Host& rHost)\r
66         throw(NativeException);\r
67         \r
68         static void sleep(double seconds)\r
69         throw(NativeException);\r
70         \r
71         void putTask(const Host& rHost, int channel, const Task& rTask)\r
72         throw( NativeException);\r
73         \r
74         void putTask(const Host& rHost, int channel, const Task& rTask, double timeout) \r
75         throw(NativeException);\r
76         \r
77         Task& getTask(int channel) \r
78         throw(NativeException);\r
79         \r
80         Task& getTask(int channel, double timeout) \r
81         throw(NativeException);\r
82         \r
83         Task& getTask(int channel, const Host& rHost) \r
84         throw(NativeException);\r
85         \r
86         Task& getTask(int channel, double timeout, const Host& rHost)\r
87         throw(NativeException);\r
88         \r
89         void sendTask(const char* alias, const Task& rTask, double timeout) \r
90         throw(NativeException);\r
91         \r
92         void sendTask(const char* alias, const Task& rTask) \r
93         throw(NativeException);\r
94         \r
95         void sendTask(const Task& rTask) \r
96         throw(NativeException);\r
97         \r
98         void sendTask(const Task& rTask, double timeout) \r
99         throw(NativeException);\r
100         \r
101         Task& receiveTask(const char* alias) \r
102         throw(NativeException);\r
103         \r
104         Task& receiveTask(void) \r
105         throw(NativeException);\r
106         \r
107         Task& receiveTask(const char* alias, double timeout) \r
108         throw(NativeException);\r
109         \r
110         Task& receiveTask(double timeout) \r
111         throw(NativeException);\r
112         \r
113         Task& receiveTask(const char* alias, double timeout, const Host& rHost) \r
114         throw(NativeException);\r
115         \r
116         Task& Process::receiveTask(double timeout, const Host& rHost) \r
117         throw(NativeException);\r
118         \r
119         Task& receiveTask(const char* alias, const Host& rHost) \r
120         throw(NativeException);\r
121         \r
122         Task& receiveTask(const Host& rHost) \r
123         throw(NativeException);\r
124         \r
125                 \r
126         private:\r
127         void create(const Host& rHost, const char* name, int argc, char** argv) \r
128         throw(HostNotFoundException);\r
129         \r
130         \r
131         static Process& fromNativeProcess(m_process_t nativeProcess);\r
132         \r
133         \r
134         public:\r
135                 \r
136         static int run(int argc, char** argv);\r
137         \r
138         virtual int main(int argc, char** argv) = 0;\r
139                 \r
140         private:\r
141                 \r
142         // Attributes.\r
143         \r
144         m_process_t nativeProcess;      // pointer to the native msg process.\r
145         \r
146 };\r
147 \r
148 }