Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
last change of cpp wrappers for msg
[simgrid.git] / src / cxx / ProcessNotFoundException.cxx
index 2da654a..1215b2a 100644 (file)
@@ -1,77 +1,81 @@
-/*\r
- * ProcessNotFoundException.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
- /* ProcessNotFoundException member functions implementation.\r
-  */  \r
-\r
-#include <ProcessNotFoundException.hpp>\r
-\r
-#include <string.h>\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-\r
-namespace SimGrid\r
-{\r
-       namespace Msg\r
-       {\r
-               \r
-                       ProcessNotFoundException::ProcessNotFoundException()\r
-                       {\r
-                               this->reason = (char*) calloc(strlen("Host not found : unknown") + 1, sizeof(char));\r
-                               strcpy(this->reason, "Host not found : unknown");\r
-                       }\r
-               \r
-               \r
-                       ProcessNotFoundException::ProcessNotFoundException(const ProcessNotFoundException& rProcessNotFoundException)\r
-                       {\r
-                               const char* reason = rProcessNotFoundException.toString();\r
-                               this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));\r
-                               strcpy(this->reason, reason);\r
-                               \r
-                       }\r
-               \r
-               \r
-                       ProcessNotFoundException::ProcessNotFoundException(int PID)\r
-                       {\r
-                               char buff[7] = {0};\r
-                               _itoa(PID, buff, 10);\r
-                               this->reason = (char*) calloc(strlen("Process not found : ") + strlen(buff) + 1, sizeof(char));\r
-                               sprintf(this->reason, "Host not found : %s", buff);\r
-                       }\r
-               \r
-               \r
-                       ProcessNotFoundException::~ProcessNotFoundException()\r
-                       {\r
-                               if(this->reason)\r
-                                       free(this->reason);\r
-                       }\r
-                               \r
-                       const char* ProcessNotFoundException::toString(void) const\r
-                       {\r
-                               return (const char*)(this->reason);     \r
-                       }\r
-               \r
-               \r
-                       const ProcessNotFoundException& ProcessNotFoundException::operator = (const ProcessNotFoundException& rProcessNotFoundException)\r
-                       {\r
-                               const char* reason = rProcessNotFoundException.toString();\r
-                               this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));\r
-                               \r
-                               return *this;\r
-                       }\r
-               \r
-       } // namespace Msg      \r
-\r
-}// namespace SimGrid\r
-\r
-\r
-\r
+/*
+ * ProcessNotFoundException.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. 
+ *
+ */
+ /* ProcessNotFoundException member functions implementation.
+  */  
+
+#include <ProcessNotFoundException.hpp>
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+namespace SimGrid
+{
+       namespace Msg
+       {
+               
+                       ProcessNotFoundException::ProcessNotFoundException()
+                       {
+                               this->reason = (char*) calloc(strlen("Host not found : unknown") + 1, sizeof(char));
+                               strcpy(this->reason, "Host not found : unknown");
+                       }
+               
+               
+                       ProcessNotFoundException::ProcessNotFoundException(const ProcessNotFoundException& rProcessNotFoundException)
+                       {
+                               const char* reason = rProcessNotFoundException.toString();
+                               this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
+                               strcpy(this->reason, reason);
+                               
+                       }
+               
+               
+                       ProcessNotFoundException::ProcessNotFoundException(int PID)
+                       {
+                               char buff[7] = {0};
+                               #ifdef WIN32
+                               _itoa(PID, buff, 10);
+                               #else
+                               sprintf(buff,"%d",PID);
+                               #endif
+                               this->reason = (char*) calloc(strlen("Process not found : ") + strlen(buff) + 1, sizeof(char));
+                               sprintf(this->reason, "Host not found : %s", buff);
+                       }
+               
+               
+                       ProcessNotFoundException::~ProcessNotFoundException()
+                       {
+                               if(this->reason)
+                                       free(this->reason);
+                       }
+                               
+                       const char* ProcessNotFoundException::toString(void) const
+                       {
+                               return (const char*)(this->reason);     
+                       }
+               
+               
+                       const ProcessNotFoundException& ProcessNotFoundException::operator = (const ProcessNotFoundException& rProcessNotFoundException)
+                       {
+                               const char* reason = rProcessNotFoundException.toString();
+                               this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
+                               
+                               return *this;
+                       }
+               
+       } // namespace Msg      
+
+}// namespace SimGrid
+
+
+