S3FC project page | S3FC home page |
00001 /* 00002 * Stone Three Foundation Class (s3fc) provides a number of utility classes. 00003 * Copyright (C) 2001 by Stone Three Signal Processing (Pty) Ltd. 00004 * 00005 * Authored by Stone Three Signal Processing (Pty) Ltd. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * Please see the file 'COPYING' in the source root directory. 00022 */ 00023 00033 #include <s3fc/s3_exception.h> 00034 00035 #include <sstream> 00036 #include <iostream> 00037 00038 // dflt ctor 00039 s3_exception::s3_exception(const std::string& str) : 00040 err_string(str) 00041 { 00042 } 00043 00044 // copy ctor 00045 s3_exception::s3_exception(const s3_exception& src) 00046 { 00047 err_string = src.err_string; 00048 } 00049 00050 // report error 00051 const char* s3_exception::what() const throw() 00052 { 00053 return err_string.c_str(); 00054 } 00055 00056 // instantiate default generic 00057 s3_generic_exception::s3_generic_exception() : 00058 s3_exception("Generic S3 Exception") 00059 { 00060 } 00061 00062 // instantiate unknown exception 00063 s3_generic_exception::s3_generic_exception(const std::string& n_where, 00064 const std::string& n_what) : 00065 s3_exception("") 00066 { 00067 std::stringstream str; 00068 str << n_where << ": [" << n_what << "]" << std::endl; 00069 err_string = str.str(); 00070 #ifdef _DEBUG 00071 std::cerr << "s3_generic_exception: " << str.str() << std::endl; 00072 #endif 00073 } 00074 00075 // instantiate index exception 00076 s3_index_exception::s3_index_exception(const std::string& where, 00077 int min, 00078 int max, 00079 int val) : 00080 s3_exception("") 00081 { 00082 std::stringstream str; 00083 str << where << ": [index bounds violation] " 00084 << val << " not in [" << min << "," << max << "]" 00085 << std::endl; 00086 err_string = str.str(); 00087 }
Send comments to: s3fc@stonethree.com |
|