src/ioerror.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           ioerror.h  -  description
00003                              -------------------
00004     begin                : Fri Dec 12 2003
00005     copyright            : (C) 2003 by Roman Geus
00006     email                : roman.geus@psi.ch
00007 ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include <stdexcept>
00019 #include <iostream>
00020 #include <string>
00021 #include <iomanip>
00022 #include <sstream>
00023 
00024 class IOError : public std::runtime_error {
00025 protected:
00026     std::string _msg;
00027 public:
00028     IOError() : std::runtime_error(""), _msg("") {}
00029     IOError(std::string msg) : std::runtime_error(""), _msg(msg) {}
00030     virtual ~IOError() throw() {}
00031     virtual const char* what() const throw() { return _msg.c_str(); }
00032 };
00033 
00034 class FileIOError : public IOError {
00035 public:
00036     FileIOError() : IOError("general file IO error") {}
00037     FileIOError(std::string fileName, std::string msg) : IOError(fileName + ": " + msg) {}
00038     FileIOError(std::string fileName, int line, std::string msg) : IOError() {
00039         std::ostringstream str;
00040         str << "file " << fileName << " at line " << line << ": " << msg;
00041         _msg = str.str();
00042     };
00043 };

Generated on Fri Oct 26 13:35:12 2007 for FEMAXX (Finite Element Maxwell Eigensolver) by  doxygen 1.4.7