Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c2818701f7e2a89c65e26bd315191c90027b1289
[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 <NullPointerException.hpp>\r
23 #include <FileNotFoundException.hpp>\r
24 #include <LogicException.hpp>\r
25 #include <MsgException.hpp>\r
26 \r
27 namespace SimGrid\r
28 {\r
29         namespace Msg\r
30         {\r
31                 // Application wrapper class declaration.\r
32                 class SIMGRIDX_EXPORT Application\r
33                 {\r
34                 public:\r
35                         \r
36                         /*! \brief Default constructor.\r
37                          */\r
38                         Application();\r
39                         \r
40                         /*! \brief Copy constructor.\r
41                          */\r
42                         Application(const Application& rApplication);\r
43                         \r
44                         /* \brief A constructor which takes as parameter the xml file of the application.\r
45                          *\r
46                          * \exception           If this constructor fails, it throws on of the exceptions described\r
47                          *                                      below:\r
48                          *              \r
49                          *                                      [NullPointerException]  if the parameter file is NULL.\r
50                          *\r
51                          *                                      [FileNotFoundException] if the file is not found.\r
52                          */\r
53                         Application(const char* file)\r
54                         throw(NullPointerException, FileNotFoundException);\r
55                         \r
56                         /*! \brief Destructor.\r
57                          */\r
58                         virtual ~Application();\r
59                         \r
60                 // Operations.\r
61                         \r
62                         /*! \brief Application::deploy() - deploy the appliction.\r
63                          *\r
64                          * \exception           If this method fails, it throws an exception listed below:\r
65                          *\r
66                          * \exception           [LogicException]                        if the xml file which describes the application\r
67                          *                                                                                              is not yet specified or if the application is already\r
68                          *                                                                                              deployed.\r
69                          *                                      [MsgException]                          if a internal exception occurs.\r
70                          *\r
71                          * \remark                      Before use this method, you must specify the xml file of the application to\r
72                          *                                      deploy.\r
73                          *\r
74                          * \see                         Application::setFile()\r
75                          */\r
76                          \r
77                         void deploy(void)\r
78                         throw(LogicException, MsgException);\r
79                         \r
80                         /*! \brief Application::deploy() - Deploy the appliction.\r
81                          *\r
82                          * \return                      If successfuly the application is deployed. Otherwise\r
83                          *                                      the method throws an exception listed below.\r
84                          *\r
85                          * \exception           [NullPointerException]          if the parameter file is NULL.\r
86                          *                                      \r
87                          *                                      [FileNotFoundException]         if the file is not found.\r
88                          *\r
89                          *                                      [MsgException]                          if a internal exception occurs.\r
90                          *\r
91                          *                                      [LogicException]                        if the application is already deployed.\r
92                          *\r
93                          * \\r
94                          */\r
95                         void deploy(const char* file)\r
96                         throw(NullPointerException, FileNotFoundException, LogicException, MsgException);\r
97                         \r
98                         /*! \brief Application::isDeployed() - Tests if the application is deployed.\r
99                          *\r
100                          * \return                      This method returns true is the application is deployed.\r
101                          *                                      Otherwise the method returns false.\r
102                          */\r
103                         bool isDeployed(void) const;\r
104                         \r
105                         \r
106                 // Getters/setters\r
107                         \r
108                         /*! \brief Application::setFile() - this setter sets the value of the file of the application.\r
109                          *\r
110                          * \exception           If this method fails, it throws on of the exceptions listed below:\r
111                          *\r
112                          *                                      [NullPointerException]          if the parameter file is NULL.\r
113                          *\r
114                          *                                      [FileNotFoundException]         if the file is not found.\r
115                          \r
116                          *                                      [LogicException]                        if you try to set the value of the file of an\r
117                          *                                                                                              application which is already deployed.\r
118                          */\r
119                         void setFile(const char* file)\r
120                         throw (NullPointerException, FileNotFoundException, LogicException);\r
121                         \r
122                         /*! \brief Application::getFile() - This getter returns the name of the xml file which describes the \r
123                          * application of the simulation.\r
124                          */\r
125                         const char* getFile(void) const;\r
126                         \r
127                 // Operators.\r
128                         \r
129                         /*! \brief Assignement operator.\r
130                          *\r
131                          * \exception           [LogicException]                        if you try to assign an application already deployed.\r
132                          */\r
133                         const Application& operator = (const Application& rApplication)\r
134                         throw(LogicException);\r
135                         \r
136                 private:\r
137                 // Attributes.\r
138                         \r
139                         // flag : if true the application was deployed.\r
140                         bool deployed;\r
141                         \r
142                         // the xml file which describes the application of the simulation.\r
143                         const char* file;\r
144 \r
145                 };\r
146                 \r
147         } // namespace Msg\r
148 } // namespace SimGrid\r
149 \r
150 #endif // !MSG_APPLICATION_HPP\r
151 \r