00001
00017 #ifndef GRAPHEXCEPTION__HPP
00018 #define GRAPHEXCEPTION__HPP
00019
00020
00021 #include <iostream>
00022
00023
00024 namespace gns {
00025
00027 #define GraphEx(ex) GraphException(GraphException::ex, "", __LINE__, __FILE__)
00028
00029 #define GraphExMsg(ex, msg) GraphException(GraphException::ex, msg, __LINE__, __FILE__)
00030
00031
00055 class GraphException
00056 {
00057 public:
00059 enum error {
00060 undefined,
00061 invalid_node,
00062 invalid_node_id,
00063 duplicate_node_id,
00064 invalid_edge,
00065 invalid_edge_id,
00066 duplicate_edge_id,
00067 duplicate_id,
00068 invalid_id,
00069 invalid_property,
00070 invalid_property_type,
00071 cannot_step,
00072 };
00073 const static char* messages[];
00075 private:
00076 int e;
00077 std::string msg;
00078 int line;
00079 const char *file;
00081 public:
00083 GraphException();
00085 GraphException(error e, std::string msg, const int line = 0, const char *file = NULL);
00087 GraphException(const GraphException &ex);
00088
00090 virtual ~GraphException();
00091
00093 virtual void halt();
00094
00096 virtual void print();
00097
00099 virtual std::string message();
00100
00102 virtual error exception();
00103 };
00104
00105
00106 }
00107
00108 #endif