Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Spell-checking comments used as documentation (thanks eclipse)
[simgrid.git] / src / cxx / Simulation.cxx
index 34ee0fd..713baed 100644 (file)
-/*\r
- * Simulation.cxx\r
- *\r
- * Copyright 2006,2007 Martin Quinson, Malek Cherier           \r
- * All right reserved. \r
- *\r
- * This program is free software; you can redistribute \r
- * it and/or modify it under the terms of the license \r
- *(GNU LGPL) which comes with this package. \r
- *\r
- */\r
\r
- /* Simulation member functions implementation.\r
-  */  \r
-  \r
-#include <Simulation.hpp>\r
-\r
-#include <Application.hpp>\r
-#include <Environment.hpp>\r
-\r
-#include <MsgException.hpp>\r
-#include <FileNotFoundException.hpp>\r
-\r
-#include <Msg.hpp>\r
-\r
-#include <msg/msg.h> \r
-\r
-namespace SimGrid\r
-{\r
-       namespace Msg\r
-       {\r
-               int Simulation::execute(int argc, char** argv)\r
-               {\r
-                       if(argc < 3) \r
-                       {\r
-                     info("Usage: Msg platform_file deployment_file");\r
-                     return 1;\r
-                   }\r
-                   \r
-                        // initialize the MSG simulator. Must be done before anything else (even logging).\r
-               init(argc, argv);\r
-                       \r
-                       // the environment to load\r
-                       Environment env;\r
-                       \r
-                       // the application to deploy\r
-                       Application app;\r
-\r
-                       \r
-                       // try to load the environment described by the xml file (argv[1])\r
-                       try\r
-                       {\r
-                               env.load(argv[1]);\r
-                       }\r
-                       catch(FileNotFoundException e)\r
-                       {\r
-                               info(e.toString());\r
-                               finalize();\r
-                               return 1;\r
-                       }\r
-                               \r
-                       // try to deploy the application described by the xml file deployment (argv[2])\r
-                       try\r
-                       {\r
-                               app.deploy(argv[2]);\r
-                       }\r
-                       catch(FileNotFoundException e)\r
-                       {\r
-                               info(e.toString());\r
-                               finalize();\r
-                               return 1;\r
-                       }\r
-                       \r
-                       //try to run the simulation the given application on the given environment\r
-                       try\r
-                       {\r
-                               run();\r
-                       }\r
-                       catch(MsgException e)\r
-                       {\r
-                               info(e.toString());\r
-                               finalize();\r
-                               return 1;\r
-                       }\r
-                       \r
-                       // finalize the MSG simulator\r
-                       try\r
-                       {\r
-                               finalize();\r
-                       }\r
-                       catch(MsgException e)\r
-                       {\r
-                               info(e.toString());\r
-                               return 1;\r
-                       }\r
-                       \r
-                       return 0;\r
-               }\r
-               \r
-               void Simulation::run(void)\r
-               throw (MsgException)\r
-               {\r
-                       if(MSG_OK != MSG_main())\r
-                               throw MsgException("MSG_main() failed");\r
-               }\r
-       } // namespace Msg\r
-} // namespace SimGrid\r
+/*
+ * Simulation.cxx
+ *
+ * Copyright 2006,2007 Martin Quinson, Malek Cherier           
+ * All right reserved. 
+ *
+ * This program is free software; you can redistribute 
+ * it and/or modify it under the terms of the license 
+ *(GNU LGPL) which comes with this package. 
+ *
+ */
+ /* Simulation member functions implementation.
+  */  
+  
+
+#include <Application.hpp>
+#include <Environment.hpp>
+
+#include <Msg.hpp>
+
+#include <Simulation.hpp>
+
+
+#include <msg/msg.h> 
+
+namespace SimGrid
+{
+       namespace Msg
+       {
+               int Simulation::execute(int argc, char** argv)
+               {
+                       if(argc < 3) 
+                       {
+                     info("Usage: Msg platform_file deployment_file");
+                     return 1;
+                   }
+                   
+                        // initialize the MSG simulator. Must be done before anything else (even logging).
+               init(argc, argv);
+                       
+                       // the environment to load
+                       Environment env;
+                       
+                       // the application to deploy
+                       Application app;
+
+                       
+                       // try to load the environment described by the xml file (argv[1])
+                       try
+                       {
+                               env.load(argv[1]);
+                       }
+                       catch(FileNotFoundException e)
+                       {
+                               info(e.toString());
+                               finalize();
+                               return 1;
+                       }
+                               
+                       // try to deploy the application described by the xml file deployment (argv[2])
+                       try
+                       {
+                               app.deploy(argv[2]);
+                       }
+                       catch(FileNotFoundException e)
+                       {
+                               info(e.toString());
+                               finalize();
+                               return 1;
+                       }
+                       
+                       //try to run the simulation the given application on the given environment
+                       try
+                       {
+                               run();
+                       }
+                       catch(MsgException e)
+                       {
+                               info(e.toString());
+                               finalize();
+                               return 1;
+                       }
+                       
+                       // finalize the MSG simulator
+                       try
+                       {
+                               finalize();
+                       }
+                       catch(MsgException e)
+                       {
+                               info(e.toString());
+                               return 1;
+                       }
+                       
+                       return 0;
+               }
+               
+               void Simulation::run(void)
+               throw (MsgException)
+               {
+                       if(MSG_OK != MSG_main())
+                               throw MsgException("MSG_main() failed");
+               }
+       } // namespace Msg
+} // namespace SimGrid
+
+