exception.icc
Go to the documentation of this file.00001 /* 00002 * Main authors: 00003 * Christian Schulte <schulte@gecode.org> 00004 * 00005 * Copyright: 00006 * Christian Schulte, 2004 00007 * 00008 * Last modified: 00009 * $Date: 2006-08-04 16:03:05 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $ 00010 * $Revision: 3510 $ 00011 * 00012 * This file is part of Gecode, the generic constraint 00013 * development environment: 00014 * http://www.gecode.org 00015 * 00016 * See the file "LICENSE" for information on usage and 00017 * redistribution of this file, and for a 00018 * DISCLAIMER OF ALL WARRANTIES. 00019 * 00020 */ 00021 00022 #include <exception> 00023 00024 namespace Gecode { 00025 00030 class GECODE_KERNEL_EXPORT Exception : public std::exception { 00031 private: 00032 static const int li_max = 128; 00033 char li[li_max+1]; 00034 public: 00036 Exception(const char* l, const char* i) throw (); 00038 virtual const char* what(void) const throw(); 00039 }; 00040 00041 00048 00050 class MemoryExhausted : public Exception { 00051 public: 00053 MemoryExhausted(void); 00054 }; 00055 00057 class SpaceFailed : public Exception { 00058 public: 00060 SpaceFailed(const char* l); 00061 }; 00062 00064 class SpaceNoBranching : public Exception { 00065 public: 00067 SpaceNoBranching(void); 00068 }; 00069 00071 class SpaceIllegalAlternative : public Exception { 00072 public: 00074 SpaceIllegalAlternative(void); 00075 }; 00076 00078 00079 /* 00080 * Classes for exceptions raised by kernel 00081 * 00082 */ 00083 00084 inline 00085 MemoryExhausted::MemoryExhausted(void) 00086 : Exception("Memory","Heap memory exhausted") {} 00087 00088 inline 00089 SpaceFailed::SpaceFailed(const char* l) 00090 : Exception(l,"Attempt to invoke operation on failed space") {} 00091 00092 inline 00093 SpaceNoBranching::SpaceNoBranching(void) 00094 : Exception("Space::commit", 00095 "Attempt to commit with no branching") {} 00096 00097 inline 00098 SpaceIllegalAlternative::SpaceIllegalAlternative(void) 00099 : Exception("Space::commit", 00100 "Attempt to commit with illegal alternative") {} 00101 00102 } 00103 00104 // STATISTICS: kernel-other