|
UniSet
2.2.1
|
00001 /* This file is part of the UniSet project 00002 * Copyright (c) 2002 Free Software Foundation, Inc. 00003 * Copyright (c) 2002 Pavel Vainerman 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 // -------------------------------------------------------------------------- 00024 // -------------------------------------------------------------------------- 00025 #ifndef Exceptions_h_ 00026 #define Exceptions_h_ 00027 // --------------------------------------------------------------------------- 00028 #include <ostream> 00029 #include <iostream> 00030 #include <exception> 00031 // --------------------------------------------------------------------- 00032 00033 namespace UniSetTypes 00034 { 00035 00041 // namespase UniSetExceptions 00042 00047 class Exception: 00048 public std::exception 00049 { 00050 public: 00051 00052 Exception(const std::string& txt): text(txt.c_str()) {} 00053 Exception(): text("Exception") {} 00054 virtual ~Exception() noexcept(true) {} 00055 00056 friend std::ostream& operator<<(std::ostream& os, const Exception& ex ) 00057 { 00058 os << ex.text; 00059 return os; 00060 } 00061 00062 virtual const char* what() const noexcept override 00063 { 00064 return text.c_str(); 00065 } 00066 00067 protected: 00068 const std::string text; 00069 }; 00070 00071 00072 class PermissionDenied: public Exception 00073 { 00074 public: 00075 PermissionDenied(): Exception("PermissionDenied") {} 00076 }; 00077 00078 class NotEnoughMemory: public Exception 00079 { 00080 public: 00081 NotEnoughMemory(): Exception("NotEnoughMemory") {} 00082 }; 00083 00084 00085 class OutOfRange: public Exception 00086 { 00087 public: 00088 OutOfRange(): Exception("OutOfRange") {} 00089 OutOfRange(const std::string& err): Exception(err) {} 00090 }; 00091 00092 00093 class ErrorHandleResource: public Exception 00094 { 00095 public: 00096 ErrorHandleResource(): Exception("ErrorHandleResource") {} 00097 }; 00098 00103 class LimitWaitingPTimers: public Exception 00104 { 00105 public: 00106 LimitWaitingPTimers(): Exception("LimitWaitingPassiveTimers") {} 00107 00109 LimitWaitingPTimers(const std::string& err): Exception(err) {} 00110 }; 00111 00112 00117 class ORepFailed: public Exception 00118 { 00119 public: 00120 ORepFailed(): Exception("ORepFailed") {} 00121 00123 ORepFailed(const std::string& err): Exception(err) {} 00124 }; 00125 00126 00130 class SystemError: public Exception 00131 { 00132 public: 00133 SystemError(): Exception("SystemError") {} 00134 00136 SystemError(const std::string& err): Exception(err) {} 00137 }; 00138 00139 class CRCError: public Exception 00140 { 00141 public: 00142 CRCError(): Exception("CRCError") {} 00143 }; 00144 00145 00149 class CommFailed: public Exception 00150 { 00151 public: 00152 CommFailed(): Exception("CommFailed") {} 00153 00155 CommFailed(const std::string& err): Exception(err) {} 00156 }; 00157 00158 00163 class TimeOut: public CommFailed 00164 { 00165 public: 00166 TimeOut(): CommFailed("TimeOut") {} 00167 00169 TimeOut(const std::string& err): CommFailed(err) {} 00170 00171 }; 00172 00176 class ResolveNameError: public ORepFailed 00177 { 00178 public: 00179 ResolveNameError(): ORepFailed("ResolveNameError") {} 00180 ResolveNameError(const std::string& err): ORepFailed(err) {} 00181 }; 00182 00183 00184 class NSResolveError: public ORepFailed 00185 { 00186 public: 00187 NSResolveError(): ORepFailed("NSResolveError") {} 00188 NSResolveError(const std::string& err): ORepFailed(err) {} 00189 }; 00190 00191 00196 class ObjectNameAlready: public ResolveNameError 00197 { 00198 public: 00199 ObjectNameAlready(): ResolveNameError("ObjectNameAlready") {} 00200 00202 ObjectNameAlready(const std::string& err): ResolveNameError(err) {} 00203 }; 00204 00209 class IOBadParam: public Exception 00210 { 00211 public: 00212 IOBadParam(): Exception("IOBadParam") {} 00213 00215 IOBadParam(const std::string& err): Exception(err) {} 00216 }; 00217 00222 class InvalidObjectName: public ResolveNameError 00223 { 00224 public: 00225 InvalidObjectName(): ResolveNameError("InvalidObjectName") {} 00226 InvalidObjectName(const std::string& err): ResolveNameError(err) {} 00227 }; 00228 00230 class NotSetSignal: public Exception 00231 { 00232 public: 00233 NotSetSignal(): Exception("NotSetSignal") {} 00234 NotSetSignal(const std::string& err): Exception(err) {} 00235 }; 00236 00237 class NameNotFound: public ResolveNameError 00238 { 00239 public: 00240 NameNotFound(): ResolveNameError("NameNotFound") {} 00241 NameNotFound(const std::string& err): ResolveNameError(err) {} 00242 }; 00243 00245 // end of UniSetException group 00246 // --------------------------------------------------------------------- 00247 } // end of UniSetTypes namespace 00248 // --------------------------------------------------------------------- 00249 #endif // Exception_h_ 00250 // ---------------------------------------------------------------------
1.7.6.1