Changes between Initial Version and Version 1 of rfc11_fastidentify


Ignore:
Timestamp:
Apr 28, 2007, 2:45:21 PM (17 years ago)
Author:
warmerdam
Comment:

Preliminary pass...

Legend:

Unmodified
Added
Removed
Modified
  • rfc11_fastidentify

    v1 v1  
     1= RFC 11: Fast Format Identification =
     2
     3== Summary ==
     4
     5This RFC aims to add the ability for applications to quickly identify what files in the file system are GDAL supported file formats without necessarily opening any of them.  It is mainly intended to allow GUI file browsers based on file types.
     6
     7This is accomplished by extending the GDALOpenInfo structure to hold more directory context, and by adding an Identify() method on the GDALDriver which a driver can implement to quickly identify that a file is of a given format without doing a more expensive Open() operation.
     8
     9== GDALOpenInfo ==
     10
     11The Open() (or Identify()) methods of many drivers need to probe for files associated with the target file in order to open or identify a file as being of a particular format.  For instance, in order to open an ESRI BIL file (EHDR driver) it is necessary to probe for a driver with the same basename as the target file, but the extension .hdr.  Currently this is typically accomplished with VSIFStatL() calls or similar which can be fairly expensive.
     12
     13In order to reduce the need for such searches touch the operating system file system machinery, the GDALOpenInfo structure will be extended to hold an optional list of files.  This is the list of all files at the same level in the file system as the target file, including the target file.  The filenames will ''not'' include any path components, are an essentially just the output of CPLReadDir() on the parent directory.  If the target object does not have filesystem semantics then the file list should be NULL.
     14
     15The following is added to GDALOpenInfo:
     16
     17{{{
     18           GDALOpenInfo( const char * pszFile, GDALAccess eAccessIn, char **papszSiblings );
     19    char **papszSiblingFiles;
     20}}}
     21
     22The new constructor allows the file list to be passed in to populate the papszSiblingFiles member (the argument will be copied).  The existing default constructor will use CPLGetDirname() to get the directory of the passed pszFile, and CPLReadDir() to read the corresponding file list.  The new constructor is primarily aimed at efficient implementation of the later GDALIdentifyDriver() function, avoiding re-reading the file list for each file to be tested.
     23
     24== Identify() ==
     25
     26The GDALDriver class will be extended with the following function:
     27
     28{{{
     29  int      (*pfnIdentify)( GDALOpenInfo * );
     30}}}
     31
     32When implemented by a driver, the function is intended to return TRUE (non-zero) if the driver determines that the file passed in via GDALOpenInfo appears to be of the format the driver is implemented for.  To call this applications should call the new function:
     33
     34{{{
     35  GDALDriverH *GDALIdentifyDriver( const char *pszDatasource, const char **papszDirFiles );
     36}}}
     37