1 #include "BadAllocException.hpp"
\r
14 BadAllocException::BadAllocException()
\r
16 this->reason = (char*) calloc(strlen("Not enough memory") + 1, sizeof(char));
\r
17 strcpy(this->reason, "Not enough memory");
\r
21 BadAllocException::BadAllocException(const BadAllocException& rBadAllocException)
\r
23 const char* reason = rBadAllocException.toString();
\r
24 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
\r
25 strcpy(this->reason, reason);
\r
29 BadAllocException::BadAllocException(const char* objectName)
\r
31 this->reason = (char*) calloc(strlen("Not enough memory to allocate ") + strlen(objectName) + 1, sizeof(char));
\r
32 sprintf(this->reason, "Not enough memory to allocate %s", objectName);
\r
36 BadAllocException::~BadAllocException()
\r
42 const char* BadAllocException::toString(void) const
\r
44 return (const char*)(this->reason);
\r
48 const BadAllocException& BadAllocException::operator = (const BadAllocException& rBadAllocException)
\r
50 const char* reason = rBadAllocException.toString();
\r
51 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
\r
58 }// namespace SimGrid
\r