Logo AND Algorithmique Numérique Distribuée

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