Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Refactoring of code and documentation.
[simgrid.git] / src / cxx / Environment.hpp
1 /*\r
2  * Environment.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_ENVIRONMENT_HPP\r
16 #define MSG_ENVIRONMENT_HPP\r
17 \r
18 #ifndef __cplusplus\r
19         #error Environment.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 \r
28 namespace SimGrid\r
29 {\r
30         namespace Msg\r
31         {\r
32                 class Environment\r
33                 {\r
34                         public:\r
35                                 \r
36                                 /*! \brief Default constructor.\r
37                                  */\r
38                                 Environment();\r
39                                 \r
40                                 /*! \brief Copy constructor.\r
41                                  */\r
42                                 Environment(const Environment& rEnvironment);\r
43                                 \r
44                                 /*! \brief Constructor.\r
45                                  *\r
46                                  * \param file                  The xml file describing the environment of the simulation.\r
47                                  *\r
48                                  * \exception                   If this constructor fails, it throws one of the exception\r
49                                  *                                              described 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                                 Environment(const char* file)\r
56                                 throw(NullPointerException, FileNotFoundException);\r
57                                 \r
58                                 /*! \brief Destructor.\r
59                                  */\r
60                                 virtual ~Environment();\r
61                                 \r
62                         // Operations.\r
63                                 \r
64                                 /*! brief Environment::load() - Load the environment of a simulation.\r
65                                  *\r
66                                  * \exception                   If this method fails, it throws the exception described below:\r
67                                  *\r
68                                  *                                              [LogicException]                        if the file of the environment is not yet specified or\r
69                                  *                                                                                                      if the environment is already loaded.\r
70                                  */\r
71                                 void load(void)\r
72                                 throw(LogicException);\r
73                                 \r
74                                 /*! \brief Environment::load() - Load the environment of a simulation.\r
75                                  *\r
76                                  * \param file                  The xml file describing the environment of the simulation.\r
77                                  *\r
78                                  * \exception                   If this method fails, it throws one of the exceptions described below.\r
79                                  *\r
80                                  *                                              [NullPointerException]          if the parameter file is NULL.\r
81                                  *\r
82                                  *                                              [FileNotFoundException]         if the specified file is not found.\r
83                                  *\r
84                                  *                                              [LogicException]                        if the environment is already loaded.\r
85                                  */\r
86                                 void load(const char* file)\r
87                                 throw(NullPointerException, FileNotFoundException, LogicException);\r
88                                 \r
89                                 /*! \brief Environment::isLoaded() - Tests if an environment is loaded.\r
90                                  *\r
91                                  * \return                              If the environment is loaded, the method returns true. Otherwise the method\r
92                                  *                                              returns false.\r
93                                  */\r
94                                 bool isLoaded(void) const;\r
95                                 \r
96                         // Getters/setters\r
97                                 /*! \brief Environment::setFile() - Sets the xml file of the environment.\r
98                                  *\r
99                                  * \param file                  The file describing the environment.\r
100                                  *\r
101                                  * \exception                   If the method fails, it throws one of the exceptions described below:\r
102                                  *\r
103                                  *                                              [NullPointerException]          if the parameter file is NULL.\r
104                                  *                              \r
105                                  *                                              [FileNotFoundException]         if the file is not found.\r
106                                  *\r
107                                  *                                              [LogicException]                        if the environment is already loaded.\r
108                                  */\r
109                                 void setFile(const char* file)\r
110                                 throw(NullPointerException, FileNotFoundException, LogicException);\r
111                                 \r
112                                 /*! \brief Environment::getFile() - Gets the xml file environment description.\r
113                                  *\r
114                                  * \return                              The xml file describing the environment.                                \r
115                                  *\r
116                                  */\r
117                                 const char* getFile(void) const;\r
118                                 \r
119                         // Operators.\r
120                                 \r
121                                 /*! \brief Assignment operator.\r
122                                  *\r
123                                  * \exception                   If this operator fails, it throws the exception described below:\r
124                                  *\r
125                                  *                                              [LogicException]                        if you try to assign a loaded environment.\r
126                                  */\r
127                                 const Environment& operator = (const Environment& rEnvironment)\r
128                                 throw(LogicException);\r
129                                 \r
130                         private:\r
131                                 \r
132                                 // Attributes.\r
133                                 \r
134                                 // the xml file which describe the environment of the simulation.\r
135                                 const char* file;\r
136                                 \r
137                                 // flag : is true the environment of the simulation is loaded.\r
138                                 bool loaded.\r
139                 };\r
140                 \r
141         } // namespace Msg\r
142 } // namespace SimGrid\r
143 \r
144 \r
145 #endif // !MSG_ENVIRONMENT_HPP