00001 /*************************************************************************** 00002 exceptions.h - description 00003 ------------------- 00004 begin : Wed May 8 2002 00005 copyright : (C) 2002 by Peter Haase 00006 email : mail@p-haase.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00024 * MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00035 #ifndef _EXCEPTIONS_H 00036 #define _EXCEPTIONS_H 00037 00038 00039 #include <stdexcept> 00040 00041 namespace simth 00042 { 00043 00045 class ParameterErr : public std::runtime_error 00046 { 00047 public: 00048 ParameterErr(const std::string& messages) 00049 : std::runtime_error(messages) {}; 00050 }; 00051 00052 00053 00055 class FitErr : public ParameterErr 00056 { 00057 public: 00058 //the number of missing bits to fit 00059 int mB; 00060 FitErr(const std::string& messages, int missedBits) 00061 : ParameterErr(messages),mB(missedBits) {}; 00062 }; 00063 00064 00066 class token_not_found : public ParameterErr 00067 { 00068 public: 00069 token_not_found(const std::string& messages) 00070 : ParameterErr(messages) {}; 00071 }; 00072 00074 class no_such_parameter : public ParameterErr 00075 { 00076 public: 00077 no_such_parameter(const std::string& messages) 00078 : ParameterErr(messages) {}; 00079 00080 }; 00081 00083 class file_not_found : public ParameterErr 00084 { 00085 public: 00086 file_not_found(const std::string& messages) 00087 : ParameterErr(messages) {}; 00088 }; 00089 00091 class library_dependencies : public ParameterErr 00092 { 00093 public: 00094 library_dependencies(const std::string& messages) 00095 : ParameterErr(messages) {}; 00096 }; 00097 00099 class name_conflict : public ParameterErr 00100 { 00101 public: 00102 name_conflict(const std::string& messages) 00103 : ParameterErr(messages) {}; 00104 00105 }; 00106 00108 class type_error : public ParameterErr 00109 { 00110 public: 00111 type_error(const std::string& messages) 00112 : ParameterErr(messages) {}; 00113 00114 }; 00115 00117 class connection_error : public std::runtime_error 00118 { 00119 public: 00120 connection_error(const std::string& messages) 00121 : std::runtime_error(messages) {}; 00122 00123 }; 00124 00127 class type_mismatch_connection : public connection_error 00128 { 00129 public: 00130 type_mismatch_connection(const std::string& messages) 00131 : connection_error(messages) {}; 00132 00133 }; 00134 00136 class no_connection_error : public connection_error 00137 { 00138 public: 00139 no_connection_error(const std::string& messages) 00140 : connection_error(messages) {}; 00141 00142 }; 00143 00144 00146 class no_such_interface : public connection_error 00147 { 00148 public: 00149 no_such_interface(const std::string& messages) 00150 : connection_error(messages) {}; 00151 00152 }; 00153 00155 class no_such_loop_control : public connection_error 00156 { 00157 public: 00158 no_such_loop_control(const std::string& messages) 00159 : connection_error(messages) {}; 00160 00161 }; 00162 00164 class no_input_interface : public no_such_interface 00165 { 00166 public: 00167 no_input_interface(const std::string& messages) 00168 : no_such_interface(messages) {}; 00169 00170 }; 00171 00173 class no_such_scheme : public std::runtime_error 00174 { 00175 public: 00176 no_such_scheme(const std::string& messages) 00177 : std::runtime_error(messages) {}; 00178 00179 }; 00180 00182 class init_incomplete : public std::runtime_error 00183 { 00184 public: 00185 init_incomplete(const std::string& messages) 00186 : std::runtime_error(messages) {}; 00187 00188 }; 00189 00190 00192 class bad_device_file : public std::runtime_error 00193 { 00194 public: 00195 bad_device_file(const std::string& messages) 00196 : std::runtime_error(messages) {}; 00197 00198 }; 00199 00200 00202 class device_not_found : public std::runtime_error 00203 { 00204 public: 00205 device_not_found(const std::string& messages) 00206 : std::runtime_error(messages) {}; 00207 00208 }; 00209 00210 00212 class bad_device_description : public std::runtime_error 00213 { 00214 public: 00215 bad_device_description(const std::string& messages) 00216 : std::runtime_error(messages) {}; 00217 00218 }; 00219 00220 00221 00222 } // namespace 00223 00224 #endif // PH_ERRORS