#include <ogrsf_frmts.h>
Public Member Functions | |
void | RegisterDriver (OGRSFDriver *poDriver) |
int | GetDriverCount (void) |
OGRSFDriver * | GetDriver (int iDriver) |
void | AutoLoadDrivers () |
Static Public Member Functions | |
static OGRSFDriverRegistrar * | GetRegistrar () |
static OGRDataSource * | Open (const char *pszName, int bUpdate=FALSE, OGRSFDriver **ppoDriver=NULL) |
void OGRSFDriverRegistrar::AutoLoadDrivers | ( | ) |
Auto-load GDAL drivers from shared libraries.
This function will automatically load drivers from shared libraries. It searches the "driver path" for .so (or .dll) files that start with the prefix "gdal_X.so". It then tries to load them and then tries to call a function within them called GDALRegister_X() where the 'X' is the same as the remainder of the shared library basename, or failing that to call GDALRegisterMe().
There are a few rules for the driver path. If the GDAL_DRIVER_PATH environment variable it set, it is taken to be a list of directories to search separated by colons on unix, or semi-colons on Windows. Otherwise the /usr/local/lib/gdalplugins directory, and (if known) the lib/gdalplugins subdirectory of the gdal home directory are searched.
References CPLFormFilename(), CPLGetBasename(), CPLGetDirname(), CPLGetExecPath(), CPLGetExtension(), and CPLGetSymbol().
Referenced by OGRRegisterAll().
OGRSFDriver * OGRSFDriverRegistrar::GetDriver | ( | int | iDriver | ) |
Fetch the indicated driver.
This method is the same as the C function OGRGetDriver().
iDriver | the driver index, from 0 to GetDriverCount()-1. |
Referenced by OGRGetDriver().
int OGRSFDriverRegistrar::GetDriverCount | ( | void | ) |
Fetch the number of registered drivers.
This method is the same as the C function OGRGetDriverCount().
Referenced by OGRGetDriverCount().
OGRSFDriverRegistrar * OGRSFDriverRegistrar::GetRegistrar | ( | ) | [static] |
Return the driver manager, creating one if none exist.
Referenced by OGRRegisterAll(), OGRRegisterDriver(), Open(), and OGRDataSource::Release().
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().
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. |
OGRDataSource *poDS;
poDS = OGRSFDriverRegistrar::Open( "polygon.shp" ); if( poDS == NULL ) { return; }
... use the data source ...
delete poDS;
References OGRDataSource::GetDriver(), OGRSFDriver::GetName(), GetRegistrar(), OGRDataSource::m_poDriver, nDrivers, OGRSFDriver::Open(), papoDrivers, and OGRDataSource::Reference().
Referenced by OGROpen().
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().
poDriver | the driver to add. |
Referenced by OGRRegisterDriver().