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

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
32class SoBase;
33class SoNode;
34class SoPath;
35class SoEngine;
36
37typedef void SoErrorCB(const class SoError * error, void * data);
38typedef SoErrorCB * SoErrorCBPtr;
39
40
41class COIN_DLL_API SoError {
42public:
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
65protected:
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
74private:
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
The SbString class is a string class with convenience functions for string operations.
Definition SbString.h:42
The SoBase class is the top-level superclass for a number of class-hierarchies.
Definition SoBase.h:36
SoEngine is the base class for Coin engines.
Definition SoEngine.h:34
The SoError class is the base class for all the error handling classes.
Definition SoError.h:41
virtual ~SoError()
Definition SoError.h:44
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:47
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:43
The SoType class is the basis for the run-time type system in Coin.
Definition SoType.h:50

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

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.