EVOLUTION-MANAGER
Edit File: cpl__error_8h.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.5"/> <title>SDTS_AL: cpl_error.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDTS_AL </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_651562d8bf6cfd3e81eff5b570d7df50.html">port</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">cpl_error.h File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include "<a class="el" href="cpl__port_8h_source.html">cpl_port.h</a>"</code><br/> </div> <p><a href="cpl__error_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a0ce3699872cd56bacf12aa4411f1306e"><td class="memItemLeft" align="right" valign="top">void CPL_DLL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a0ce3699872cd56bacf12aa4411f1306e">CPLEmergencyError</a> (const char *)</td></tr> <tr class="separator:a0ce3699872cd56bacf12aa4411f1306e"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a2210503e49b3942db841416fbb65b5f6"><td class="memItemLeft" align="right" valign="top">void CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a2210503e49b3942db841416fbb65b5f6">CPLErrorReset</a> (void)</td></tr> <tr class="separator:a2210503e49b3942db841416fbb65b5f6"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a6368517aef108fe852c969e0b3489ff4"><td class="memItemLeft" align="right" valign="top">int CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a6368517aef108fe852c969e0b3489ff4">CPLGetLastErrorNo</a> (void)</td></tr> <tr class="separator:a6368517aef108fe852c969e0b3489ff4"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a21183f30769cafa434e33ec4940d1da5"><td class="memItemLeft" align="right" valign="top">CPLErr CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a21183f30769cafa434e33ec4940d1da5">CPLGetLastErrorType</a> (void)</td></tr> <tr class="separator:a21183f30769cafa434e33ec4940d1da5"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a4d7519cf9b02915faf47d7d0481ae279"><td class="memItemLeft" align="right" valign="top">const char CPL_DLL *CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a4d7519cf9b02915faf47d7d0481ae279">CPLGetLastErrorMsg</a> (void)</td></tr> <tr class="separator:a4d7519cf9b02915faf47d7d0481ae279"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a5ed4d11b005156695777b64dbebe421d"><td class="memItemLeft" align="right" valign="top">void CPL_DLL *CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a5ed4d11b005156695777b64dbebe421d">CPLGetErrorHandlerUserData</a> (void)</td></tr> <tr class="separator:a5ed4d11b005156695777b64dbebe421d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1b842be468b9cef24efeaa8a23b8f8f0"><td class="memItemLeft" align="right" valign="top">CPLErrorHandler CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a1b842be468b9cef24efeaa8a23b8f8f0">CPLSetErrorHandler</a> (CPLErrorHandler)</td></tr> <tr class="separator:a1b842be468b9cef24efeaa8a23b8f8f0"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a58b73907669501fde37db8f7b97289ff"><td class="memItemLeft" align="right" valign="top">CPLErrorHandler CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a58b73907669501fde37db8f7b97289ff">CPLSetErrorHandlerEx</a> (CPLErrorHandler, void *)</td></tr> <tr class="separator:a58b73907669501fde37db8f7b97289ff"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a38c2f099214120938983aa514867ba84"><td class="memItemLeft" align="right" valign="top">void CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a38c2f099214120938983aa514867ba84">CPLPushErrorHandler</a> (CPLErrorHandler)</td></tr> <tr class="separator:a38c2f099214120938983aa514867ba84"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a59022e6f05c1bd1ae3f5c73fdb20f1c4"><td class="memItemLeft" align="right" valign="top">void CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a59022e6f05c1bd1ae3f5c73fdb20f1c4">CPLPushErrorHandlerEx</a> (CPLErrorHandler, void *)</td></tr> <tr class="separator:a59022e6f05c1bd1ae3f5c73fdb20f1c4"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a231856620be4fb2404dd0dc9fb79d292"><td class="memItemLeft" align="right" valign="top">void CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a231856620be4fb2404dd0dc9fb79d292">CPLPopErrorHandler</a> (void)</td></tr> <tr class="separator:a231856620be4fb2404dd0dc9fb79d292"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8044a8dc3acec5aa55fdf0b1c9c1c952"><td class="memItemLeft" align="right" valign="top">void CPL_DLL CPL_STDCALL void <br class="typebreak"/> CPL_DLL CPL_STDCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="cpl__error_8h.html#a8044a8dc3acec5aa55fdf0b1c9c1c952">_CPLAssert</a> (const char *, const char *, int)</td></tr> <tr class="separator:a8044a8dc3acec5aa55fdf0b1c9c1c952"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>CPL error handling services. </p> </div><h2 class="groupheader">Function Documentation</h2> <a class="anchor" id="a8044a8dc3acec5aa55fdf0b1c9c1c952"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPL_DLL CPL_STDCALL void CPL_DLL CPL_STDCALL _CPLAssert </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"><em>pszExpression</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"><em>pszFile</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>iLine</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Report failure of a logical assertion.</p> <p>Applications would normally use the CPLAssert() macro which expands into code calling <a class="el" href="cpl__error_8h.html#a8044a8dc3acec5aa55fdf0b1c9c1c952">_CPLAssert()</a> only if the condition fails. <a class="el" href="cpl__error_8h.html#a8044a8dc3acec5aa55fdf0b1c9c1c952">_CPLAssert()</a> will generate a CE_Fatal error call to CPLError(), indicating the file name, and line number of the failed assertion, as well as containing the assertion itself.</p> <p>There is no reason for application code to call <a class="el" href="cpl__error_8h.html#a8044a8dc3acec5aa55fdf0b1c9c1c952">_CPLAssert()</a> directly. </p> </div> </div> <a class="anchor" id="a0ce3699872cd56bacf12aa4411f1306e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPL_DLL CPLEmergencyError </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"><em>pszMessage</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Fatal error when things are bad.</p> <p>This function should be called in an emergency situation where it is unlikely that a regular error report would work. This would include in the case of heap exhaustion for even small allocations, or any failure in the process of reporting an error (such as TLS allocations).</p> <p>This function should never return. After the error message has been reported as best possible, the application will abort() similarly to how CPLError() aborts on CE_Fatal class errors.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">pszMessage</td><td>the error message to report. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a2210503e49b3942db841416fbb65b5f6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPL_DLL CPL_STDCALL CPLErrorReset </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Erase any traces of previous errors.</p> <p>This is normally used to ensure that an error which has been recovered from does not appear to be still in play with high level functions. </p> </div> </div> <a class="anchor" id="a5ed4d11b005156695777b64dbebe421d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPL_DLL* CPL_STDCALL CPLGetErrorHandlerUserData </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Fetch the user data for the error context</p> <p>Fetches the user data for the current error context. You can set the user data for the error context when you add your handler by issuing <a class="el" href="cpl__error_8h.html#a58b73907669501fde37db8f7b97289ff">CPLSetErrorHandlerEx()</a> and <a class="el" href="cpl__error_8h.html#a59022e6f05c1bd1ae3f5c73fdb20f1c4">CPLPushErrorHandlerEx()</a>. Note that user data is primarily intended for providing context within error handlers themselves, but they could potentially be abused in other useful ways with the usual caveat emptor understanding.</p> <dl class="section return"><dt>Returns</dt><dd>the user data pointer for the error context </dd></dl> </div> </div> <a class="anchor" id="a4d7519cf9b02915faf47d7d0481ae279"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char CPL_DLL* CPL_STDCALL CPLGetLastErrorMsg </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Get the last error message.</p> <p>Fetches the last error message posted with CPLError(), that hasn't been cleared by <a class="el" href="cpl__error_8h.html#a2210503e49b3942db841416fbb65b5f6">CPLErrorReset()</a>. The returned pointer is to an internal string that should not be altered or freed.</p> <dl class="section return"><dt>Returns</dt><dd>the last error message, or NULL if there is no posted error message. </dd></dl> </div> </div> <a class="anchor" id="a6368517aef108fe852c969e0b3489ff4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int CPL_DLL CPL_STDCALL CPLGetLastErrorNo </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Fetch the last error number.</p> <p>Fetches the last error number posted with CPLError(), that hasn't been cleared by <a class="el" href="cpl__error_8h.html#a2210503e49b3942db841416fbb65b5f6">CPLErrorReset()</a>. This is the error number, not the error class.</p> <dl class="section return"><dt>Returns</dt><dd>the error number of the last error to occur, or CPLE_None (0) if there are no posted errors. </dd></dl> </div> </div> <a class="anchor" id="a21183f30769cafa434e33ec4940d1da5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">CPLErr CPL_DLL CPL_STDCALL CPLGetLastErrorType </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Fetch the last error type.</p> <p>Fetches the last error type posted with CPLError(), that hasn't been cleared by <a class="el" href="cpl__error_8h.html#a2210503e49b3942db841416fbb65b5f6">CPLErrorReset()</a>. This is the error class, not the error number.</p> <dl class="section return"><dt>Returns</dt><dd>the error type of the last error to occur, or CE_None (0) if there are no posted errors. </dd></dl> </div> </div> <a class="anchor" id="a231856620be4fb2404dd0dc9fb79d292"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPL_DLL CPL_STDCALL CPLPopErrorHandler </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Pop error handler off stack.</p> <p>Discards the current error handler on the error handler stack, and restores the one in use before the last <a class="el" href="cpl__error_8h.html#a38c2f099214120938983aa514867ba84">CPLPushErrorHandler()</a> call. This method has no effect if there are no error handlers on the current threads error handler stack. </p> </div> </div> <a class="anchor" id="a38c2f099214120938983aa514867ba84"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPL_DLL CPL_STDCALL CPLPushErrorHandler </td> <td>(</td> <td class="paramtype">CPLErrorHandler </td> <td class="paramname"><em>pfnErrorHandlerNew</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Push a new CPLError handler.</p> <p>This pushes a new error handler on the thread-local error handler stack. This handler will be used until removed with <a class="el" href="cpl__error_8h.html#a231856620be4fb2404dd0dc9fb79d292">CPLPopErrorHandler()</a>.</p> <p>The <a class="el" href="cpl__error_8h.html#a1b842be468b9cef24efeaa8a23b8f8f0">CPLSetErrorHandler()</a> docs have further information on how CPLError handlers work.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">pfnErrorHandlerNew</td><td>new error handler function. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a59022e6f05c1bd1ae3f5c73fdb20f1c4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPL_DLL CPL_STDCALL CPLPushErrorHandlerEx </td> <td>(</td> <td class="paramtype">CPLErrorHandler </td> <td class="paramname"><em>pfnErrorHandlerNew</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>pUserData</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Push a new CPLError handler with user data on the error context.</p> <p>This pushes a new error handler on the thread-local error handler stack. This handler will be used until removed with <a class="el" href="cpl__error_8h.html#a231856620be4fb2404dd0dc9fb79d292">CPLPopErrorHandler()</a>. Obtain the user data back by using CPLGetErrorContext().</p> <p>The <a class="el" href="cpl__error_8h.html#a1b842be468b9cef24efeaa8a23b8f8f0">CPLSetErrorHandler()</a> docs have further information on how CPLError handlers work.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">pfnErrorHandlerNew</td><td>new error handler function. </td></tr> <tr><td class="paramname">pUserData</td><td>User data to put on the error context. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a1b842be468b9cef24efeaa8a23b8f8f0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">CPLErrorHandler CPL_DLL CPL_STDCALL CPLSetErrorHandler </td> <td>(</td> <td class="paramtype">CPLErrorHandler </td> <td class="paramname"><em>pfnErrorHandlerNew</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Install custom error handler.</p> <p>Allow the library's user to specify his own error handler function. A valid error handler is a C function with the following prototype:</p> <pre> void MyErrorHandler(CPLErr eErrClass, int err_no, const char *msg) </pre><p>Pass NULL to come back to the default behavior. The default behaviour (CPLDefaultErrorHandler()) is to write the message to stderr.</p> <p>The msg will be a partially formatted error message not containing the "ERROR %d:" portion emitted by the default handler. Message formatting is handled by CPLError() before calling the handler. If the error handler function is passed a CE_Fatal class error and returns, then CPLError() will call abort(). Applications wanting to interrupt this fatal behaviour will have to use longjmp(), or a C++ exception to indirectly exit the function.</p> <p>Another standard error handler is CPLQuietErrorHandler() which doesn't make any attempt to report the passed error or warning messages but will process debug messages via CPLDefaultErrorHandler.</p> <p>Note that error handlers set with <a class="el" href="cpl__error_8h.html#a1b842be468b9cef24efeaa8a23b8f8f0">CPLSetErrorHandler()</a> apply to all threads in an application, while error handlers set with CPLPushErrorHandler are thread-local. However, any error handlers pushed with CPLPushErrorHandler (and not removed with CPLPopErrorHandler) take precidence over the global error handlers set with <a class="el" href="cpl__error_8h.html#a1b842be468b9cef24efeaa8a23b8f8f0">CPLSetErrorHandler()</a>. Generally speaking <a class="el" href="cpl__error_8h.html#a1b842be468b9cef24efeaa8a23b8f8f0">CPLSetErrorHandler()</a> would be used to set a desired global error handler, while <a class="el" href="cpl__error_8h.html#a38c2f099214120938983aa514867ba84">CPLPushErrorHandler()</a> would be used to install a temporary local error handler, such as CPLQuietErrorHandler() to suppress error reporting in a limited segment of code.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">pfnErrorHandlerNew</td><td>new error handler function. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>returns the previously installed error handler. </dd></dl> </div> </div> <a class="anchor" id="a58b73907669501fde37db8f7b97289ff"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">CPLErrorHandler CPL_DLL CPL_STDCALL CPLSetErrorHandlerEx </td> <td>(</td> <td class="paramtype">CPLErrorHandler </td> <td class="paramname"><em>pfnErrorHandlerNew</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>pUserData</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Install custom error handle with user's data. This method is essentially CPLSetErrorHandler with an added pointer to pUserData. The pUserData is not returned in the CPLErrorHandler, however, and must be fetched via CPLGetLastErrorUserData</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">pfnErrorHandlerNew</td><td>new error handler function. </td></tr> <tr><td class="paramname">pUserData</td><td>User data to carry along with the error context. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>returns the previously installed error handler. </dd></dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.5 </small></address> </body> </html>