4 * Copyright 2006,2007 Martin Quinson, Malek Cherier
\r
5 * All right reserved.
\r
7 * This program is free software; you can redistribute
\r
8 * it and/or modify it under the terms of the license
\r
9 *(GNU LGPL) which comes with this package.
\r
13 /* MsgException member functions implementation.
\r
16 #include <MsgException.hpp>
\r
27 MsgException::MsgException()
\r
29 this->reason = (char*) calloc(strlen("Internal exception : unknown reason") + 1, sizeof(char));
\r
30 strcpy(this->reason, "Internal exception : unknown reason");
\r
34 MsgException::MsgException(const MsgException& rMsgException)
\r
36 const char* reason = rMsgException.toString();
\r
37 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
\r
38 strcpy(this->reason, reason);
\r
42 MsgException::MsgException(const char* reason)
\r
44 this->reason = (char*) calloc(strlen("Internal exception : ") + strlen(reason) + 1, sizeof(char));
\r
45 sprintf(this->reason, "Invalid exception : %s", reason);
\r
49 MsgException::~MsgException()
\r
55 const char* MsgException::toString(void) const
\r
57 return (const char*)(this->reason);
\r
61 const MsgException& MsgException::operator = (const MsgException& rMsgException)
\r
63 const char* reason = rMsgException.toString();
\r
64 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
\r
71 }// namespace SimGrid
\r