# GDALDriverManager Class Reference

Class for managing the registration of file format drivers. More...

`#include <gdal_priv.h>`

Inheritance diagram for GDALDriverManager:

List of all members.

## Public Member Functions
int | GetDriverCount (void)
| Fetch the number of registered drivers.
GDALDriver * | GetDriver (int)
| Fetch driver by index.
GDALDriver * | GetDriverByName (const char *)
| Fetch a driver based on the short name.
int | RegisterDriver (GDALDriver *)
| Register a driver for use.
void | MoveDriver (GDALDriver *, int)
void | DeregisterDriver (GDALDriver *)
| Deregister the passed driver.
void | AutoLoadDrivers ()
| Auto-load GDAL drivers from shared libraries.
void | AutoSkipDrivers ()
| This method unload undesirable drivers.
const char * | GetHome ()
void | SetHome (const char *)

## Detailed Description

Class for managing the registration of file format drivers.

Use GetGDALDriverManager() to fetch the global singleton instance of this class.

## Member Function Documentation

int GDALDriverManager::GetDriverCount | ( | void |  | ) |

Fetch the number of registered drivers.

This C analog to this is GDALGetDriverCount().

Returns:
  the number of registered drivers.

Referenced by GDALGetDriverCount(), and GDALIdentifyDriver().

GDALDriver * GDALDriverManager::GetDriver | ( | int | iDriver | ) |

Fetch driver by index.

This C analog to this is GDALGetDriver().

Parameters:

  | iDriver | the driver index from 0 to GetDriverCount()-1.

Returns:
  the driver identified by the index or NULL if the index is invalid

Referenced by GDALGetDriver(), and GDALIdentifyDriver().

GDALDriver * GDALDriverManager::GetDriverByName | ( | const char * | pszName | ) |

Fetch a driver based on the short name.

The C analog is the GDALGetDriverByName() function.

Parameters:

  | pszName | the short name, such as GTiff, being searched for.

Returns:
  the identified driver, or NULL if no match is found.

References GDALMajorObject::GetDescription().

Referenced by AutoSkipDrivers(), GDALGetDriverByName(), and RegisterDriver().

int GDALDriverManager::RegisterDriver | ( | GDALDriver * | poDriver | ) |

Register a driver for use.

The C analog is GDALRegisterDriver().

Normally this method is used by format specific C callable registration entry points such as GDALRegister_GTiff() rather than being called directly by application level code.

If this driver (based on the object pointer, not short name) is already registered, then no change is made, and the index of the existing driver is returned. Otherwise the driver list is extended, and the new driver is added at the end.

Parameters:

  | poDriver | the driver to register.

Returns:
  the index of the new installed driver.

References GDALMajorObject::GetDescription(), GetDriverByName(), GDALDriver::pfnCreate, GDALDriver::pfnCreateCopy, and GDALMajorObject::SetMetadataItem().

Referenced by GDALRegisterDriver().

void GDALDriverManager::DeregisterDriver | ( | GDALDriver * | poDriver | ) |

Deregister the passed driver.

If the driver isn't found no change is made.

The C analog is GDALDeregisterDriver().

Parameters:

  | poDriver | the driver to deregister.

Referenced by AutoSkipDrivers(), and GDALDeregisterDriver().

void GDALDriverManager::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 ('X' is case sensitive), 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 on UNIX and on Windows.

References CPLFormFilename(), CPLGetBasename(), CPLGetDirname(), CPLGetExecPath(), CPLGetExtension(), CPLGetSymbol(), CPLString::Printf(), and VSIStatL().

Referenced by GDALAllRegister().

void GDALDriverManager::AutoSkipDrivers | ( |  | ) |

This method unload undesirable drivers.

All drivers specified in the space delimited list in the GDAL_SKIP environment variable) will be deregistered and destroyed. This method should normally be called after registration of standard drivers to allow the user a way of unloading undesired drivers. The GDALAllRegister() function already invokes AutoSkipDrivers() at the end, so if that functions is called, it should not be necessary to call this method from application code.

References DeregisterDriver(), and GetDriverByName().

Referenced by GDALAllRegister().

The documentation for this class was generated from the following files:

- gdal_priv.h
- gdaldrivermanager.cpp

Generated for GDAL by 1.5.6.