00001 /**************************************************************************\ 00002 * 00003 * This file is part of the Coin 3D visualization library. 00004 * Copyright (C) 1998-2002 by Systems in Motion. All rights reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * version 2.1 as published by the Free Software Foundation. See the 00009 * file LICENSE.LGPL at the root directory of the distribution for 00010 * more details. 00011 * 00012 * If you want to use Coin for applications not compatible with the 00013 * LGPL, please contact SIM to acquire a Professional Edition license. 00014 * 00015 * Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY 00016 * http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097 00017 * 00018 \**************************************************************************/ 00019 00020 #ifndef COIN_SOERROR_H 00021 #define COIN_SOERROR_H 00022 00023 #include <Inventor/SbBasic.h> 00024 #include <Inventor/SbString.h> 00025 00026 class SoType; 00027 class SoBase; 00028 class SoNode; 00029 class SoPath; 00030 class SoEngine; 00031 00032 typedef void SoErrorCB(const class SoError * error, void * data); 00033 00034 00035 class COIN_DLL_API SoError { 00036 public: 00037 static void setHandlerCallback(SoErrorCB * const func, void * const data); 00038 static SoErrorCB * getHandlerCallback(void); 00039 static void * getHandlerData(void); 00040 00041 const SbString & getDebugString(void) const; 00042 00043 static SoType getClassTypeId(void); 00044 virtual SoType getTypeId(void) const; 00045 SbBool isOfType(const SoType type) const; 00046 00047 static void post(const char * const format, ...); 00048 00049 static SbString getString(const SoNode * const node); 00050 static SbString getString(const SoPath * const path); 00051 static SbString getString(const SoEngine * const engine); 00052 00053 static void initClass(void); 00054 static void initClasses(void); 00055 00056 virtual ~SoError() { } // Kill g++ compiler warnings. 00057 00058 protected: 00059 static void defaultHandlerCB(const SoError * error, void * userdata); 00060 virtual SoErrorCB * getHandler(void * & data) const; 00061 void setDebugString(const char * const str); 00062 void appendToDebugString(const char * const str); 00063 00064 void handleError(void); 00065 00066 private: 00067 static void generateBaseString(SbString & str, const SoBase * const base, 00068 const char * const what); 00069 00070 static SoType classTypeId; 00071 static SoErrorCB * callback; 00072 static void * callbackData; 00073 SbString debugstring; 00074 }; 00075 00076 #endif // !COIN_SOERROR_H