Logo AND Algorithmique Numérique Distribuée

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