Coin: error.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

error.h
1#ifndef CC_ERROR_H
2#define CC_ERROR_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36/* FIXME: missing stuff from SoError: type-system. 20020526 mortene. */
37
38/* ********************************************************************** */
39
40#include <Inventor/C/base/string.h>
41#include <stdarg.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif /* __cplusplus */
46
47/* ********************************************************************** */
48
49 typedef struct cc_error {
50 cc_string debugstring;
51} cc_error;
52
53typedef void cc_error_cb(const cc_error * err, void * data);
54
55/* ********************************************************************** */
56
57COIN_DLL_API void cc_error_init(cc_error * me);
58COIN_DLL_API void cc_error_clean(cc_error * me);
59COIN_DLL_API void cc_error_copy(const cc_error * src, cc_error * dst);
60
61 /* const SbString & getDebugString(void) const; */
62COIN_DLL_API const cc_string * cc_error_get_debug_string(const cc_error * me);
63
64/* static void setHandlerCallback(SoErrorCB * const func, void * const data); */
65
66COIN_DLL_API void cc_error_set_handler_callback(cc_error_cb * func, void * data);
67
68/* static SoErrorCB * getHandlerCallback(void); */
69
70COIN_DLL_API cc_error_cb * cc_error_get_handler_callback(void);
71
72/* static void * getHandlerData(void); */
73
74COIN_DLL_API void * cc_error_get_handler_data(void);
75
76/* static void post(const char * const format, ...); */
77COIN_DLL_API void cc_error_post(const char * format, ...);
78COIN_DLL_API void cc_error_post_arglist(const char * format, va_list args);
79
80 /* protected: */
81 /* void setDebugString(const char * const str); */
82
83COIN_DLL_API void cc_error_set_debug_string(cc_error * me, const char * str);
84
85 /* protected: */
86 /* void appendToDebugString(const char * const str); */
87
88COIN_DLL_API void cc_error_append_to_debug_string(cc_error * me, const char * str);
89
90 /* protected: */
91 /* void handleError(void); */
92
93COIN_DLL_API void cc_error_handle(cc_error * me);
94
95 /* protected: */
96 /* virtual SoErrorCB * getHandler(void * & data) const; */
97COIN_DLL_API cc_error_cb * cc_error_get_handler(void ** data);
98
99 /* protected: */
100 /* static void defaultHandlerCB(const SoError * error, void * userdata); */
101COIN_DLL_API void cc_error_default_handler_cb(const cc_error * err, void * data);
102
103/* ********************************************************************** */
104
105#ifdef __cplusplus
106} /* extern "C" */
107#endif /* __cplusplus */
108
109#endif /* !CC_ERROR_H */
cc_error
Definition error.h:49
cc_string
The cc_string type is a C ADT for ASCII string management.
Definition string.h:51