Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > by-pkgid > d67485fb8ce60f8952179bbde3b5d022 > files > 102

libgdal0-devel-1.1.7-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>gdaldriver.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.2.3-20001105 on Thu Mar 28 09:47:30 2002 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; </center>
<hr><h1>gdaldriver.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
00002 <font class="comment"> * $Id: gdaldriver_cpp-source.html,v 1.10 2002/04/16 13:11:48 warmerda Exp $</font>
00003 <font class="comment"> *</font>
00004 <font class="comment"> * Project:  GDAL Core</font>
00005 <font class="comment"> * Purpose:  Implementation of GDALDriver class (and C wrappers)</font>
00006 <font class="comment"> * Author:   Frank Warmerdam, warmerda@home.com</font>
00007 <font class="comment"> *</font>
00008 <font class="comment"> ******************************************************************************</font>
00009 <font class="comment"> * Copyright (c) 1998, 2000, Frank Warmerdam</font>
00010 <font class="comment"> *</font>
00011 <font class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</font>
00012 <font class="comment"> * copy of this software and associated documentation files (the "Software"),</font>
00013 <font class="comment"> * to deal in the Software without restriction, including without limitation</font>
00014 <font class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</font>
00015 <font class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</font>
00016 <font class="comment"> * Software is furnished to do so, subject to the following conditions:</font>
00017 <font class="comment"> *</font>
00018 <font class="comment"> * The above copyright notice and this permission notice shall be included</font>
00019 <font class="comment"> * in all copies or substantial portions of the Software.</font>
00020 <font class="comment"> *</font>
00021 <font class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</font>
00022 <font class="comment"> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</font>
00023 <font class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</font>
00024 <font class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</font>
00025 <font class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</font>
00026 <font class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</font>
00027 <font class="comment"> * DEALINGS IN THE SOFTWARE.</font>
00028 <font class="comment"> ******************************************************************************</font>
00029 <font class="comment"> *</font>
00030 <font class="comment"> * $Log: gdaldriver_cpp-source.html,v $
00030 <font class="comment"> * Revision 1.10  2002/04/16 13:11:48  warmerda
00030 <font class="comment"> * updated
00030 <font class="comment"> *</font>
00031 <font class="comment"> * Revision 1.23  2001/12/15 15:47:54  warmerda</font>
00032 <font class="comment"> * don't replace existing descriptions</font>
00033 <font class="comment"> *</font>
00034 <font class="comment"> * Revision 1.22  2001/12/15 15:42:27  warmerda</font>
00035 <font class="comment"> * *** empty log message ***</font>
00036 <font class="comment"> *</font>
00037 <font class="comment"> * Revision 1.21  2001/10/05 20:35:26  warmerda</font>
00038 <font class="comment"> * CreateCopy() won't try to write default geotransform</font>
00039 <font class="comment"> *</font>
00040 <font class="comment"> * Revision 1.20  2001/09/24 15:58:27  warmerda</font>
00041 <font class="comment"> * improved progress reporting in createcopy</font>
00042 <font class="comment"> *</font>
00043 <font class="comment"> * Revision 1.19  2001/07/18 04:04:30  warmerda</font>
00044 <font class="comment"> * added CPL_CVSID</font>
00045 <font class="comment"> *</font>
00046 <font class="comment"> * Revision 1.18  2001/02/15 16:30:34  warmerda</font>
00047 <font class="comment"> * added create debug message</font>
00048 <font class="comment"> *</font>
00049 <font class="comment"> * Revision 1.17  2000/10/06 15:26:49  warmerda</font>
00050 <font class="comment"> * make buffer size for copying image data the exact size, fixing bug with complex data</font>
00051 <font class="comment"> *</font>
00052 <font class="comment"> * Revision 1.16  2000/07/13 17:34:11  warmerda</font>
00053 <font class="comment"> * Set description for CopyCreate() method.</font>
00054 <font class="comment"> *</font>
00055 <font class="comment"> * Revision 1.15  2000/07/13 17:27:48  warmerda</font>
00056 <font class="comment"> * added SetDescription after create</font>
00057 <font class="comment"> *</font>
00058 <font class="comment"> * Revision 1.14  2000/06/27 16:47:28  warmerda</font>
00059 <font class="comment"> * added cancel support for CopyCreate progress func</font>
00060 <font class="comment"> *</font>
00061 <font class="comment"> * Revision 1.13  2000/06/26 18:47:14  warmerda</font>
00062 <font class="comment"> * Ensure pszHelpTopic is initialized</font>
00063 <font class="comment"> *</font>
00064 <font class="comment"> * Revision 1.12  2000/04/30 23:22:16  warmerda</font>
00065 <font class="comment"> * added CreateCopy support</font>
00066 <font class="comment"> *</font>
00067 <font class="comment"> * Revision 1.11  2000/03/06 02:21:15  warmerda</font>
00068 <font class="comment"> * Added help topic C function</font>
00069 <font class="comment"> *</font>
00070 <font class="comment"> * Revision 1.10  2000/01/31 16:24:01  warmerda</font>
00071 <font class="comment"> * use failure, not fatal</font>
00072 <font class="comment"> *</font>
00073 <font class="comment"> * Revision 1.9  2000/01/31 15:00:25  warmerda</font>
00074 <font class="comment"> * added some documentation</font>
00075 <font class="comment"> *</font>
00076 <font class="comment"> * Revision 1.8  2000/01/31 14:24:36  warmerda</font>
00077 <font class="comment"> * implemented dataset delete</font>
00078 <font class="comment"> *</font>
00079 <font class="comment"> * Revision 1.7  2000/01/13 04:13:10  pgs</font>
00080 <font class="comment"> * added initialization of pfnCreate = NULL to prevent run-time crash when format doesn't support creating a file</font>
00081 <font class="comment"> *</font>
00082 <font class="comment"> * Revision 1.6  1999/12/08 14:40:50  warmerda</font>
00083 <font class="comment"> * Fixed error message.</font>
00084 <font class="comment"> *</font>
00085 <font class="comment"> * Revision 1.5  1999/10/21 13:22:10  warmerda</font>
00086 <font class="comment"> * Added GDALGetDriverShort/LongName().</font>
00087 <font class="comment"> *</font>
00088 <font class="comment"> * Revision 1.4  1999/01/11 15:36:50  warmerda</font>
00089 <font class="comment"> * Added GDALCreate()</font>
00090 <font class="comment"> *</font>
00091 <font class="comment"> * Revision 1.3  1998/12/31 18:54:53  warmerda</font>
00092 <font class="comment"> * Flesh out create method.</font>
00093 <font class="comment"> *</font>
00094 <font class="comment"> * Revision 1.2  1998/12/06 22:17:32  warmerda</font>
00095 <font class="comment"> * Add stub Create() method</font>
00096 <font class="comment"> *</font>
00097 <font class="comment"> * Revision 1.1  1998/12/03 18:32:01  warmerda</font>
00098 <font class="comment"> * New</font>
00099 <font class="comment"> *</font>
00100 <font class="comment"> */</font>
00101 
00102 <font class="preprocessor">#include "gdal_priv.h"</font>
00103 
00104 CPL_CVSID(<font class="stringliteral">"$Id: gdaldriver_cpp-source.html,v 1.10 2002/04/16 13:11:48 warmerda Exp $"</font>);
00105 
00106 <font class="comment">/************************************************************************/</font>
00107 <font class="comment">/*                             GDALDriver()                             */</font>
00108 <font class="comment">/************************************************************************/</font>
00109 
00110 GDALDriver::GDALDriver()<font class="keyword"></font>
00111 <font class="keyword"></font>
00112 <font class="keyword"></font>{
00113     pszShortName = NULL;
00114     pszLongName = NULL;
00115     pszHelpTopic = NULL;
00116 
00117     pfnOpen = NULL;
00118     pfnCreate = NULL;
00119     pfnDelete = NULL;
00120     pfnCreateCopy = NULL;
00121 }
00122 
00123 <font class="comment">/************************************************************************/</font>
00124 <font class="comment">/*                            ~GDALDriver()                             */</font>
00125 <font class="comment">/************************************************************************/</font>
00126 
00127 GDALDriver::~GDALDriver()<font class="keyword"></font>
00128 <font class="keyword"></font>
00129 <font class="keyword"></font>{
00130 }
00131 
00132 <font class="comment">/************************************************************************/</font>
00133 <font class="comment">/*                               Create()                               */</font>
00134 <font class="comment">/************************************************************************/</font>
00135 
<a name="l00154"></a><a class="code" href="class_GDALDriver.html#a2">00154</a> <a class="code" href="class_GDALDataset.html">GDALDataset</a> * <a class="code" href="class_GDALDriver.html#a2">GDALDriver::Create</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> * pszFilename,
00155                                   <font class="keywordtype">int</font> nXSize, <font class="keywordtype">int</font> nYSize, <font class="keywordtype">int</font> nBands,
00156                                   GDALDataType eType, <font class="keywordtype">char</font> ** papszParmList )<font class="keyword"></font>
00157 <font class="keyword"></font>
00158 <font class="keyword"></font>{
00159     <font class="comment">/* notdef: should add a bunch of error checking here */</font>
00160 
00161     <font class="keywordflow">if</font>( pfnCreate == NULL )
00162     {
00163         <a class="code" href="cpl_error_h.html#a17">CPLError</a>( CE_Failure, CPLE_NotSupported,
00164                   <font class="stringliteral">"GDALDriver::Create() ... no create method implemented"</font>
00165                   <font class="stringliteral">" for this format.\n"</font> );
00166 
00167         <font class="keywordflow">return</font> NULL;
00168     }
00169     <font class="keywordflow">else</font>
00170     {
00171         <a class="code" href="class_GDALDataset.html">GDALDataset</a> *poDS;
00172 
00173         <a class="code" href="cpl_error_h.html#a29">CPLDebug</a>( <font class="stringliteral">"GDAL"</font>, <font class="stringliteral">"GDALDriver::Create(%s,%s,%d,%d,%d,%s,%p)"</font>,
00174                   pszShortName, pszFilename, nXSize, nYSize, nBands, 
00175                   GDALGetDataTypeName( eType ), 
00176                   papszParmList );
00177               
00178         poDS = pfnCreate( pszFilename, nXSize, nYSize, nBands, eType,
00179                           papszParmList );
00180 
00181         <font class="keywordflow">if</font>( poDS != NULL )
00182         {
00183             <font class="keywordflow">if</font>( poDS-&gt;GetDescription() == NULL 
00184                 || strlen(poDS-&gt;GetDescription()) &gt; 0 )
00185                 poDS-&gt;SetDescription( pszFilename );
00186 
00187             <font class="keywordflow">if</font>( poDS-&gt;poDriver == NULL )
00188                 poDS-&gt;poDriver = <font class="keyword">this</font>;
00189         }
00190 
00191         <font class="keywordflow">return</font> poDS;
00192     }
00193 }
00194 
00195 <font class="comment">/************************************************************************/</font>
00196 <font class="comment">/*                             GDALCreate()                             */</font>
00197 <font class="comment">/************************************************************************/</font>
00198 
00199 GDALDatasetH CPL_DLL GDALCreate( GDALDriverH hDriver,
00200                                  <font class="keyword">const</font> <font class="keywordtype">char</font> * pszFilename,
00201                                  <font class="keywordtype">int</font> nXSize, <font class="keywordtype">int</font> nYSize, <font class="keywordtype">int</font> nBands,
00202                                  GDALDataType eBandType,
00203                                  <font class="keywordtype">char</font> ** papszOptions )<font class="keyword"></font>
00204 <font class="keyword"></font>
00205 <font class="keyword"></font>{
00206     <font class="keywordflow">return</font>( ((<a class="code" href="class_GDALDriver.html">GDALDriver</a> *) hDriver)-&gt;Create( pszFilename,
00207                                               nXSize, nYSize, nBands,
00208                                               eBandType, papszOptions ) );
00209 }
00210 
00211 <font class="comment">/************************************************************************/</font>
00212 <font class="comment">/*                             CreateCopy()                             */</font>
00213 <font class="comment">/************************************************************************/</font>
00214 
<a name="l00248"></a><a class="code" href="class_GDALDriver.html#a4">00248</a> <a class="code" href="class_GDALDataset.html">GDALDataset</a> *<a class="code" href="class_GDALDriver.html#a4">GDALDriver::CreateCopy</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> * pszFilename, 
00249                                      <a class="code" href="class_GDALDataset.html">GDALDataset</a> * poSrcDS, 
00250                                      <font class="keywordtype">int</font> bStrict, <font class="keywordtype">char</font> ** papszOptions,
00251                                      GDALProgressFunc pfnProgress,
00252                                      <font class="keywordtype">void</font> * pProgressData )<font class="keyword"></font>
00253 <font class="keyword"></font>
00254 <font class="keyword"></font>{
00255     <font class="keywordflow">if</font>( pfnProgress == NULL )
00256         pfnProgress = GDALDummyProgress;
00257 
00258 <font class="comment">/* -------------------------------------------------------------------- */</font>
00259 <font class="comment">/*      If the format provides a CreateCopy() method use that,          */</font>
00260 <font class="comment">/*      otherwise fallback to the internal implementation using the     */</font>
00261 <font class="comment">/*      Create() method.                                                */</font>
00262 <font class="comment">/* -------------------------------------------------------------------- */</font>
00263     <font class="keywordflow">if</font>( pfnCreateCopy != NULL )
00264     {
00265         <a class="code" href="class_GDALDataset.html">GDALDataset</a> *poDstDS;
00266 
00267         poDstDS = pfnCreateCopy( pszFilename, poSrcDS, bStrict, papszOptions,
00268                                  pfnProgress, pProgressData );
00269         <font class="keywordflow">if</font>( poDstDS != NULL )
00270         {
00271             <font class="keywordflow">if</font>( poDstDS-&gt;GetDescription() == NULL 
00272                 || strlen(poDstDS-&gt;GetDescription()) &gt; 0 )
00273                 poDstDS-&gt;SetDescription( pszFilename );
00274 
00275             <font class="keywordflow">if</font>( poDstDS-&gt;poDriver == NULL )
00276                 poDstDS-&gt;poDriver = <font class="keyword">this</font>;
00277         }
00278 
00279         <font class="keywordflow">return</font> poDstDS;
00280     }
00281     
00282 <font class="comment">/* -------------------------------------------------------------------- */</font>
00283 <font class="comment">/*      Create destination dataset.                                     */</font>
00284 <font class="comment">/* -------------------------------------------------------------------- */</font>
00285     <a class="code" href="class_GDALDataset.html">GDALDataset</a>  *poDstDS;
00286     <font class="keywordtype">int</font>          nXSize = poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a1">GetRasterXSize</a>();
00287     <font class="keywordtype">int</font>          nYSize = poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a2">GetRasterYSize</a>();
00288     GDALDataType eType = poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a4">GetRasterBand</a>(1)-&gt;<a class="code" href="class_GDALRasterBand.html#a5">GetRasterDataType</a>();
00289     CPLErr       eErr;
00290 
00291     <a class="code" href="cpl_error_h.html#a29">CPLDebug</a>( <font class="stringliteral">"GDAL"</font>, <font class="stringliteral">"Using default GDALDriver::CreateCopy implementation."</font> );
00292 
00293     <font class="keywordflow">if</font>( !pfnProgress( 0.0, NULL, pProgressData ) )
00294     {
00295         <a class="code" href="cpl_error_h.html#a17">CPLError</a>( CE_Failure, CPLE_UserInterrupt, <font class="stringliteral">"User terminated"</font> );
00296         <font class="keywordflow">return</font> NULL;
00297     }
00298 
00299     poDstDS = <a class="code" href="class_GDALDriver.html#a2">Create</a>( pszFilename, nXSize, nYSize, 
00300                       poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a3">GetRasterCount</a>(), eType, papszOptions );
00301 
00302     <font class="keywordflow">if</font>( poDstDS == NULL )
00303         <font class="keywordflow">return</font> NULL;
00304 
00305 <font class="comment">/* -------------------------------------------------------------------- */</font>
00306 <font class="comment">/*      Try setting the projection and geotransform if it seems         */</font>
00307 <font class="comment">/*      suitable.  For now we don't try and copy GCPs, though I         */</font>
00308 <font class="comment">/*      suppose we should.                                              */</font>
00309 <font class="comment">/* -------------------------------------------------------------------- */</font>
00310     <font class="keywordtype">double</font>      adfGeoTransform[6];
00311 
00312     <font class="keywordflow">if</font>( poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a8">GetGeoTransform</a>( adfGeoTransform ) == CE_None 
00313         &amp;&amp; (adfGeoTransform[0] != 0.0 
00314             || adfGeoTransform[1] != 1.0
00315             || adfGeoTransform[2] != 0.0
00316             || adfGeoTransform[3] != 0.0
00317             || adfGeoTransform[4] != 0.0
00318             || adfGeoTransform[5] != 1.0) )
00319     {
00320         poDstDS-&gt;<a class="code" href="class_GDALDataset.html#a9">SetGeoTransform</a>( adfGeoTransform );
00321     }
00322 
00323     <font class="keywordflow">if</font>( poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a6">GetProjectionRef</a>() != NULL
00324         &amp;&amp; strlen(poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a6">GetProjectionRef</a>()) &gt; 0 )
00325     {
00326         poDstDS-&gt;<a class="code" href="class_GDALDataset.html#a7">SetProjection</a>( poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a6">GetProjectionRef</a>() );
00327     }
00328 
00329 <font class="comment">/* -------------------------------------------------------------------- */</font>
00330 <font class="comment">/*      Loop copying bands.                                             */</font>
00331 <font class="comment">/* -------------------------------------------------------------------- */</font>
00332     <font class="keywordflow">for</font>( <font class="keywordtype">int</font> iBand = 0; iBand &lt; poSrcDS-&gt;GetRasterCount(); iBand++ )
00333     {
00334         <a class="code" href="class_GDALRasterBand.html">GDALRasterBand</a> *poSrcBand = poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a4">GetRasterBand</a>( iBand+1 );
00335         <a class="code" href="class_GDALRasterBand.html">GDALRasterBand</a> *poDstBand = poDstDS-&gt;<a class="code" href="class_GDALDataset.html#a4">GetRasterBand</a>( iBand+1 );
00336 
00337         <font class="keywordtype">void</font>           *pData;
00338 
00339         pData = <a class="code" href="cpl_conv_h.html#a3">CPLMalloc</a>(nXSize * GDALGetDataTypeSize(eType) / 8);
00340 
00341         <font class="keywordflow">for</font>( <font class="keywordtype">int</font> iLine = 0; iLine &lt; nYSize; iLine++ )
00342         {
00343             eErr = poSrcBand-&gt;<a class="code" href="class_GDALRasterBand.html#a8">RasterIO</a>( GF_Read, 0, iLine, nXSize, 1, 
00344                                         pData, nXSize, 1, eType, 0, 0 );
00345             <font class="keywordflow">if</font>( eErr != CE_None )
00346             {
00347                 <font class="keywordflow">return</font> NULL;
00348             }
00349             
00350             eErr = poDstBand-&gt;<a class="code" href="class_GDALRasterBand.html#a8">RasterIO</a>( GF_Write, 0, iLine, nXSize, 1, 
00351                                         pData, nXSize, 1, eType, 0, 0 );
00352 
00353             <font class="keywordflow">if</font>( eErr != CE_None )
00354             {
00355                 <font class="keywordflow">return</font> NULL;
00356             }
00357 
00358             <font class="keywordflow">if</font>( !pfnProgress( (iBand + (iLine+1) / (<font class="keywordtype">double</font>) nYSize)
00359                               / (<font class="keywordtype">double</font>) poSrcDS-&gt;<a class="code" href="class_GDALDataset.html#a3">GetRasterCount</a>(), 
00360                               NULL, pProgressData ) )
00361             {
00362                 <a class="code" href="cpl_error_h.html#a17">CPLError</a>( CE_Failure, CPLE_UserInterrupt, <font class="stringliteral">"User terminated"</font> );
00363                 <font class="keyword">delete</font> poDstDS;
00364                 <a class="code" href="class_GDALDriver.html#a3">Delete</a>( pszFilename );
00365                 <font class="keywordflow">return</font> NULL;
00366             }
00367         }
00368 
00369         CPLFree( pData );
00370     }
00371 
00372     <font class="keywordflow">return</font> poDstDS;
00373 }
00374 
00375 <font class="comment">/************************************************************************/</font>
00376 <font class="comment">/*                           GDALCreateCopy()                           */</font>
00377 <font class="comment">/************************************************************************/</font>
00378 
00379 GDALDatasetH GDALCreateCopy( GDALDriverH hDriver, 
00380                              <font class="keyword">const</font> <font class="keywordtype">char</font> * pszFilename, 
00381                              GDALDatasetH hSrcDS, 
00382                              <font class="keywordtype">int</font> bStrict, <font class="keywordtype">char</font> ** papszOptions,
00383                              GDALProgressFunc pfnProgress,
00384                              <font class="keywordtype">void</font> * pProgressData )<font class="keyword"></font>
00385 <font class="keyword"></font>
00386 <font class="keyword"></font>{
00387     <font class="keywordflow">return</font> (GDALDatasetH) ((<a class="code" href="class_GDALDriver.html">GDALDriver</a> *) hDriver)-&gt;
00388         CreateCopy( pszFilename, (<a class="code" href="class_GDALDataset.html">GDALDataset</a> *) hSrcDS, bStrict, papszOptions,
00389                     pfnProgress, pProgressData );
00390 }
00391 
00392 <font class="comment">/************************************************************************/</font>
00393 <font class="comment">/*                               Delete()                               */</font>
00394 <font class="comment">/************************************************************************/</font>
00395 
<a name="l00415"></a><a class="code" href="class_GDALDriver.html#a3">00415</a> CPLErr <a class="code" href="class_GDALDriver.html#a3">GDALDriver::Delete</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> * pszFilename )<font class="keyword"></font>
00416 <font class="keyword"></font>
00417 <font class="keyword"></font>{
00418     <font class="keywordflow">if</font>( pfnDelete != NULL )
00419         <font class="keywordflow">return</font> pfnDelete( pszFilename );
00420     <font class="keywordflow">else</font>
00421     {
00422         VSIStatBuf      sStat;
00423 
00424         <font class="keywordflow">if</font>( VSIStat( pszFilename, &amp;sStat ) == 0 &amp;&amp; VSI_ISREG( sStat.st_mode ) )
00425         {
00426             <font class="keywordflow">if</font>( VSIUnlink( pszFilename ) == 0 )
00427                 <font class="keywordflow">return</font> CE_None;
00428             <font class="keywordflow">else</font>
00429             {
00430                 <a class="code" href="cpl_error_h.html#a17">CPLError</a>( CE_Failure, CPLE_AppDefined,
00431                           <font class="stringliteral">"%s: Attempt to unlink %s failed.\n"</font>,
00432                           pszShortName, pszFilename );
00433                 <font class="keywordflow">return</font> CE_Failure;
00434             }
00435         }
00436         <font class="keywordflow">else</font>
00437         {
00438             <a class="code" href="cpl_error_h.html#a17">CPLError</a>( CE_Failure, CPLE_AppDefined,
00439                       <font class="stringliteral">"%s: Unable to delete %s, not a file.\n"</font>,
00440                       pszShortName, pszFilename );
00441             <font class="keywordflow">return</font> CE_Failure;
00442         }
00443     }
00444 }
00445 
00446 <font class="comment">/************************************************************************/</font>
00447 <font class="comment">/*                             GDALDelete()                             */</font>
00448 <font class="comment">/************************************************************************/</font>
00449 
00450 CPLErr GDALDeleteDataset( GDALDriverH hDriver, <font class="keyword">const</font> <font class="keywordtype">char</font> * pszFilename )<font class="keyword"></font>
00451 <font class="keyword"></font>
00452 <font class="keyword"></font>{
00453     <font class="keywordflow">return</font> ((<a class="code" href="class_GDALDriver.html">GDALDriver</a> *) hDriver)-&gt;Delete( pszFilename );
00454 }
00455 
00456 <font class="comment">/************************************************************************/</font>
00457 <font class="comment">/*                       GDALGetDriverShortName()                       */</font>
00458 <font class="comment">/************************************************************************/</font>
00459 
00460 <font class="keyword">const</font> <font class="keywordtype">char</font> * GDALGetDriverShortName( GDALDriverH hDriver )<font class="keyword"></font>
00461 <font class="keyword"></font>
00462 <font class="keyword"></font>{
00463     <font class="keywordflow">if</font>( hDriver == NULL )
00464         <font class="keywordflow">return</font> NULL;
00465     <font class="keywordflow">else</font>
00466         <font class="keywordflow">return</font> ((<a class="code" href="class_GDALDriver.html">GDALDriver</a> *) hDriver)-&gt;pszShortName;
00467 }
00468 
00469 <font class="comment">/************************************************************************/</font>
00470 <font class="comment">/*                       GDALGetDriverLongName()                        */</font>
00471 <font class="comment">/************************************************************************/</font>
00472 
00473 <font class="keyword">const</font> <font class="keywordtype">char</font> * GDALGetDriverLongName( GDALDriverH hDriver )<font class="keyword"></font>
00474 <font class="keyword"></font>
00475 <font class="keyword"></font>{
00476     <font class="keywordflow">if</font>( hDriver == NULL )
00477         <font class="keywordflow">return</font> NULL;
00478     <font class="keywordflow">else</font>
00479         <font class="keywordflow">return</font> ((<a class="code" href="class_GDALDriver.html">GDALDriver</a> *) hDriver)-&gt;pszLongName;
00480 }
00481 
00482 <font class="comment">/************************************************************************/</font>
00483 <font class="comment">/*                       GDALGetDriverHelpTopic()                       */</font>
00484 <font class="comment">/************************************************************************/</font>
00485 
00486 <font class="keyword">const</font> <font class="keywordtype">char</font> * GDALGetDriverHelpTopic( GDALDriverH hDriver )<font class="keyword"></font>
00487 <font class="keyword"></font>
00488 <font class="keyword"></font>{
00489     <font class="keywordflow">if</font>( hDriver == NULL )
00490         <font class="keywordflow">return</font> NULL;
00491     <font class="keywordflow">else</font>
00492         <font class="keywordflow">return</font> ((<a class="code" href="class_GDALDriver.html">GDALDriver</a> *) hDriver)-&gt;pszHelpTopic;
00493 }
00494 
</div></pre><hr><address><small>Generated at Thu Mar 28 09:47:30 2002 for GDAL by
<a href="http://www.stack.nl/~dimitri/doxygen/index.html">
<img src="doxygen.gif" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.3-20001105 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2000</small></address>
</body>
</html>