Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Last Changes of CPP version of Msg
[simgrid.git] / src / cxx / Application.cxx
index e11cab9..e326494 100644 (file)
   */  \r
   \r
 #include <Application.hpp>\r
+\r
+\r
+#include <NullPointerException.hpp>\r
+#include <FileNotFoundException.hpp>\r
+#include <LogicException.hpp>\r
+#include <MsgException.hpp>\r
 #include <ApplicationHandler.hpp>\r
 \r
 #include <sys/types.h>\r
 #include <sys/stat.h>\r
+#include <stdlib.h>\r
+\r
+#include <surf/surfxml_parse.h>\r
 \r
 #ifndef S_ISREG\r
        #define S_ISREG(__mode) (((__mode) & S_IFMT) == S_IFREG)\r
@@ -34,7 +43,7 @@ namespace SimGrid
                        this->deployed = false;\r
                }\r
                                \r
-               Application(const Application& rApplication)\r
+               Application::Application(const Application& rApplication)\r
                {\r
                                \r
                        this->file = rApplication.getFile();\r
@@ -51,7 +60,7 @@ namespace SimGrid
                        \r
                        struct stat statBuf = {0};\r
                                \r
-                       if(stat(statBuff, &info) < 0 || !S_ISREG(statBuff.st_mode))\r
+                       if(stat(file, &statBuf) < 0 || !S_ISREG(statBuf.st_mode))\r
                                throw FileNotFoundException(file);\r
                                \r
                        this->file = file;\r
@@ -63,7 +72,7 @@ namespace SimGrid
                        // NOTHING TODO\r
                }\r
                        \r
-               Application::deploy(const char* file)\r
+               void Application::deploy(const char* file)\r
                throw(NullPointerException, FileNotFoundException, LogicException, MsgException)\r
                {\r
                        // check logic\r
@@ -78,7 +87,7 @@ namespace SimGrid
                        \r
                        struct stat statBuf = {0};\r
                                \r
-                       if(stat(statBuff, &info) < 0 || !S_ISREG(statBuff.st_mode))\r
+                       if(stat(file, &statBuf) < 0 || !S_ISREG(statBuf.st_mode))\r
                                throw FileNotFoundException(file);\r
                                        \r
                        surf_parse_reset_parser();\r
@@ -87,13 +96,13 @@ namespace SimGrid
                        surfxml_add_callback(STag_surfxml_process_cb_list, ApplicationHandler::onBeginProcess);\r
                                \r
                        // set the process arg handler\r
-                       surfxml_add_callback(ETag_surfxml_argument_cb_list, ApplicationHandler::onArg);\r
+                       surfxml_add_callback(ETag_surfxml_argument_cb_list, ApplicationHandler::onProcessArg);\r
                                \r
                        // set the properties handler\r
                        surfxml_add_callback(STag_surfxml_prop_cb_list, ApplicationHandler::OnProperty);\r
                                \r
                        // set the end of the xml process element handler\r
-                       surfxml_add_callback(ETag_surfxml_process_cb_list, ApplicationHandler::OnEndProcess);\r
+                       surfxml_add_callback(ETag_surfxml_process_cb_list, ApplicationHandler::onEndProcess);\r
 \r
                        surf_parse_open(file);\r
                        \r
@@ -112,7 +121,7 @@ namespace SimGrid
                        this->deployed = true;\r
                }\r
                \r
-               Application::deploy(void)\r
+               void Application::deploy(void)\r
                throw(LogicException, MsgException)\r
                {\r
                        // check logic\r
@@ -126,9 +135,9 @@ namespace SimGrid
                        \r
                        surf_parse_reset_parser();\r
                        surfxml_add_callback(STag_surfxml_process_cb_list, ApplicationHandler::onBeginProcess);\r
-                       surfxml_add_callback(ETag_surfxml_argument_cb_list, ApplicationHandler::onArg);\r
+                       surfxml_add_callback(ETag_surfxml_argument_cb_list, ApplicationHandler::onProcessArg);\r
                        surfxml_add_callback(STag_surfxml_prop_cb_list, ApplicationHandler::OnProperty);\r
-                       surfxml_add_callback(ETag_surfxml_process_cb_list, ApplicationHandler::OnEndProcess);\r
+                       surfxml_add_callback(ETag_surfxml_process_cb_list, ApplicationHandler::onEndProcess);\r
 \r
                        surf_parse_open(file);\r
                        \r
@@ -140,7 +149,7 @@ namespace SimGrid
                        this->deployed = true;  \r
                }\r
                \r
-               bool Application::isDeployed(void)\r
+               bool Application::isDeployed(void) const\r
                {\r
                        return this->deployed;\r
                }\r
@@ -160,7 +169,7 @@ namespace SimGrid
                        \r
                        struct stat statBuf = {0};\r
                                \r
-                       if(stat(statBuff, &info) < 0 || !S_ISREG(statBuff.st_mode))\r
+                       if(stat(file, &statBuf) < 0 || !S_ISREG(statBuf.st_mode))\r
                                throw FileNotFoundException("file (file not found)");\r
                                \r
                        this->file = file;\r