32 #ifndef _util_misc_scexception_h
33 #define _util_misc_scexception_h
35 #ifndef _util_class_class_h
36 #include <util/class/class.h>
50 const char *description_;
54 const char *exception_type_;
55 std::ostringstream *elaboration_;
62 const char *exception_type =
"SCException")
throw();
68 const char*
what()
const throw();
70 const char *description()
const throw() {
return description_; }
71 const char *file()
const throw() {
return file_; }
72 int line()
const throw() {
return line_; }
73 const ClassDesc *class_desc()
const throw() {
return class_desc_; }
74 const char *exception_type()
const throw() {
return exception_type_; }
94 const char *exception_type =
"ProgrammingError")
throw();
106 const char *file = 0,
109 const char *exception_type =
"FeatureNotImplemented")
123 const char *keyword_;
128 const char *file = 0,
130 const char *keyword = 0,
131 const char *value = 0,
133 const char *exception_type =
"InputError")
throw();
136 const char *keyword()
const throw() {
return keyword_; }
137 const char *value()
const throw() {
return value_; }
149 const char *file = 0,
152 const char *exception_type =
"SystemException")
throw();
164 const char *file = 0,
168 const char *exception_type =
"MemAllocFailed")
throw();
173 size_t nbyte()
const throw() {
return nbyte_; }
180 enum FileOperation { Unknown, OpenR, OpenW, OpenRW,
181 Close, Read, Write, Corrupt, Other };
184 const char *filename_;
185 FileOperation operation_;
189 const char *source_file = 0,
192 FileOperation operation = Unknown,
194 const char *exception_type =
"FileOperationFailed")
throw();
200 const char *
filename()
const throw() {
return filename_; }
201 FileOperation operation()
const throw() {
return operation_; }
207 const char *syscall_;
212 const char *source_file = 0,
217 const char *exception_type =
"SyscallFailed")
throw();
223 const char *
syscall()
const throw() {
return syscall_; }
224 int err()
const throw() {
return err_; }
237 const char *file = 0,
240 const char *exception_type =
"AlgorithmException")
254 const char *file = 0,
258 const char *exception_type =
"MaxIterExceeded")
throw();
262 int max_iter()
const throw() {
return max_iter_; }
273 const char *file = 0,
278 const char *exception_type =
"ToleranceExceeded")
throw();
281 double tolerance()
throw() {
return tolerance_; }
282 double value()
throw() {
return value_; }
304 const char *exception_type =
"LimitExceeded")
throw():
305 SCException(description, file, line, class_desc, exception_type),
306 limit_(lim), value_(val)
311 <<
"limit: " << limit_
319 limit_(ref.limit_), value_(ref.value_)
323 T tolerance()
throw() {
return limit_; }
324 T value()
throw() {
return value_; }