00001 /* 00002 * $Id:CoreExceptions.h 531 2007-08-11 09:05:29Z mindstorm2600 $ 00003 * 00004 * X-VR2 00005 * 00006 * Copyright (C) Juan V. Guerrero 2007 00007 * 00008 * Juan V. Guerrero <mindstorm2600@users.sourceforge.net> 00009 * 00010 * This program is free software, distributed under the terms of 00011 * the GNU General Public License Version 2. See the LICENSE file 00012 * at the top of the source tree. 00013 */ 00014 #ifndef __XVR2_CORE_EXCEPTIONS_H__ 00015 #define __XVR2_CORE_EXCEPTIONS_H__ 00016 #include<xvr2/Object.h> 00017 #include<xvr2/TraceDumper.h> 00018 00019 namespace xvr2{ 00020 00021 class String; 00022 00025 class Exception:public ExceptionTracer { 00026 private: 00027 protected: 00029 std::string description; 00030 public: 00032 Exception(); 00033 ~Exception(); 00038 Exception(const std::string &d); 00040 std::string toString(); 00041 }; 00042 00043 00044 00045 /********************************************************************* 00046 * EXCEPTIONS DERIVED FROM xvr2::Exception 00047 *********************************************************************/ 00051 class BufferTooSmall:public Exception{ 00052 public: 00054 BufferTooSmall(); 00055 }; 00059 class ArrayIndexOutOfLimits:public Exception{ 00060 private: 00061 int _i; 00062 int _m; 00063 public: 00065 ArrayIndexOutOfLimits(); 00066 ArrayIndexOutOfLimits(int _index, int _maxval); 00067 int index(); 00068 int maxval(); 00069 }; 00070 00074 class ElementNotFound:public Exception{ 00075 public: 00077 ElementNotFound(); 00078 }; 00081 class GroupException:public Exception{ 00082 public: 00084 GroupException(); 00085 }; 00090 class MemoryException:public Exception{ 00091 public: 00093 MemoryException(); 00094 }; 00099 class MutexException:public Exception{ 00100 public: 00102 MutexException(); 00103 }; 00107 class NoMoreTokens:public Exception{ 00108 public: 00110 NoMoreTokens(); 00111 }; 00115 class NullPointer:public Exception{ 00116 public: 00118 NullPointer(); 00119 }; 00123 class NumberException:public Exception{ 00124 public: 00126 NumberException(); 00127 }; 00130 class ParseException:public Exception{ 00131 protected: 00132 std::string orig_text; 00133 public: 00135 ParseException(); 00136 ParseException(const std::string &_original_text); 00137 const std::string &text(); 00138 const std::string &text() const; 00139 }; 00142 class SecurityException:public Exception{ 00143 public: 00145 SecurityException(); 00146 }; 00149 class ThreadException:public Exception{ 00150 public: 00152 ThreadException(); 00153 }; 00156 class UserException:public Exception{ 00157 public: 00159 UserException(); 00160 }; 00164 class UndefinedClassException:public Exception{ 00165 public: 00167 UndefinedClassException(); 00168 }; 00169 00170 00171 00172 00173 00174 00175 /************************************************************************* 00176 * EXCEPTIONS DERIVED FROM xvr2::GroupException 00177 *************************************************************************/ 00182 class GroupNotFound:public GroupException{ 00183 public: 00185 GroupNotFound(); 00186 }; 00187 00188 00189 /************************************************************************* 00190 * EXCEPTIONS DERIVED FROM xvr2::MemoryException 00191 *************************************************************************/ 00197 class AllocationFailed:public MemoryException{ 00198 public: 00200 AllocationFailed(); 00201 }; 00202 00203 00206 class ReallocFailed:public MemoryException{ 00207 public: 00211 ReallocFailed(); 00212 }; 00213 00214 00215 /************************************************************************* 00216 * EXCEPTIONS DERIVED FROM xvr2::MutexException 00217 *************************************************************************/ 00220 class DeadLock:public MutexException{ 00221 public: 00223 DeadLock(); 00224 }; 00225 00228 class UnableToLockMutex:public MutexException{ 00229 public: 00231 UnableToLockMutex(); 00232 }; 00233 00236 class UnableToUnlockMutex:public MutexException{ 00237 public: 00239 UnableToUnlockMutex(); 00240 }; 00241 00242 /************************************************************************* 00243 * EXCEPTIONS DERIVED FROM xvr2::ParseException 00244 *************************************************************************/ 00247 class DateParseException:public ParseException{ 00248 public: 00250 DateParseException(); 00251 }; 00254 class TimeParseException:public ParseException{ 00255 public: 00259 TimeParseException(); 00260 }; 00263 class BitParseException:public ParseException{ 00264 public: 00266 BitParseException(); 00267 }; 00270 class ByteParseException:public ParseException{ 00271 public: 00273 ByteParseException(); 00274 }; 00275 00276 00277 /************************************************************************* 00278 * EXCEPTIONS DERIVED FROM xvr2::SecurityException 00279 *************************************************************************/ 00282 class UserIDDoesNotMatch:public SecurityException{ 00283 public: 00285 UserIDDoesNotMatch(); 00286 }; 00287 00288 00289 /************************************************************************* 00290 * EXCEPTIONS DERIVED FROM xvr2::ThreadException 00291 *************************************************************************/ 00294 class SemaphoreException:public ThreadException{ 00295 public: 00297 SemaphoreException(); 00298 }; 00303 class ThreadNotRunning:public ThreadException{ 00304 public: 00306 ThreadNotRunning(); 00307 }; 00311 class MaximumNumberOfRunningThreadsReached:public ThreadException{ 00312 public: 00314 MaximumNumberOfRunningThreadsReached(); 00315 }; 00319 class ConditionVarWaitTimedOut:public ThreadException{ 00320 public: 00322 ConditionVarWaitTimedOut(); 00323 }; 00327 class InvalidThread:public ThreadException{ 00328 public: 00330 InvalidThread(); 00331 }; 00332 00333 00334 /************************************************************************* 00335 * EXCEPTIONS DERIVED FROM xvr2::SemaphoreException 00336 *************************************************************************/ 00340 class SemaphoreInitValueException:public SemaphoreException{ 00341 public: 00343 SemaphoreInitValueException(); 00344 }; 00345 00346 00350 class SemaphoreUnableToDestroy:public SemaphoreException{ 00351 public: 00353 SemaphoreUnableToDestroy(); 00354 }; 00355 00356 00359 class SemaphoreUnableToDecrease:public SemaphoreException{ 00360 public: 00362 SemaphoreUnableToDecrease(); 00363 }; 00364 00365 00369 class SemaphoreUnableToIncrease:public SemaphoreException{ 00370 public: 00372 SemaphoreUnableToIncrease(); 00373 }; 00374 00375 00376 /************************************************************************* 00377 * EXCEPTIONS DERIVED FROM xvr2::UserException 00378 *************************************************************************/ 00382 class UserNotFound:public UserException{ 00383 public: 00385 UserNotFound(); 00386 }; 00387 } 00388 00389 #endif 00390