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

OGRSFDriverRegistrar Class Reference

#include <ogrsf_frmts.h>

List of all members.

Public Member Functions

void RegisterDriver (OGRSFDriver *poDriver)
int GetDriverCount (void)
OGRSFDriverGetDriver (int iDriver)

Static Public Member Functions

OGRSFDriverRegistrarGetRegistrar ()
OGRDataSourceOpen (const char *pszName, int bUpdate=FALSE, OGRSFDriver **ppoDriver=NULL)


Detailed Description

Singleton manager for drivers.


Member Function Documentation

OGRSFDriver * OGRSFDriverRegistrar::GetDriver int  iDriver  ) 
 

Fetch the indicated driver.

This method is the same as the C function OGRGetDriver().

Parameters:
iDriver the driver index, from 0 to GetDriverCount()-1.
Returns:
the driver, or NULL if iDriver is out of range.

int OGRSFDriverRegistrar::GetDriverCount void   ) 
 

Fetch the number of registered drivers.

This method is the same as the C function OGRGetDriverCount().

Returns:
the drivers count.

OGRSFDriverRegistrar * OGRSFDriverRegistrar::GetRegistrar  )  [static]
 

Return the driver manager, creating one if none exist.

Returns:
the driver manager.

OGRDataSource * OGRSFDriverRegistrar::Open const char *  pszName,
int  bUpdate = FALSE,
OGRSFDriver **  ppoDriver = NULL
[static]
 

Open a file / data source with one of the registered drivers.

This method loops through all the drivers registered with the driver manager trying each until one succeeds with the given data source. This method is static. Applications don't normally need to use any other OGRSFDriverRegistrar methods directly, not do they normally need to have a pointer to an OGRSFDriverRegistrar instance.

If this method fails, CPLGetLastErrorMsg() can be used to check if there is an error message explaining why.

This method is the same as the C function OGROpen().

Parameters:
pszName the name of the file, or data source to open.
bUpdate FALSE for read-only access (the default) or TRUE for read-write access.
ppoDriver if non-NULL, this argument will be updated with a pointer to the driver which was used to open the data source.
Returns:
NULL on error or if the pass name is not supported by this driver, otherwise a pointer to an OGRDataSource. This OGRDataSource should be closed by deleting the object when it is no longer needed.
Example:

    OGRDataSource	*poDS;

    poDS = OGRSFDriverRegistrar::Open( "polygon.shp" );
    if( poDS == NULL )
    {
        return;
    }

    ... use the data source ...

    delete poDS;
  

void OGRSFDriverRegistrar::RegisterDriver OGRSFDriver poDriver  ) 
 

Add a driver to the list of registered drivers.

If the passed driver is already registered (based on pointer comparison) then the driver isn't registered. New drivers are added at the end of the list of registered drivers.

This method is the same as the C function OGRRegisterDriver().

Parameters:
poDriver the driver to add.


The documentation for this class was generated from the following files:
Generated on Mon Aug 9 12:08:53 2004 for OGR by doxygen 1.3.8