Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_1_RELEASE / libraries / libjni-gdal / include / cpl_error.h @ 9531

History | View | Annotate | Download (5.72 KB)

1
/**********************************************************************
2
 * $Id: cpl_error.h 9531 2007-01-03 17:07:37Z  $
3
 *
4
 * Name:     cpl_error.h
5
 * Project:  CPL - Common Portability Library
6
 * Purpose:  CPL Error handling
7
 * Author:   Daniel Morissette, danmo@videotron.ca
8
 *
9
 **********************************************************************
10
 * Copyright (c) 1998, Daniel Morissette
11
 *
12
 * Permission is hereby granted, free of charge, to any person obtaining a
13
 * copy of this software and associated documentation files (the "Software"),
14
 * to deal in the Software without restriction, including without limitation
15
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16
 * and/or sell copies of the Software, and to permit persons to whom the
17
 * Software is furnished to do so, subject to the following conditions:
18
 * 
19
 * The above copyright notice and this permission notice shall be included
20
 * in all copies or substantial portions of the Software.
21
 * 
22
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
25
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
28
 * DEALINGS IN THE SOFTWARE.
29
 **********************************************************************
30
 *
31
 * $Log$
32
 * Revision 1.2.10.2  2006-11-15 00:08:29  jjdelcerro
33
 * *** empty log message ***
34
 *
35
 * Revision 1.3  2006/10/03 07:05:18  nacho
36
 * *** empty log message ***
37
 *
38
 * Revision 1.1  2006/07/18 16:21:00  nacho
39
 * *** empty log message ***
40
 *
41
 * Revision 1.1  2006/06/29 16:23:27  nacho
42
 * *** empty log message ***
43
 *
44
 * Revision 1.2  2006/01/09 12:50:13  nacho
45
 * *** empty log message ***
46
 *
47
 * Revision 1.1  2005/07/27 08:22:55  igbrotru
48
 * *** empty log message ***
49
 *
50
 * Revision 1.1  2004/12/28 14:06:59  igbrotru
51
 * *** empty log message ***
52
 *
53
 * Revision 1.1  2004/10/28 12:08:47  igbrotru
54
 * *** empty log message ***
55
 *
56
 * Revision 1.1  2004/09/27 08:27:48  igbrotru
57
 * *** empty log message ***
58
 *
59
 * Revision 1.1  2004/09/08 12:39:04  igbrotru
60
 * *** empty log message ***
61
 *
62
 * Revision 1.16  2001/11/02 22:07:58  warmerda
63
 * added logging error handler
64
 *
65
 * Revision 1.15  2001/01/19 21:16:41  warmerda
66
 * expanded tabs
67
 *
68
 * Revision 1.14  2000/11/30 17:30:10  warmerda
69
 * added CPLGetLastErrorType
70
 *
71
 * Revision 1.13  2000/08/24 18:08:17  warmerda
72
 * made default and quiet error handlers public on windows
73
 *
74
 * Revision 1.12  2000/06/26 21:44:07  warmerda
75
 * added CPLE_UserInterrupt for progress terminations
76
 *
77
 * Revision 1.11  2000/03/31 14:11:55  warmerda
78
 * added CPLErrorV
79
 *
80
 * Revision 1.10  2000/01/10 17:35:45  warmerda
81
 * added push down stack of error handlers
82
 *
83
 * Revision 1.9  1999/07/23 14:27:47  warmerda
84
 * CPLSetErrorHandler returns old handler
85
 *
86
 * Revision 1.8  1999/05/20 14:59:05  warmerda
87
 * added CPLDebug()
88
 *
89
 * Revision 1.7  1999/05/20 02:54:38  warmerda
90
 * Added API documentation
91
 *
92
 * Revision 1.6  1999/02/17 05:40:47  danmo
93
 * Fixed CPLAssert() macro to work with EGCS.
94
 *
95
 * Revision 1.5  1999/01/11 15:34:29  warmerda
96
 * added reserved range comment
97
 *
98
 * Revision 1.4  1998/12/15 19:02:27  warmerda
99
 * Avoid use of errno as a variable
100
 *
101
 * Revision 1.3  1998/12/06 22:20:42  warmerda
102
 * Added error code.
103
 *
104
 * Revision 1.2  1998/12/06 02:52:52  warmerda
105
 * Implement assert support
106
 *
107
 * Revision 1.1  1998/12/03 18:26:02  warmerda
108
 * New
109
 *
110
 **********************************************************************/
111

    
112
#ifndef _CPL_ERROR_H_INCLUDED_
113
#define _CPL_ERROR_H_INCLUDED_
114

    
115
#include "cpl_port.h"
116

    
117
/*=====================================================================
118
                   Error handling functions (cpl_error.c)
119
 =====================================================================*/
120

    
121
/**
122
 * \file cpl_error.h
123
 *
124
 * CPL error handling services.
125
 */
126
  
127
CPL_C_START
128

    
129
typedef enum
130
{
131
    CE_None = 0,
132
    CE_Debug = 1,
133
    CE_Warning = 2,
134
    CE_Failure = 3,
135
    CE_Fatal = 4
136
  
137
} CPLErr;
138

    
139
void CPL_DLL CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...);
140
void CPL_DLL CPLErrorV(CPLErr, int, const char *, va_list );
141
void CPL_DLL CPLErrorReset();
142
int CPL_DLL CPLGetLastErrorNo();
143
CPLErr CPL_DLL CPLGetLastErrorType();
144
const char CPL_DLL * CPLGetLastErrorMsg();
145

    
146
typedef void (*CPLErrorHandler)(CPLErr, int, const char*);
147
CPLErrorHandler CPL_DLL CPLSetErrorHandler(CPLErrorHandler);
148
void CPL_DLL CPLPushErrorHandler( CPLErrorHandler );
149
void CPL_DLL CPLPopErrorHandler();
150
void CPL_DLL CPLDefaultErrorHandler( CPLErr, int, const char * );
151
void CPL_DLL CPLQuietErrorHandler( CPLErr, int, const char * );
152
void CPL_DLL CPLLoggingErrorHandler( CPLErr, int, const char * );
153

    
154
void CPL_DLL CPLDebug( const char *, const char *, ... );
155
void CPL_DLL _CPLAssert( const char *, const char *, int );
156

    
157
#ifdef DEBUG
158
#  define CPLAssert(expr)  ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
159
#else
160
#  define CPLAssert(expr)
161
#endif
162

    
163
CPL_C_END
164

    
165
/* ==================================================================== */
166
/*      Well known error codes.                                         */
167
/* ==================================================================== */
168

    
169
#define CPLE_None                       0
170
#define CPLE_AppDefined                 1
171
#define CPLE_OutOfMemory                2
172
#define CPLE_FileIO                     3
173
#define CPLE_OpenFailed                 4
174
#define CPLE_IllegalArg                 5
175
#define CPLE_NotSupported               6
176
#define CPLE_AssertionFailed            7
177
#define CPLE_NoWriteAccess              8
178
#define CPLE_UserInterrupt              9
179

    
180
/* 100 - 299 reserved for GDAL */
181

    
182
#endif /* _CPL_ERROR_H_INCLUDED_ */