00001 /* Exceptions used internally by the Prolog interfaces. 00002 Copyright (C) 2001-2006 Roberto Bagnara <bagnara@cs.unipr.it> 00003 00004 This file is part of the Parma Polyhedra Library (PPL). 00005 00006 The PPL is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU General Public License as published by the 00008 Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 The PPL is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00014 for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software Foundation, 00018 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 00019 00020 For the most up-to-date information see the Parma Polyhedra Library 00021 site: http://www.cs.unipr.it/ppl/ . */ 00022 00023 class internal_exception { 00024 private: 00025 Prolog_term_ref tr; 00026 00027 public: 00028 explicit internal_exception(Prolog_term_ref t) 00029 : tr(t) { 00030 } 00031 00032 virtual ~internal_exception() { 00033 } 00034 00035 virtual Prolog_term_ref term() const { 00036 return tr; 00037 } 00038 }; 00039 00040 class Prolog_unsigned_out_of_range : public internal_exception { 00041 private: 00042 unsigned long m; 00043 00044 public: 00045 explicit Prolog_unsigned_out_of_range(Prolog_term_ref t, unsigned long max) 00046 : internal_exception(t), 00047 m(max) { 00048 } 00049 00050 unsigned long max() const { 00051 return m; 00052 } 00053 00054 }; 00055 00056 class non_linear : public internal_exception { 00057 private: 00058 const char* w; 00059 00060 public: 00061 explicit non_linear(const char* s, Prolog_term_ref t) 00062 : internal_exception(t), w(s) { 00063 } 00064 00065 const char* where() const { 00066 return w; 00067 } 00068 }; 00069 00070 class not_an_integer : public internal_exception { 00071 public: 00072 explicit not_an_integer(Prolog_term_ref t) 00073 : internal_exception(t) { 00074 } 00075 }; 00076 00077 class not_unsigned_integer : public internal_exception { 00078 public: 00079 explicit not_unsigned_integer(Prolog_term_ref t) 00080 : internal_exception(t) { 00081 } 00082 }; 00083 00084 class not_a_variable : public internal_exception { 00085 public: 00086 explicit not_a_variable(Prolog_term_ref t) 00087 : internal_exception(t) { 00088 } 00089 }; 00090 00091 class not_a_polyhedron_kind : public internal_exception { 00092 public: 00093 explicit not_a_polyhedron_kind(Prolog_term_ref t) 00094 : internal_exception(t) { 00095 } 00096 }; 00097 00098 class not_a_polyhedron_handle : public internal_exception { 00099 public: 00100 explicit not_a_polyhedron_handle(Prolog_term_ref t) 00101 : internal_exception(t) { 00102 } 00103 }; 00104 00105 class not_an_optimization_mode : public internal_exception { 00106 public: 00107 explicit not_an_optimization_mode(Prolog_term_ref t) 00108 : internal_exception(t) { 00109 } 00110 }; 00111 00112 class not_an_lp_problem_handle : public internal_exception { 00113 public: 00114 explicit not_an_lp_problem_handle(Prolog_term_ref t) 00115 : internal_exception(t) { 00116 } 00117 }; 00118 00119 class not_a_complexity_class : public internal_exception { 00120 public: 00121 explicit not_a_complexity_class(Prolog_term_ref t) 00122 : internal_exception(t) { 00123 } 00124 }; 00125 00126 class not_universe_or_empty : public internal_exception { 00127 public: 00128 explicit not_universe_or_empty(Prolog_term_ref t) 00129 : internal_exception(t) { 00130 } 00131 }; 00132 00133 class not_a_relation : public internal_exception { 00134 public: 00135 explicit not_a_relation(Prolog_term_ref t) 00136 : internal_exception(t) { 00137 } 00138 }; 00139 00140 class not_a_nil_terminated_list : public internal_exception { 00141 public: 00142 explicit not_a_nil_terminated_list(Prolog_term_ref t) 00143 : internal_exception(t) { 00144 } 00145 }; 00146 00147 class PPL_integer_out_of_range { 00148 private: 00149 Parma_Polyhedra_Library::Coefficient n; 00150 00151 public: 00152 explicit 00153 PPL_integer_out_of_range(const Parma_Polyhedra_Library::Coefficient& i) 00154 : n(i) { 00155 } 00156 00157 const Parma_Polyhedra_Library::Coefficient i() const { 00158 return n; 00159 } 00160 }; 00161 00162 class unknown_interface_error { 00163 private: 00164 const char* w; 00165 00166 public: 00167 unknown_interface_error(const char* s) 00168 : w(s) { 00169 } 00170 00171 const char* where() const { 00172 return w; 00173 } 00174 };