Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change interface for elements_father, and avoid to allocate a dynar.
[simgrid.git] / src / cxx / MsgApplication.hpp
1 /*
2  * Application.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_APPLICATION_HPP
16 #define MSG_APPLICATION_HPP
17
18 #ifndef __cplusplus
19         #error Application.hpp requires C++ compilation (use a .cxx suffix)
20 #endif
21
22 #include <NullPointerException.hpp>
23 #include <FileNotFoundException.hpp>
24 #include <LogicException.hpp>
25 #include <MsgException.hpp>
26
27 namespace SimGrid
28 {
29         namespace Msg
30         {
31                 // Application wrapper class declaration.
32                 class SIMGRIDX_EXPORT Application
33                 {
34                 public:
35                         
36                         /*! \brief Default constructor.
37                          */
38                         Application();
39                         
40                         /*! \brief Copy constructor.
41                          */
42                         Application(const Application& rApplication);
43                         
44                         /* \brief A constructor which takes as parameter the xml file of the application.
45                          *
46                          * \exception           If this constructor fails, it throws on of the exceptions described
47                          *                                      below:
48                          *              
49                          *                                      [NullPointerException]  if the parameter file is NULL.
50                          *
51                          *                                      [FileNotFoundException] if the file is not found.
52                          */
53                         Application(const char* file)
54                         throw(NullPointerException, FileNotFoundException);
55                         
56                         /*! \brief Destructor.
57                          */
58                         virtual ~Application();
59                         
60                 // Operations.
61                         
62                         /*! \brief Application::deploy() - deploy the appliction.
63                          *
64                          * \exception           If this method fails, it throws an exception listed below:
65                          *
66                          * \exception           [LogicException]                        if the xml file which describes the application
67                          *                                                                                              is not yet specified or if the application is already
68                          *                                                                                              deployed.
69                          *                                      [MsgException]                          if a internal exception occurs.
70                          *
71                          * \remark                      Before use this method, you must specify the xml file of the application to
72                          *                                      deploy.
73                          *
74                          * \see                         Application::setFile()
75                          */
76                          
77                         void deploy(void)
78                         throw(LogicException, MsgException);
79                         
80                         /*! \brief Application::deploy() - Deploy the appliction.
81                          *
82                          * \return                      If successfuly the application is deployed. Otherwise
83                          *                                      the method throws an exception listed below.
84                          *
85                          * \exception           [NullPointerException]          if the parameter file is NULL.
86                          *                                      
87                          *                                      [FileNotFoundException]         if the file is not found.
88                          *
89                          *                                      [MsgException]                          if a internal exception occurs.
90                          *
91                          *                                      [LogicException]                        if the application is already deployed.
92                          *
93                          * \
94                          */
95                         void deploy(const char* file)
96                         throw(NullPointerException, FileNotFoundException, LogicException, MsgException);
97                         
98                         /*! \brief Application::isDeployed() - Tests if the application is deployed.
99                          *
100                          * \return                      This method returns true is the application is deployed.
101                          *                                      Otherwise the method returns false.
102                          */
103                         bool isDeployed(void) const;
104                         
105                         
106                 // Getters/setters
107                         
108                         /*! \brief Application::setFile() - this setter sets the value of the file of the application.
109                          *
110                          * \exception           If this method fails, it throws on of the exceptions listed below:
111                          *
112                          *                                      [NullPointerException]          if the parameter file is NULL.
113                          *
114                          *                                      [FileNotFoundException]         if the file is not found.
115                          
116                          *                                      [LogicException]                        if you try to set the value of the file of an
117                          *                                                                                              application which is already deployed.
118                          */
119                         void setFile(const char* file)
120                         throw (NullPointerException, FileNotFoundException, LogicException);
121                         
122                         /*! \brief Application::getFile() - This getter returns the name of the xml file which describes the 
123                          * application of the simulation.
124                          */
125                         const char* getFile(void) const;
126                         
127                 // Operators.
128                         
129                         /*! \brief Assignement operator.
130                          *
131                          * \exception           [LogicException]                        if you try to assign an application already deployed.
132                          */
133                         const Application& operator = (const Application& rApplication)
134                         throw(LogicException);
135                         
136                 private:
137                 // Attributes.
138                         
139                         // flag : if true the application was deployed.
140                         bool deployed;
141                         
142                         // the xml file which describes the application of the simulation.
143                         const char* file;
144
145                 };
146                 
147         } // namespace Msg
148 } // namespace SimGrid
149
150 #endif // !MSG_APPLICATION_HPP
151