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 
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
The SoBase class is the top-level superclass for a number of class-hierarchies.SoBase provides the ba...
Definition: SoBase.h:36
SoEngine is the base class for Coin engines.Engines enables the application programmers to make compl...
Definition: SoEngine.h:34
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
The SoPath class is a container class for traversal path descriptions.SoPath objects contain a list o...
Definition: SoPath.h:43
virtual ~SoError()
Definition: SoError.h:44
The SoError class is the base class for all the error handling classes.The default error handler just...
Definition: SoError.h:41
The SbString class is a string class with convenience functions for string operations.This is the class used for storing and working with character strings. It automatically takes care of supporting all the "bookkeeping" tasks usually associated with working with character strings, like memory allocation and deallocation etc.
Definition: SbString.h:42
The SoType class is the basis for the run-time type system in Coin.Many of the classes in the Coin li...
Definition: SoType.h:50

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

Generated on Wed Feb 7 2018 for Coin by Doxygen 1.8.14.