SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00010 // Exceptions for used by some utility classes 00011 /****************************************************************************/ 00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00014 /****************************************************************************/ 00015 // 00016 // This file is part of SUMO. 00017 // SUMO is free software: you can redistribute it and/or modify 00018 // it under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation, either version 3 of the License, or 00020 // (at your option) any later version. 00021 // 00022 /****************************************************************************/ 00023 #ifndef UtilExceptions_h 00024 #define UtilExceptions_h 00025 00026 00027 // =========================================================================== 00028 // included modules 00029 // =========================================================================== 00030 #ifdef _MSC_VER 00031 #include <windows_config.h> 00032 #else 00033 #include <config.h> 00034 #endif 00035 00036 #include <string> 00037 #include <stdexcept> 00038 00039 00040 // =========================================================================== 00041 // class definitions 00042 // =========================================================================== 00048 class InvalidArgument : public std::runtime_error { 00049 public: 00051 InvalidArgument(const std::string& message) 00052 : std::runtime_error(message) {} 00053 00054 }; 00055 00056 00063 class ProcessError : public std::runtime_error { 00064 public: 00066 ProcessError() 00067 : std::runtime_error("Process Error") {} 00068 00070 ProcessError(const std::string& msg) 00071 : std::runtime_error(msg) {} 00072 00073 }; 00074 00075 00080 class EmptyData : public std::runtime_error { 00081 public: 00083 EmptyData() 00084 : std::runtime_error("Empty Data") {} 00085 00086 }; 00087 00088 00095 class NumberFormatException : public std::runtime_error { 00096 public: 00098 NumberFormatException() 00099 : std::runtime_error("Number Format") {} 00100 00101 }; 00102 00103 00109 class BoolFormatException : public std::runtime_error { 00110 public: 00112 BoolFormatException() 00113 : std::runtime_error("Bool Format") {} 00114 00115 }; 00116 00117 00123 class OutOfBoundsException : public std::runtime_error { 00124 public: 00126 OutOfBoundsException() 00127 : std::runtime_error("Out Of Bounds") {} 00128 00129 }; 00130 00131 00137 class UnknownElement : public std::runtime_error { 00138 public: 00140 UnknownElement() 00141 : std::runtime_error("Unknown Element") {} 00142 00144 UnknownElement(const std::string& msg) 00145 : std::runtime_error(msg) {} 00146 00147 }; 00148 00149 00150 class IOError : public ProcessError { 00151 public: 00153 IOError(const std::string& message) 00154 : ProcessError(message) {} 00155 00156 }; 00157 00158 00159 #endif 00160 00161 /****************************************************************************/