+++ /dev/null
-/*\r
- * OutOfBoundsException.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
- /* OutOfBoundsException member functions implementation.\r
- */ \r
-\r
-#include <OutOfBoundsException.hpp>\r
-\r
-#include <string.h>\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-\r
-\r
-namespace SimGrid\r
-{\r
- namespace Msg\r
- {\r
- \r
- OutOfBoundsException::OutOfBoundsException()\r
- {\r
- this->reason = (char*) calloc(strlen("Out of bounds") + 1, sizeof(char));\r
- strcpy(this->reason, "Out of bounds");\r
- }\r
- \r
- \r
- OutOfBoundsException::OutOfBoundsException(const OutOfBoundsException& rOutOfBoundsException)\r
- {\r
- const char* reason = rOutOfBoundsException.toString();\r
- this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));\r
- strcpy(this->reason, reason);\r
- \r
- }\r
- \r
- OutOfBoundsException::OutOfBoundsException(int pos)\r
- {\r
- this->reason = (char*) calloc(strlen("Out of bounds ") + 21 + 1, sizeof(char));\r
- sprintf(this->reason, "Out of bounds %d", pos);\r
- }\r
-\r
- OutOfBoundsException::OutOfBoundsException(int pos1, int pos2)\r
- {\r
- this->reason = (char*) calloc(strlen("Out of bounds ") + (2*21) + 1, sizeof(char));\r
- sprintf(this->reason, "Out of bounds %d : %d", pos1, pos2);\r
- }\r
- \r
- \r
- OutOfBoundsException::~OutOfBoundsException()\r
- {\r
- if(this->reason)\r
- free(this->reason);\r
- }\r
- \r
- const char* OutOfBoundsException::toString(void) const\r
- {\r
- return (const char*)(this->reason); \r
- }\r
- \r
- \r
- const OutOfBoundsException& OutOfBoundsException::operator = (const OutOfBoundsException& rOutOfBoundsException)\r
- {\r
- const char* reason = rOutOfBoundsException.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