00001 #ifndef COIN_SODEBUGERROR_H
00002 #define COIN_SODEBUGERROR_H
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 #include <Inventor/errors/SoError.h>
00028
00029
00030
00031 #if defined(ERROR)
00032 #define SODEBUGERROR_STORE_ERROR_DEF ERROR
00033 #undef ERROR
00034 #endif
00035
00036
00037 class COIN_DLL_API SoDebugError : public SoError {
00038 typedef SoError inherited;
00039
00040 public:
00041 enum Severity { ERROR, WARNING, INFO };
00042
00043 static void setHandlerCallback(SoErrorCB * const function,
00044 void * const data);
00045 static SoErrorCB * getHandlerCallback(void);
00046 static void * getHandlerData(void);
00047
00048 static SoType getClassTypeId(void);
00049 virtual SoType getTypeId(void) const;
00050
00051 SoDebugError::Severity getSeverity(void) const;
00052
00053 static void post(const char * const source, const char * const format, ...);
00054 static void postWarning(const char * const source, const char * const format, ...);
00055 static void postInfo(const char * const source, const char * const format, ...);
00056
00057 static void initClass(void);
00058
00059 protected:
00060 virtual SoErrorCB * getHandler(void * & data) const;
00061
00062 private:
00063 static void callbackForwarder(const struct cc_debugerror * error, void * data);
00064 static void commonPostHandling(Severity severity, const char * type,
00065 const char * source, const SbString & s);
00066
00067 static SoType classTypeId;
00068 static SoErrorCB * callback;
00069 static void * callbackData;
00070 Severity severity;
00071 };
00072
00073
00074 #if defined(SODEBUGERROR_STORE_ERROR_DEF)
00075 #define ERROR SODEBUGERROR_STORE_ERROR_DEF
00076 #undef SODEBUGERROR_STORE_ERROR_DEF
00077 #endif
00078
00079 #endif // !COIN_SODEBUGERROR_H