| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

SoError.h
1 #ifndef COIN_SOERROR_H
2 #define COIN_SOERROR_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/SbBasic.h>
28 #include <Inventor/SbString.h>
29 #include <Inventor/C/errors/error.h>
30 #include <Inventor/SoType.h>
31
32 class SoBase;
33 class SoNode;
34 class SoPath;
35 class SoEngine;
36
37 typedef void SoErrorCB(const class SoError * error, void * data);
38 typedef SoErrorCB * SoErrorCBPtr;
39
40
41 class COIN_DLL_API SoError {
42 public:
43 SoError(void) { cc_error_init(&this->err); }
44 virtual ~SoError() { cc_error_clean(&this->err); }
45
46 static void setHandlerCallback(SoErrorCB * const func, void * const data);
47 static SoErrorCB * getHandlerCallback(void);
48 static void * getHandlerData(void);
49
50 const SbString & getDebugString(void) const;
51
52 static SoType getClassTypeId(void);
53 virtual SoType getTypeId(void) const;
54 SbBool isOfType(const SoType type) const;
55
56 static void post(const char * const format, ...);
57
58 static SbString getString(const SoNode * const node);
59 static SbString getString(const SoPath * const path);
60 static SbString getString(const SoEngine * const engine);
61
62 static void initClass(void);
63 static void initClasses(void);
64
65 protected:
66 static void defaultHandlerCB(const SoError * error, void * userdata);
67 virtual SoErrorCBPtr getHandler(void * & data) const;
68
69 void setDebugString(const char * const str);
70 void appendToDebugString(const char * const str);
71
72 void handleError(void);
73
74 private:
75 SoError(const cc_error * error);
76 static void generateBaseString(SbString & str, const SoBase * const base,
77 const char * const what);
78
79 static void callbackForwarder(const cc_error * err, void * data);
80
81 static SoType classTypeId;
82 static SoErrorCB * callback;
83 static void * callbackData;
84 SbString debugstring;
85
86 cc_error err;
87 };
88
89 #endif // !COIN_SOERROR_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.