Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c33cc76925e12cb2b5dc96ef19e538e58bdece59
[simgrid.git] / src / cxx / ApplicationHandler.hpp
1 #ifndef MSG_APPLICATION_HANDLER_HPP\r
2 #define MSG_APPLICATION_HANDLER_HPP\r
3 \r
4 // Compilation C++ recquise\r
5 #ifndef __cplusplus\r
6         #error ApplicationHandler.hpp requires C++ compilation (use a .cxx suffix)\r
7 #endif\r
8 \r
9 \r
10 namespace SimGrid\r
11 {\r
12         namespace Msg\r
13         {\r
14                 // Declaration of the class ApplicationHandler.\r
15                 class ApplicationHandler\r
16                 {\r
17                 private :\r
18                         \r
19                         // Desable the default constructor, the copy constructor , the assignement operator\r
20                         // and the destructor of this class. Assume that this class is static.\r
21                         \r
22                         // Default constructor.\r
23                         ApplicationHandler();\r
24                         \r
25                         // Copy constructor.\r
26                         ApplicationHandler(const ApplicationHandler& rApplicationHandler);\r
27                         \r
28                         // Destructor\r
29                         virtual ~ApplicationHandler();\r
30                         \r
31                         // Assignement operator.\r
32                         const ApplicationHandler& operator = (const ApplicationHandler& rApplicationHandler);\r
33                         \r
34                         class ProcessFactory \r
35                         {\r
36                                 public:\r
37                                         \r
38                                         // the list of the argument of the process to create.\r
39                                         xbt_dynar_t args;\r
40                                         // the properties of the process to create\r
41                                         xbt_dict_t properties;\r
42                       \r
43                                 private:\r
44                                         \r
45                                         // the current host name parsed\r
46                                         const char* hostName;\r
47                                         // the name of the class of the process\r
48                                         const char* function;\r
49                         \r
50                                 public :\r
51                         \r
52                                 // Default constructor.\r
53                                 ProcessFactory(); \r
54                                 \r
55                                 // Copy constructor.\r
56                                 ProcessFactory(const ProcessFactory& rProcessFactory);\r
57                                 \r
58                                 // Destructor.\r
59                                 virtual ~ProcessFactory();\r
60                                 \r
61                                 // Set the identity of the current process.\r
62                                 void setProcessIdentity(const char* hostName, const char* function);\r
63                         \r
64                         // Register an argument of the current process.\r
65                         void registerProcessArg(const char* arg); \r
66                                 \r
67                                 // Set the property of the current process.\r
68                                 void setProperty(const char* id, const char* value);\r
69                                 \r
70                                 // Return the host name of the current process.\r
71                                 const const char* getHostName(void);\r
72                                 \r
73                                 // Create the current process.\r
74                         void createProcess(void); \r
75                         \r
76                         };\r
77                         \r
78                         // the process factory used by the application handler.\r
79                         static ProcessFactory* processFactory;\r
80                         \r
81                         public:\r
82                         \r
83                         // Handle the begining of the parsing of the xml file describing the application.\r
84                         static void onStartDocument(void);\r
85                         \r
86                         // Handle at the end of the parsing.\r
87                         static void onEndDocument(void);\r
88                         \r
89                         // Handle the begining of the parsing of a xml process element.\r
90                         static void onBeginProcess(void);\r
91                         \r
92                         // Handle the parsing of an argument of the current xml process element.\r
93                         static void onProcessArg(void);\r
94                         \r
95                         // Handle the parsing of a property of the currnet xml process element.\r
96                         static void OnProperty(void);\r
97                         \r
98                         // Handle the end of the parsing of a xml process element\r
99                         static void onEndProcess(void);\r
100                 };\r
101 \r
102         } // namespace Msg\r
103 } // namespace SimGrid\r
104 \r
105 #endif // !MSG_APPLICATION_HANDLER_HPP\r
106