Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
7efe7a2073ab1b96f1970d99e86903f13fc4dadd
[simgrid.git] / src / cxx / Application.hpp
1 /*\r
2  * Application.hpp\r
3  *\r
4  * This file contains the declaration of the wrapper class of the native MSG task type.\r
5  *\r
6  * Copyright 2006,2007 Martin Quinson, Malek Cherier           \r
7  * All right reserved. \r
8  *\r
9  * This program is free software; you can redistribute \r
10  * it and/or modify it under the terms of the license \r
11  *(GNU LGPL) which comes with this package. \r
12  *\r
13  */  \r
14  \r
15 #ifndef MSG_APPLICATION_HPP\r
16 #define MSG_APPLICATION_HPP\r
17 \r
18 #ifndef __cplusplus\r
19         #error Application.hpp requires C++ compilation (use a .cxx suffix)\r
20 #endif\r
21 \r
22 #include <Config.hpp>\r
23 \r
24 namespace SimGrid\r
25 {\r
26         namespace Msg\r
27         {\r
28                 class NullPointerException;\r
29                 class FileNotFoundException;\r
30                 class LogicException;\r
31                 class MsgException;\r
32 \r
33                 // Application wrapper class declaration.\r
34                 class SIMGRIDX_EXPORT Application\r
35                 {\r
36                 public:\r
37                         \r
38                         /*! \brief Default constructor.\r
39                          */\r
40                         Application();\r
41                         \r
42                         /*! \brief Copy constructor.\r
43                          */\r
44                         Application(const Application& rApplication);\r
45                         \r
46                         /* \brief A constructor which takes as parameter the xml file of the application.\r
47                          *\r
48                          * \exception           If this constructor fails, it throws on of the exceptions described\r
49                          *                                      below:\r
50                          *              \r
51                          *                                      [NullPointerException]  if the parameter file is NULL.\r
52                          *\r
53                          *                                      [FileNotFoundException] if the file is not found.\r
54                          */\r
55                         Application(const char* file)\r
56                         throw(NullPointerException, FileNotFoundException);\r
57                         \r
58                         /*! \brief Destructor.\r
59                          */\r
60                         virtual ~Application();\r
61                         \r
62                 // Operations.\r
63                         \r
64                         /*! \brief Application::deploy() - deploy the appliction.\r
65                          *\r
66                          * \exception           If this method fails, it throws an exception listed below:\r
67                          *\r
68                          * \exception           [LogicException]                        if the xml file which describes the application\r
69                          *                                                                                              is not yet specified or if the application is already\r
70                          *                                                                                              deployed.\r
71                          *                                      [MsgException]                          if a internal exception occurs.\r
72                          *\r
73                          * \remark                      Before use this method, you must specify the xml file of the application to\r
74                          *                                      deploy.\r
75                          *\r
76                          * \see                         Application::setFile()\r
77                          */\r
78                          \r
79                         void deploy(void)\r
80                         throw(LogicException, MsgException);\r
81                         \r
82                         /*! \brief Application::deploy() - Deploy the appliction.\r
83                          *\r
84                          * \return                      If successfuly the application is deployed. Otherwise\r
85                          *                                      the method throws an exception listed below.\r
86                          *\r
87                          * \exception           [NullPointerException]          if the parameter file is NULL.\r
88                          *                                      \r
89                          *                                      [FileNotFoundException]         if the file is not found.\r
90                          *\r
91                          *                                      [MsgException]                          if a internal exception occurs.\r
92                          *\r
93                          *                                      [LogicException]                        if the application is already deployed.\r
94                          *\r
95                          * \\r
96                          */\r
97                         void deploy(const char* file)\r
98                         throw(NullPointerException, FileNotFoundException, LogicException, MsgException);\r
99                         \r
100                         /*! \brief Application::isDeployed() - Tests if the application is deployed.\r
101                          *\r
102                          * \return                      This method returns true is the application is deployed.\r
103                          *                                      Otherwise the method returns false.\r
104                          */\r
105                         bool isDeployed(void) const;\r
106                         \r
107                         \r
108                 // Getters/setters\r
109                         \r
110                         /*! \brief Application::setFile() - this setter sets the value of the file of the application.\r
111                          *\r
112                          * \exception           If this method fails, it throws on of the exceptions listed below:\r
113                          *\r
114                          *                                      [NullPointerException]          if the parameter file is NULL.\r
115                          *\r
116                          *                                      [FileNotFoundException]         if the file is not found.\r
117                          \r
118                          *                                      [LogicException]                        if you try to set the value of the file of an\r
119                          *                                                                                              application which is already deployed.\r
120                          */\r
121                         void setFile(const char* file)\r
122                         throw (NullPointerException, FileNotFoundException, LogicException);\r
123                         \r
124                         /*! \brief Application::getFile() - This getter returns the name of the xml file which describes the \r
125                          * application of the simulation.\r
126                          */\r
127                         const char* getFile(void) const;\r
128                         \r
129                 // Operators.\r
130                         \r
131                         /*! \brief Assignement operator.\r
132                          *\r
133                          * \exception           [LogicException]                        if you try to assign an application already deployed.\r
134                          */\r
135                         const Application& operator = (const Application& rApplication)\r
136                         throw(LogicException);\r
137                         \r
138                 private:\r
139                 // Attributes.\r
140                         \r
141                         // flag : if true the application was deployed.\r
142                         bool deployed;\r
143                         \r
144                         // the xml file which describes the application of the simulation.\r
145                         const char* file;\r
146 \r
147                 };\r
148                 \r
149         } // namespace Msg\r
150 } // namespace SimGrid\r
151 \r
152 #endif // !MSG_APPLICATION_HPP