00001 
00002 #ifndef QBDEBUGERROR_H
00003 #define QBDEBUGERROR_H
00004 
00005 #include <Inventor/errors/SoError.h>
00006 
00007 
00008 
00009 #if defined(ERROR)
00010 #define SODEBUGERROR_STORE_ERROR_DEF ERROR
00011 #undef ERROR
00012 #endif 
00013 
00014 
00015 class QbDebugError : public SoError {
00016   typedef SoError inherited;
00017 
00018 public:
00019   enum Severity { ERROR, WARNING, INFO };
00020 
00021   static void setHandlerCallback(SoErrorCB * const function,
00022                                  void * const data);
00023   static SoErrorCB * getHandlerCallback(void);
00024   static void * getHandlerData(void);
00025 
00026   static SoType getClassTypeId(void);
00027   virtual SoType getTypeId(void) const;
00028 
00029   QbDebugError::Severity getSeverity(void) const;
00030 
00031   static void post(const char * const source, const char * const format, ...);
00032   static void postWarning(const char * const source, const char * const format, ...);
00033   static void postInfo(const char * const source, const char * const format, ...);
00034 
00035   static void initClass(void);
00036 
00037 protected:
00038   virtual SoErrorCBPtr getHandler(void * & data) const;
00039 
00040 private:
00041   static void callbackForwarder(const struct cc_debugerror * error, void * data);
00042   static void commonPostHandling(Severity severity, const char * type,
00043                                  const char * source, const SbString & s);
00044 
00045   static SoType classTypeId;
00046   static SoErrorCB * callback;
00047   static void * callbackData;
00048   Severity severity;
00049 };
00050 
00051 
00052 #if defined(SODEBUGERROR_STORE_ERROR_DEF)
00053 #define ERROR SODEBUGERROR_STORE_ERROR_DEF
00054 #undef SODEBUGERROR_STORE_ERROR_DEF
00055 #endif 
00056 
00057 #endif // !QBDEBUGERROR_H