Logo AND Algorithmique Numérique Distribuée

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