X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0f767a4eb0cf070d331e73d9be7d2c2be4f71dd5..40c50e73054c04f97b5e5a618f1676eb5c3c9658:/src/cxx/HostNotFoundException.cxx diff --git a/src/cxx/HostNotFoundException.cxx b/src/cxx/HostNotFoundException.cxx index e69de29bb2..213ab12f40 100644 --- a/src/cxx/HostNotFoundException.cxx +++ b/src/cxx/HostNotFoundException.cxx @@ -0,0 +1,75 @@ +/* + * HostNotFoundException.cxx + * + * Copyright 2006,2007 Martin Quinson, Malek Cherier + * All right reserved. + * + * This program is free software; you can redistribute + * it and/or modify it under the terms of the license + *(GNU LGPL) which comes with this package. + * + */ + + /* HostNotFoundException member functions implementation. + */ + +#include + +#include +#include +#include + +namespace SimGrid +{ + namespace Msg + { + + HostNotFoundException::HostNotFoundException() + { + this->reason = (char*) calloc(strlen("Host not found : unknown") + 1, sizeof(char)); + strcpy(this->reason, "Host not found : unknown"); + } + + + HostNotFoundException::HostNotFoundException(const HostNotFoundException& rHostNotFoundException) + { + const char* reason = rHostNotFoundException.toString(); + this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char)); + strcpy(this->reason, reason); + + } + + + HostNotFoundException::HostNotFoundException(const char* name) + { + this->reason = (char*) calloc(strlen("Host not found : ") + strlen(name) + 1, sizeof(char)); + sprintf(this->reason, "Host not found : %s", name); + } + + + HostNotFoundException::~HostNotFoundException() + { + if(this->reason) + free(this->reason); + } + + const char* HostNotFoundException::toString(void) const + { + return (const char*)(this->reason); + } + + + const HostNotFoundException& HostNotFoundException::operator = (const HostNotFoundException& rHostNotFoundException) + { + const char* reason = rHostNotFoundException.toString(); + this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char)); + + return *this; + } + + } // namespace Msg + +}// namespace SimGrid + + +