Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

cpl_error.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  * $Id: cpl_error.h,v 1.21 2006/11/07 16:24:08 hobu Exp $
00003  *
00004  * Name:     cpl_error.h
00005  * Project:  CPL - Common Portability Library
00006  * Purpose:  CPL Error handling
00007  * Author:   Daniel Morissette, danmo@videotron.ca
00008  *
00009  **********************************************************************
00010  * Copyright (c) 1998, Daniel Morissette
00011  *
00012  * Permission is hereby granted, free of charge, to any person obtaining a
00013  * copy of this software and associated documentation files (the "Software"),
00014  * to deal in the Software without restriction, including without limitation
00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00016  * and/or sell copies of the Software, and to permit persons to whom the
00017  * Software is furnished to do so, subject to the following conditions:
00018  * 
00019  * The above copyright notice and this permission notice shall be included
00020  * in all copies or substantial portions of the Software.
00021  * 
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00023  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00025  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00026  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00027  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
00028  * DEALINGS IN THE SOFTWARE.
00029  **********************************************************************
00030  *
00031  * $Log: cpl_error.h,v $
00032  * Revision 1.21  2006/11/07 16:24:08  hobu
00033  * silence errors about no prototype defined for a few functions with void parameters
00034  *
00035  * Revision 1.20  2006/03/07 22:05:32  fwarmerdam
00036  * fix up docs a bit
00037  *
00038  * Revision 1.19  2005/08/31 03:32:13  fwarmerdam
00039  * fixed void arg list
00040  *
00041  * Revision 1.18  2005/08/25 18:05:36  fwarmerdam
00042  * Added void in empty arg lists.
00043  *
00044  * Revision 1.17  2005/04/04 15:23:31  fwarmerdam
00045  * some functions now CPL_STDCALL
00046  *
00047  * Revision 1.16  2001/11/02 22:07:58  warmerda
00048  * added logging error handler
00049  *
00050  * Revision 1.15  2001/01/19 21:16:41  warmerda
00051  * expanded tabs
00052  *
00053  * Revision 1.14  2000/11/30 17:30:10  warmerda
00054  * added CPLGetLastErrorType
00055  *
00056  * Revision 1.13  2000/08/24 18:08:17  warmerda
00057  * made default and quiet error handlers public on windows
00058  *
00059  * Revision 1.12  2000/06/26 21:44:07  warmerda
00060  * added CPLE_UserInterrupt for progress terminations
00061  *
00062  * Revision 1.11  2000/03/31 14:11:55  warmerda
00063  * added CPLErrorV
00064  *
00065  * Revision 1.10  2000/01/10 17:35:45  warmerda
00066  * added push down stack of error handlers
00067  *
00068  * Revision 1.9  1999/07/23 14:27:47  warmerda
00069  * CPLSetErrorHandler returns old handler
00070  *
00071  * Revision 1.8  1999/05/20 14:59:05  warmerda
00072  * added CPLDebug()
00073  *
00074  * Revision 1.7  1999/05/20 02:54:38  warmerda
00075  * Added API documentation
00076  *
00077  * Revision 1.6  1999/02/17 05:40:47  danmo
00078  * Fixed CPLAssert() macro to work with EGCS.
00079  *
00080  * Revision 1.5  1999/01/11 15:34:29  warmerda
00081  * added reserved range comment
00082  *
00083  * Revision 1.4  1998/12/15 19:02:27  warmerda
00084  * Avoid use of errno as a variable
00085  *
00086  * Revision 1.3  1998/12/06 22:20:42  warmerda
00087  * Added error code.
00088  *
00089  * Revision 1.2  1998/12/06 02:52:52  warmerda
00090  * Implement assert support
00091  *
00092  * Revision 1.1  1998/12/03 18:26:02  warmerda
00093  * New
00094  *
00095  **********************************************************************/
00096 
00097 #ifndef _CPL_ERROR_H_INCLUDED_
00098 #define _CPL_ERROR_H_INCLUDED_
00099 
00100 #include "cpl_port.h"
00101 
00102 /*=====================================================================
00103                    Error handling functions (cpl_error.c)
00104  =====================================================================*/
00105 
00112 CPL_C_START
00113 
00114 typedef enum
00115 {
00116     CE_None = 0,
00117     CE_Debug = 1,
00118     CE_Warning = 2,
00119     CE_Failure = 3,
00120     CE_Fatal = 4
00121 } CPLErr;
00122 
00123 void CPL_DLL CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...);
00124 void CPL_DLL CPLErrorV(CPLErr, int, const char *, va_list );
00125 void CPL_DLL CPL_STDCALL CPLErrorReset( void );
00126 int CPL_DLL CPL_STDCALL CPLGetLastErrorNo( void );
00127 CPLErr CPL_DLL CPL_STDCALL CPLGetLastErrorType( void );
00128 const char CPL_DLL * CPL_STDCALL CPLGetLastErrorMsg( void );
00129 
00130 typedef void (CPL_STDCALL *CPLErrorHandler)(CPLErr, int, const char*);
00131 
00132 void CPL_DLL CPL_STDCALL CPLLoggingErrorHandler( CPLErr, int, const char * );
00133 void CPL_DLL CPL_STDCALL CPLDefaultErrorHandler( CPLErr, int, const char * );
00134 void CPL_DLL CPL_STDCALL CPLQuietErrorHandler( CPLErr, int, const char * );
00135 
00136 CPLErrorHandler CPL_DLL CPL_STDCALL CPLSetErrorHandler(CPLErrorHandler);
00137 void CPL_DLL CPL_STDCALL CPLPushErrorHandler( CPLErrorHandler );
00138 void CPL_DLL CPL_STDCALL CPLPopErrorHandler(void);
00139 
00140 void CPL_DLL CPL_STDCALL CPLDebug( const char *, const char *, ... );
00141 void CPL_DLL CPL_STDCALL _CPLAssert( const char *, const char *, int );
00142 
00143 #ifdef DEBUG
00144 #  define CPLAssert(expr)  ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
00145 #else
00146 #  define CPLAssert(expr)
00147 #endif
00148 
00149 CPL_C_END
00150 
00151 /* ==================================================================== */
00152 /*      Well known error codes.                                         */
00153 /* ==================================================================== */
00154 
00155 #define CPLE_None                       0
00156 #define CPLE_AppDefined                 1
00157 #define CPLE_OutOfMemory                2
00158 #define CPLE_FileIO                     3
00159 #define CPLE_OpenFailed                 4
00160 #define CPLE_IllegalArg                 5
00161 #define CPLE_NotSupported               6
00162 #define CPLE_AssertionFailed            7
00163 #define CPLE_NoWriteAccess              8
00164 #define CPLE_UserInterrupt              9
00165 
00166 /* 100 - 299 reserved for GDAL */
00167 
00168 #endif /* _CPL_ERROR_H_INCLUDED_ */

Generated for GDAL by doxygen 1.4.4.