4 * This file contains the declaration of the wrapper class of the native MSG task type.
6 * Copyright 2006,2007 Martin Quinson, Malek Cherier
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.
15 #ifndef MSG_ENVIRONMENT_HPP
16 #define MSG_ENVIRONMENT_HPP
19 #error Environment.hpp requires C++ compilation (use a .cxx suffix)
22 #include <NullPointerException.hpp>
23 #include <FileNotFoundException.hpp>
24 #include <InvalidArgumentException.hpp>
25 #include <LogicException.hpp>
26 #include <MsgException.hpp>
32 class NullPointerException;
33 class FileNotFoundException;
34 class InvalidArgumentException;
38 // Environment class wrapper declaration
39 class SIMGRIDX_EXPORT Environment
43 /*! \brief Default constructor.
47 /*! \brief Copy constructor.
49 Environment(const Environment& rEnvironment);
51 /*! \brief Constructor.
53 * \param file The xml file describing the environment of the simulation.
55 * \exception If this constructor fails, it throws one of the exception
58 * [NullPointerException] if the parameter file is NULL.
60 * [FileNotFoundException] if the file is not found.
62 Environment(const char* file)
63 throw(NullPointerException, FileNotFoundException);
65 /*! \brief Destructor.
67 virtual ~Environment();
71 /*! brief Environment::load() - Load the environment of a simulation.
73 * \exception If this method fails, it throws the exception described below:
75 * [LogicException] if the file of the environment is not yet specified or
76 * if the environment is already loaded.
79 throw(LogicException);
81 /*! \brief Environment::load() - Load the environment of a simulation.
83 * \param file The xml file describing the environment of the simulation.
85 * \exception If this method fails, it throws one of the exceptions described below.
87 * [NullPointerException] if the parameter file is NULL.
89 * [FileNotFoundException] if the specified file is not found.
91 * [LogicException] if the environment is already loaded.
93 void load(const char* file)
94 throw(NullPointerException, FileNotFoundException, LogicException);
96 /*! \brief Environment::isLoaded() - Tests if an environment is loaded.
98 * \return If the environment is loaded, the method returns true. Otherwise the method
101 bool isLoaded(void) const;
104 /*! \brief Environment::setFile() - Sets the xml file of the environment.
106 * \param file The file describing the environment.
108 * \exception If the method fails, it throws one of the exceptions described below:
110 * [NullPointerException] if the parameter file is NULL.
112 * [FileNotFoundException] if the file is not found.
114 * [LogicException] if the environment is already loaded.
116 void setFile(const char* file)
117 throw(NullPointerException, FileNotFoundException, LogicException);
119 /*! \brief Environment::getFile() - Gets the xml file environment description.
121 * \return The xml file describing the environment.
124 const char* getFile(void) const;
128 /*! \brief Assignment operator.
130 * \exception If this operator fails, it throws the exception described below:
132 * [LogicException] if you try to assign a loaded environment.
134 const Environment& operator = (const Environment& rEnvironment)
135 throw(LogicException);
141 // the xml file which describe the environment of the simulation.
144 // flag : is true the environment of the simulation is loaded.
149 } // namespace SimGrid
152 #endif // !MSG_ENVIRONMENT_HPP