00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00028 #ifndef _API_EXCEPTION_H
00029 #define _API_EXCEPTION_H
00030
00031 #include <string>
00032 #include <exception>
00033 #include <sstream>
00034 #include <writer_utils.h>
00035
00036 namespace coco {
00037
00039
00044 typedef enum {apiee_internal = 1,
00045 apiee_evaluator = 2,
00046 apiee_io = 3,
00047 apiee_delta = 4,
00048 apiee_search_graph = 5,
00049 apiee_communication_data = 6,
00050 apiee_inference_engine = 7,
00051 apiee_graph_analyzer = 8,
00052 apiee_management_module = 9,
00053 apiee_initializer = 10,
00054 apiee_report_module = 11,
00055 apiee_oom = 12,
00056 apiee_nyi = 13,
00057 apiee_other = 14
00058
00059 } api_exception_type;
00060
00062
00069 class api_exception : public std::exception
00070 {
00071 private:
00073 std::string msg;
00075 api_exception_type exct;
00076
00077 public:
00079 api_exception(api_exception_type a, char const *m) :
00080 msg(m), exct(a) {}
00082 api_exception(api_exception_type a, const std::string& m) :
00083 msg(m), exct(a) {}
00084
00086 virtual ~api_exception() throw() {}
00087
00089 virtual char const *what() const throw()
00090 {
00091 return msg.c_str();
00092 }
00093
00095 virtual api_exception_type type() const throw()
00096 {
00097 return exct;
00098 }
00099
00101 virtual const char *type_str() const throw();
00102
00104 virtual std::string message() const throw()
00105 {
00106 return msg;
00107 }
00108 };
00109
00111
00117 class nyi_exception : public api_exception
00118 {
00119 public:
00121 nyi_exception(char const *m) : api_exception(apiee_nyi, m) {}
00123 nyi_exception(const std::string& m) : api_exception(apiee_nyi, m) {}
00124
00126 virtual ~nyi_exception() throw() {}
00127 };
00128
00129 }
00130
00131 #endif // _API_EXCEPTION_H