1 #include <BadAllocException.hpp>
\r
12 BadAllocException::BadAllocException()
\r
14 this->reason = (char*) calloc(strlen("Not enough memory") + 1, sizeof(char));
\r
15 strcpy(this->reason, "Not enough memory");
\r
19 BadAllocException::BadAllocException(const BadAllocException& rBadAllocException)
\r
21 const char* reason = rBadAllocException.toString();
\r
22 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
\r
23 strcpy(this->reason, reason);
\r
27 BadAllocException::BadAllocException(const char* objectName)
\r
29 this->reason = (char*) calloc(strlen("Not enough memory to allocate ") + strlen(objectName) + 1, sizeof(char));
\r
30 sprintf(this->reason, "Not enough memory to allocate %s", objectName);
\r
34 BadAllocException::~BadAllocException()
\r
40 const char* BadAllocException::toString(void) const
\r
42 return (const char*)(this->reason);
\r
46 const BadAllocException& BadAllocException::operator = (const BadAllocException& rBadAllocException)
\r
48 const char* reason = rBadAllocException.toString();
\r
49 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
\r
56 }// namespace SimGrid
\r