Coin Logo http://www.sim.no
http://www.coin3d.org

SoDebugError.h

00001 #ifndef COIN_SODEBUGERROR_H
00002 #define COIN_SODEBUGERROR_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2007 by Systems in Motion.  All rights reserved.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Systems in Motion about acquiring
00018  *  a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/errors/SoError.h>
00028 #include <Inventor/C/errors/debugerror.h>
00029 
00030 // Avoid problem with Microsoft Win32 API headers (yes, they actually
00031 // #define ERROR -- in wingdi.h).
00032 #if defined(ERROR)
00033 #define SODEBUGERROR_STORE_ERROR_DEF ERROR
00034 #undef ERROR
00035 #endif /* ERROR */
00036 
00037 
00038 class COIN_DLL_API SoDebugError : public SoError {
00039   typedef SoError inherited;
00040 
00041 public:
00042   enum Severity { ERROR, WARNING, INFO };
00043 
00044   static void setHandlerCallback(SoErrorCB * const function,
00045                                  void * const data);
00046   static SoErrorCB * getHandlerCallback(void);
00047   static void * getHandlerData(void);
00048 
00049   static SoType getClassTypeId(void);
00050   virtual SoType getTypeId(void) const;
00051 
00052   SoDebugError::Severity getSeverity(void) const;
00053 
00054   static void post(const char * const source, const char * const format, ...);
00055   static void postWarning(const char * const source, const char * const format, ...);
00056   static void postInfo(const char * const source, const char * const format, ...);
00057 
00058   static void initClass(void);
00059 
00060 protected:
00061   virtual SoErrorCBPtr getHandler(void * & data) const;
00062 
00063 private:
00064   static void callbackForwarder(const struct cc_debugerror * error, void * data);
00065   static void commonPostHandling(Severity severity, const char * type,
00066                                  const char * source, const SbString & s);
00067 
00068   static SoType classTypeId;
00069   static SoErrorCB * callback;
00070   static void * callbackData;
00071   Severity severity;
00072 };
00073 
00074 // Avoid problem with Microsoft Win32 API headers (see above).
00075 #if defined(SODEBUGERROR_STORE_ERROR_DEF)
00076 #define ERROR SODEBUGERROR_STORE_ERROR_DEF
00077 #undef SODEBUGERROR_STORE_ERROR_DEF
00078 #endif /* SODEBUGERROR_STORE_ERROR_DEF */
00079 
00080 #endif // !COIN_SODEBUGERROR_H

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Feb 23 16:33:14 2009 for Coin by Doxygen. 1.5.8