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

SoError.h

00001 #ifndef COIN_SOERROR_H
00002 #define COIN_SOERROR_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/SbBasic.h>
00028 #include <Inventor/SbString.h>
00029 #include <Inventor/C/errors/error.h>
00030 #include <Inventor/SoType.h>
00031 
00032 class SoBase;
00033 class SoNode;
00034 class SoPath;
00035 class SoEngine;
00036 
00037 typedef void SoErrorCB(const class SoError * error, void * data);
00038 typedef SoErrorCB * SoErrorCBPtr;
00039 
00040 
00041 class COIN_DLL_API SoError {
00042 public:
00043   SoError(void) { cc_error_init(&this->err); }
00044   virtual ~SoError() { cc_error_clean(&this->err); }
00045 
00046   static void setHandlerCallback(SoErrorCB * const func, void * const data);
00047   static SoErrorCB * getHandlerCallback(void);
00048   static void * getHandlerData(void);
00049 
00050   const SbString & getDebugString(void) const;
00051 
00052   static SoType getClassTypeId(void);
00053   virtual SoType getTypeId(void) const;
00054   SbBool isOfType(const SoType type) const;
00055 
00056   static void post(const char * const format, ...);
00057 
00058   static SbString getString(const SoNode * const node);
00059   static SbString getString(const SoPath * const path);
00060   static SbString getString(const SoEngine * const engine);
00061 
00062   static void initClass(void);
00063   static void initClasses(void);
00064 
00065 protected:
00066   static void defaultHandlerCB(const SoError * error, void * userdata);
00067   virtual SoErrorCBPtr getHandler(void * & data) const;
00068 
00069   void setDebugString(const char * const str);
00070   void appendToDebugString(const char * const str);
00071 
00072   void handleError(void);
00073 
00074 private:
00075   SoError(const cc_error * error);
00076   static void generateBaseString(SbString & str, const SoBase * const base,
00077                                  const char * const what);
00078 
00079   static void callbackForwarder(const cc_error * err, void * data);
00080 
00081   static SoType classTypeId;
00082   static SoErrorCB * callback;
00083   static void * callbackData;
00084   SbString debugstring;
00085 
00086   cc_error err;
00087 };
00088 
00089 #endif // !COIN_SOERROR_H

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

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