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) 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/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
SoType::badType
static SoType badType(void)
Definition: SoType.cpp:664
SbName
The SbName class stores strings by reference.
Definition: SbName.h:31
SoError::setHandlerCallback
static void setHandlerCallback(SoErrorCB *const func, void *const data)
Definition: SoError.cpp:164
SoBase::getName
virtual SbName getName(void) const
Definition: SoBase.cpp:730
SoError::defaultHandlerCB
static void defaultHandlerCB(const SoError *error, void *userdata)
Definition: SoError.cpp:268
SbString
The SbString class is a string class with convenience functions for string operations.
Definition: SbString.h:42
SoType::isDerivedFrom
SbBool isDerivedFrom(const SoType type) const
Definition: SoType.cpp:687
SoError::isOfType
SbBool isOfType(const SoType type) const
Definition: SoError.cpp:147
SoPath
The SoPath class is a container class for traversal path descriptions.
Definition: SoPath.h:43
SoType
The SoType class is the basis for the run-time type system in Coin.
Definition: SoType.h:50
SoError::getHandlerData
static void * getHandlerData(void)
Definition: SoError.cpp:194
SbName::getString
const char * getString(void) const
Definition: SbName.cpp:278
SoError::getString
static SbString getString(const SoNode *const node)
Definition: SoError.cpp:230
SoError::getClassTypeId
static SoType getClassTypeId(void)
Definition: SoError.cpp:124
SoBase
The SoBase class is the top-level superclass for a number of class-hierarchies.
Definition: SoBase.h:41
SoError::appendToDebugString
void appendToDebugString(const char *const str)
Definition: SoError.cpp:297
SoError::handleError
void handleError(void)
Definition: SoError.cpp:308
SoError::setDebugString
void setDebugString(const char *const str)
Definition: SoError.cpp:288
SoError::~SoError
virtual ~SoError()
Definition: SoError.h:44
SbString::sprintf
SbString & sprintf(const char *formatstr,...)
Definition: SbString.h:105
SoType::createType
static const SoType createType(const SoType parent, const SbName name, const instantiationMethod method=(instantiationMethod) NULL, const uint16_t data=0)
Definition: SoType.cpp:256
SoError::initClass
static void initClass(void)
Definition: SoError.cpp:98
SoError::getTypeId
virtual SoType getTypeId(void) const
Definition: SoError.cpp:137
SoError
The SoError class is the base class for all the error handling classes.
Definition: SoError.h:41
SoError::post
static void post(const char *const format,...)
Definition: SoError.cpp:217
SoError::getDebugString
const SbString & getDebugString(void) const
Definition: SoError.cpp:204
SoError::getHandler
virtual SoErrorCBPtr getHandler(void *&data) const
Definition: SoError.cpp:278
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition: SoNode.h:47
SoError::getHandlerCallback
static SoErrorCB * getHandlerCallback(void)
Definition: SoError.cpp:184
SoError::initClasses
static void initClasses(void)
Definition: SoError.cpp:110
SoEngine
SoEngine is the base class for Coin engines.
Definition: SoEngine.h:34

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

Generated on Wed Jul 24 2019 for Coin by Doxygen. 1.8.17