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
00026
00027
00028 #ifndef _aflibException_H_
00029 #define _aflibException_H_
00030
00031 #include "aflib.h"
00032
00033 #include <string>
00034 #include <string.h>
00035 #include <errno.h>
00036 #include <iostream>
00037
00038 class aflibException {
00039
00040 std::string _errstr;
00041 aflibError _status;
00042
00043 public:
00044
00045 aflibException() { _status = AFLIB_SUCCESS;
00046 _errstr = "AFLIB_SUCCESS";};
00047
00048 aflibException(aflibError status);
00049 aflibException(aflibError status ,const char *fmt,...);
00050
00051 const aflibError&
00052 getStatus() const { return _status; };
00053
00054 const char*
00055 getErrorStr() const { return _errstr.c_str(); };
00056
00057 void
00058 clear(){
00059 _status = AFLIB_SUCCESS;
00060 _errstr = "AFLIB SUCCESS";
00061 };
00062
00063 bool
00064 operator!() const { return _status != AFLIB_SUCCESS;};
00065
00066 bool
00067 operator==(aflibError status) const { return _status == status;};
00068
00069 bool
00070 operator!=(aflibError status) const { return _status != status;};
00071
00072 friend std::ostream&
00073 operator << (
00074 std::ostream& o,
00075 const aflibException& exception);
00076
00077 };
00078
00079 #endif