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

SoDebugError.h
1 #ifndef COIN_SODEBUGERROR_H
2 #define COIN_SODEBUGERROR_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/errors/SoError.h>
28 #include <Inventor/C/errors/debugerror.h>
29 
30 // Avoid problem with Microsoft Win32 API headers (yes, they actually
31 // #define ERROR -- in wingdi.h).
32 #if defined(ERROR)
33 #define SODEBUGERROR_STORE_ERROR_DEF ERROR
34 #undef ERROR
35 #endif /* ERROR */
36 
37 
38 class COIN_DLL_API SoDebugError : public SoError {
39  typedef SoError inherited;
40 
41 public:
42  enum Severity { ERROR, WARNING, INFO };
43 
44  static void setHandlerCallback(SoErrorCB * const function,
45  void * const data);
46  static SoErrorCB * getHandlerCallback(void);
47  static void * getHandlerData(void);
48 
49  static SoType getClassTypeId(void);
50  virtual SoType getTypeId(void) const;
51 
52  SoDebugError::Severity getSeverity(void) const;
53 
54  static void post(const char * const source, const char * const format, ...);
55  static void postWarning(const char * const source, const char * const format, ...);
56  static void postInfo(const char * const source, const char * const format, ...);
57 
58  static void initClass(void);
59 
60 protected:
61  virtual SoErrorCBPtr getHandler(void * & data) const;
62 
63 private:
64  static void callbackForwarder(const struct cc_debugerror * error, void * data);
65  static void commonPostHandling(Severity severity, const char * type,
66  const char * source, const SbString & s);
67 
68  static SoType classTypeId;
69  static SoErrorCB * callback;
70  static void * callbackData;
71  Severity severity;
72 };
73 
74 // Avoid problem with Microsoft Win32 API headers (see above).
75 #if defined(SODEBUGERROR_STORE_ERROR_DEF)
76 #define ERROR SODEBUGERROR_STORE_ERROR_DEF
77 #undef SODEBUGERROR_STORE_ERROR_DEF
78 #endif /* SODEBUGERROR_STORE_ERROR_DEF */
79 
80 #endif // !COIN_SODEBUGERROR_H

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

Generated on Sun Mar 31 2013 for Coin by Doxygen. 1.8.3.1