--- /dev/null
+#include "LogicException.hpp"\r
+\r
+#include <string.h>\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+\r
+using namespace std;\r
+\r
+namespace SimGrid\r
+{\r
+ namespace Msg\r
+ {\r
+ \r
+ LogicException::LogicException()\r
+ {\r
+ this->reason = (char*) calloc(strlen("Logic exception : no detail") + 1, sizeof(char));\r
+ strcpy(this->reason, "Logic exception : no detail");\r
+ }\r
+ \r
+ \r
+ LogicException::LogicException(const LogicException& rLogicException)\r
+ {\r
+ const char* reason = rLogicException.toString();\r
+ this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));\r
+ strcpy(this->reason, reason);\r
+ \r
+ }\r
+ \r
+ \r
+ LogicException::LogicException(const char* detail)\r
+ {\r
+ this->reason = (char*) calloc(strlen("Logic exception : ") + strlen(detail) + 1, sizeof(char));\r
+ sprintf(this->reason, "Logic exception : %s", detail);\r
+ }\r
+ \r
+ \r
+ LogicException::~LogicException()\r
+ {\r
+ if(this->reason)\r
+ free(this->reason);\r
+ }\r
+ \r
+ const char* LogicException::toString(void) const\r
+ {\r
+ return (const char*)(this->reason); \r
+ }\r
+ \r
+ \r
+ const LogicException& LogicException::operator = (const LogicException& rLogicException)\r
+ {\r
+ const char* reason = rLogicException.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