Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a class of exception for file not found and Msg files containing the declarations...
[simgrid.git] / src / cxx / Application.hpp
1 #ifndef MSG_APPLICATION_HPP\r
2 #define MSG_APPLICATION_HPP\r
3 \r
4 #ifndef __cplusplus\r
5         #error Application.hpp requires C++ compilation (use a .cxx suffix)\r
6 #endif\r
7 \r
8 #include <InvalidParameterException.hpp>\r
9 #include <LogicException.hpp>\r
10 #include <MsgException.hpp>\r
11 \r
12 namespace SimGrid\r
13 {\r
14         namespace Msg\r
15         {\r
16                 class Application\r
17                 {\r
18                 public:\r
19                         \r
20                 // Default constructor.\r
21                         Application();\r
22                         \r
23                         /*! \brief Copy constructor.\r
24                          */\r
25                         Application(const Application& rApplication);\r
26                         \r
27                         /* \brief A constructor which takes as parameter the xml file of the application.\r
28                          *\r
29                          * \exception           [InvalidParameterException]     if the parameter file is invalid\r
30                          *                                      (NULL or if the file does not exist).\r
31                          */\r
32                         Application(const char* file)\r
33                         throw(InvalidParameterException);\r
34                         \r
35                         /*! \brief Destructor.\r
36                          */\r
37                         virtual ~Application();\r
38                         \r
39                 // Operations.\r
40                         \r
41                         /*! \brief Application::deploy() - deploy the appliction.\r
42                          *\r
43                          * \return                      If successfuly the application is deployed. Otherwise\r
44                          *                                      the method throws an exception listed below.\r
45                          *\r
46                          * \exception           [LogicException]                        if the xml file which describes the application\r
47                          *                                                                                              is not yet specified or if the application is already\r
48                          *                                                                                              deployed.\r
49                          *                                      [MsgException]                          if a internal exception occurs.\r
50                          *\r
51                          * \remark                      Before use this method, you must specify the xml file of the application to\r
52                          *                                      deploy.\r
53                          *\r
54                          * \see                         Application::setFile()\r
55                          */\r
56                          \r
57                         void deploy(void)\r
58                         throw(LogicExeption, MsgException);\r
59                         \r
60                         /*! \brief Application::deploy() - deploy the appliction.\r
61                          *\r
62                          * \return                      If successfuly the application is deployed. Otherwise\r
63                          *                                      the method throws an exception listed below.\r
64                          *\r
65                          * \exception           [InvalidParameterException]     if the parameter file is invalid\r
66                          *                                      (NULL or not a xml deployment file name).\r
67                          *                                      [MsgException]                          if a internal exception occurs.\r
68                          *                                      [LogicException]                        if the application is already deployed.\r
69                          *\r
70                          * \\r
71                          */\r
72                         void deploy(const char* file)\r
73                         throw(InvalidParameterException, LogicException, MsgException);\r
74                         \r
75                         /*! \brief Application::isDeployed() - tests if the application is deployed.\r
76                          *\r
77                          * \return                      This method returns true is the application is deployed.\r
78                          *                                      Otherwise the method returns false.\r
79                          */\r
80                         bool isDeployed(void) const;\r
81                         \r
82                         \r
83                 // Getters/setters\r
84                         \r
85                         /*! \brief Application::setFile() - this setter sets the value of the file of the application.\r
86                          *\r
87                          * \return                      If successful, the value of the file of the application is setted.\r
88                          *                                      Otherwise the method throws on of the exceptions listed below.\r
89                          *\r
90                          * \exception           [InvalidParameterException]     if the parameter file is invalid\r
91                          *                                                                                              (NULL or does no exist).\r
92                          *                                      [LogicException]                        if you try to set the value of the file of an\r
93                          *                                                                                              application which is already deployed.\r
94                          */\r
95                         void setFile(const char* file)\r
96                         throw (InvalidParameterException, LogicException);\r
97                         \r
98                         /*! \brief Application::getFile() - this getter returns the file of an application object.\r
99                          */\r
100                         const char* getFile(void) const;\r
101                         \r
102                 // Operators.\r
103                         \r
104                         /*! \brief Assignement operator.\r
105                          *\r
106                          * \exception           [LogicException]                        if you try to assign an application already deployed.\r
107                          */\r
108                         const Application& operator = (const Application& rApplication)\r
109                         throw(LogicException);\r
110                         \r
111                 private:\r
112                 // Attributes.\r
113                         \r
114                         // flag : if true the application was deployed.\r
115                         bool deployed;\r
116                         // the xml file which describe the application.\r
117                         const char* file;\r
118                         \r
119                 };\r
120                 \r
121         } // namespace Msg\r
122 } // namespace SimGrid\r
123 \r
124 #endif // !MSG_APPLICATION_HPP