GDAL
|
OGRMutexedDataSource class protects all virtual methods of OGRDataSource with a mutex. More...
#include <ogrmutexeddatasource.h>
Public Member Functions | |
OGRMutexedDataSource (OGRDataSource *poBaseDataSource, int bTakeOwnership, CPLMutex *hMutexIn, int bWrapLayersInMutexedLayer) | |
OGRDataSource * | GetBaseDataSource () |
virtual const char * | GetName () |
virtual int | GetLayerCount () |
Get the number of layers in this dataset. More... | |
virtual OGRLayer * | GetLayer (int) |
Fetch a layer by index. More... | |
virtual OGRLayer * | GetLayerByName (const char *) |
Fetch a layer by name. More... | |
virtual OGRErr | DeleteLayer (int) |
Delete the indicated layer from the datasource. More... | |
virtual int | TestCapability (const char *) |
Test if capability is available. More... | |
virtual OGRLayer * | ICreateLayer (const char *pszName, OGRSpatialReference *poSpatialRef=NULL, OGRwkbGeometryType eGType=wkbUnknown, char **papszOptions=NULL) |
This method attempts to create a new layer on the dataset with the indicated name, coordinate system, geometry type. More... | |
virtual OGRLayer * | CopyLayer (OGRLayer *poSrcLayer, const char *pszNewName, char **papszOptions=NULL) |
Duplicate an existing layer. More... | |
virtual OGRStyleTable * | GetStyleTable () |
Returns dataset style table. More... | |
virtual void | SetStyleTableDirectly (OGRStyleTable *poStyleTable) |
Set dataset style table. More... | |
virtual void | SetStyleTable (OGRStyleTable *poStyleTable) |
Set dataset style table. More... | |
virtual OGRLayer * | ExecuteSQL (const char *pszStatement, OGRGeometry *poSpatialFilter, const char *pszDialect) |
Execute an SQL statement against the data store. More... | |
virtual void | ReleaseResultSet (OGRLayer *poResultsSet) |
Release results of ExecuteSQL(). More... | |
virtual void | FlushCache () |
Flush all write cached data to disk. More... | |
virtual OGRErr | StartTransaction (int bForce=FALSE) |
For datasources which support transactions, StartTransaction creates a transaction. More... | |
virtual OGRErr | CommitTransaction () |
For datasources which support transactions, CommitTransaction commits a transaction. More... | |
virtual OGRErr | RollbackTransaction () |
For datasources which support transactions, RollbackTransaction will roll back a datasource to its state before the start of the current transaction. More... | |
virtual char ** | GetMetadata (const char *pszDomain="") |
Fetch metadata. More... | |
virtual CPLErr | SetMetadata (char **papszMetadata, const char *pszDomain="") |
Set metadata. More... | |
virtual const char * | GetMetadataItem (const char *pszName, const char *pszDomain="") |
Fetch single metadata item. More... | |
virtual CPLErr | SetMetadataItem (const char *pszName, const char *pszValue, const char *pszDomain="") |
Set single metadata item. More... | |
![]() | |
virtual | ~GDALDataset () |
Destroy an open GDALDataset. More... | |
int | GetRasterXSize (void) |
Fetch raster width in pixels. More... | |
int | GetRasterYSize (void) |
Fetch raster height in pixels. More... | |
int | GetRasterCount (void) |
Fetch the number of raster bands on this dataset. More... | |
GDALRasterBand * | GetRasterBand (int) |
Fetch a band object for a dataset. More... | |
virtual const char * | GetProjectionRef (void) |
Fetch the projection definition string for this dataset. More... | |
virtual CPLErr | SetProjection (const char *) |
Set the projection reference string for this dataset. More... | |
virtual CPLErr | GetGeoTransform (double *) |
Fetch the affine transformation coefficients. More... | |
virtual CPLErr | SetGeoTransform (double *) |
Set the affine transformation coefficients. More... | |
virtual CPLErr | AddBand (GDALDataType eType, char **papszOptions=NULL) |
Add a band to a dataset. More... | |
virtual void * | GetInternalHandle (const char *) |
Fetch a format specific internally meaningful handle. More... | |
virtual GDALDriver * | GetDriver (void) |
Fetch the driver to which this dataset relates. More... | |
virtual char ** | GetFileList (void) |
Fetch files forming dataset. More... | |
virtual const char * | GetDriverName () |
virtual int | GetGCPCount () |
Get number of GCPs. More... | |
virtual const char * | GetGCPProjection () |
Get output projection for GCPs. More... | |
virtual const GDAL_GCP * | GetGCPs () |
Fetch GCPs. More... | |
virtual CPLErr | SetGCPs (int nGCPCount, const GDAL_GCP *pasGCPList, const char *pszGCPProjection) |
Assign GCPs. More... | |
virtual CPLErr | AdviseRead (int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eDT, int nBandCount, int *panBandList, char **papszOptions) |
Advise driver of upcoming read requests. More... | |
virtual CPLErr | CreateMaskBand (int nFlagsIn) |
Adds a mask band to the dataset. More... | |
virtual GDALAsyncReader * | BeginAsyncReader (int nXOff, int nYOff, int nXSize, int nYSize, void *pBuf, int nBufXSize, int nBufYSize, GDALDataType eBufType, int nBandCount, int *panBandMap, int nPixelSpace, int nLineSpace, int nBandSpace, char **papszOptions) |
Sets up an asynchronous data request. More... | |
virtual void | EndAsyncReader (GDALAsyncReader *) |
End asynchronous request. More... | |
CPLErr | RasterIO (GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, int, int *, GSpacing, GSpacing, GSpacing, GDALRasterIOExtraArg *psExtraArg) |
Read/write a region of image data from multiple bands. More... | |
int | Reference () |
Add one to dataset reference count. More... | |
int | Dereference () |
Subtract one from dataset reference count. More... | |
GDALAccess | GetAccess () |
int | GetShared () |
Returns shared flag. More... | |
void | MarkAsShared () |
Mark this dataset as available for sharing. | |
void | MarkSuppressOnClose () |
char ** | GetOpenOptions () |
CPLErr | BuildOverviews (const char *, int, int *, int, int *, GDALProgressFunc, void *) |
Build raster overview(s) More... | |
void | ReportError (CPLErr eErrClass, int err_no, const char *fmt,...) CPL_PRINT_FUNC_FORMAT(4 |
Emits an error related to a dataset. More... | |
virtual OGRLayer * | CreateLayer (const char *pszName, OGRSpatialReference *poSpatialRef=NULL, OGRwkbGeometryType eGType=wkbUnknown, char **papszOptions=NULL) |
This method attempts to create a new layer on the dataset with the indicated name, coordinate system, geometry type. More... | |
int | GetRefCount () const |
Fetch reference count. More... | |
int | GetSummaryRefCount () const |
Fetch reference count of datasource and all owned layers. More... | |
OGRErr | Release () |
GDALSQLParseInfo * | BuildParseInfo (swq_select *psSelectInfo, swq_select_parse_options *poSelectParseOptions) |
void | DestroyParseInfo (GDALSQLParseInfo *psParseInfo) |
OGRLayer * | ExecuteSQL (const char *pszStatement, OGRGeometry *poSpatialFilter, const char *pszDialect, swq_select_parse_options *poSelectParseOptions) |
![]() | |
int | GetMOFlags () |
void | SetMOFlags (int nFlagsIn) |
virtual const char * | GetDescription () const |
Fetch object description. More... | |
virtual void | SetDescription (const char *) |
Set object description. More... | |
virtual char ** | GetMetadataDomainList () |
Fetch list of metadata domains. More... | |
Protected Member Functions | |
OGRLayer * | WrapLayerIfNecessary (OGRLayer *poLayer) |
![]() | |
void | RasterInitialize (int, int) |
void | SetBand (int, GDALRasterBand *) |
virtual CPLErr | IBuildOverviews (const char *, int, int *, int, int *, GDALProgressFunc, void *) |
virtual CPLErr | IRasterIO (GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, int, int *, GSpacing, GSpacing, GSpacing, GDALRasterIOExtraArg *psExtraArg) |
CPLErr | BlockBasedRasterIO (GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, int, int *, GSpacing, GSpacing, GSpacing, GDALRasterIOExtraArg *psExtraArg) |
void | BlockBasedFlushCache () |
CPLErr | ValidateRasterIOOrAdviseReadParameters (const char *pszCallingFunc, int *pbStopProcessingOnCENone, int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, int nBandCount, int *panBandMap) |
virtual int | CloseDependentDatasets () |
Drop references to any other datasets referenced by this dataset. More... | |
int | ValidateLayerCreationOptions (const char *const *papszLCO) |
int | EnterReadWrite (GDALRWFlag eRWFlag) |
void | LeaveReadWrite () |
void | TemporarilyDropReadWriteLock () |
void | ReacquireReadWriteLock () |
OGRErr | ProcessSQLCreateIndex (const char *) |
OGRErr | ProcessSQLDropIndex (const char *) |
OGRErr | ProcessSQLDropTable (const char *) |
OGRErr | ProcessSQLAlterTableAddColumn (const char *) |
OGRErr | ProcessSQLAlterTableDropColumn (const char *) |
OGRErr | ProcessSQLAlterTableAlterColumn (const char *) |
OGRErr | ProcessSQLAlterTableRenameColumn (const char *) |
![]() | |
char ** | BuildMetadataDomainList (char **papszList, int bCheckNonEmpty,...) CPL_NULL_TERMINATED |
Helper function for custom implementations of GetMetadataDomainList() More... | |
Protected Attributes | |
OGRDataSource * | m_poBaseDataSource |
int | m_bHasOwnership |
CPLMutex * | m_hGlobalMutex |
int | m_bWrapLayersInMutexedLayer |
std::map< OGRLayer *, OGRMutexedLayer * > | m_oMapLayers |
std::map< OGRMutexedLayer *, OGRLayer * > | m_oReverseMapLayers |
![]() | |
GDALDriver * | poDriver |
GDALAccess | eAccess |
int | nRasterXSize |
int | nRasterYSize |
int | nBands |
GDALRasterBand ** | papoBands |
int | bForceCachedIO |
int | nRefCount |
int | bShared |
GByte | bIsInternal |
GByte | bSuppressOnClose |
GByte | bReserved1 |
GByte | bReserved2 |
GDALDefaultOverviews | oOvManager |
char ** | papszOpenOptions |
OGRStyleTable * | m_poStyleTable |
![]() | |
int | nFlags |
CPLString | sDescription |
GDALMultiDomainMetadata | oMDMD |
Additional Inherited Members | |
![]() | |
static void | DestroyDataSource (OGRDataSource *) OGR_DEPRECATED("Use GDALDataset class instead") |
![]() | |
static GDALDataset ** | GetOpenDatasets (int *pnDatasetCount) |
Fetch all open GDAL dataset handles. More... | |
static int | IsGenericSQLDialect (const char *pszDialect) |
OGRMutexedDataSource class protects all virtual methods of OGRDataSource with a mutex.
If the passed mutex is NULL, then no locking will be done.
Note that the constructors and destructors are not explictely protected by the mutex*
|
virtual |
For datasources which support transactions, CommitTransaction commits a transaction.
If no transaction is active, or the commit fails, will return OGRERR_FAILURE. Datasources which do not support transactions will always return OGRERR_UNSUPPORTED_OPERATION.
Depending on drivers, this may or may not abort layer sequential readings that are active.
This function is the same as the C function GDALDatasetCommitTransaction().
Reimplemented from GDALDataset.
|
virtual |
Duplicate an existing layer.
This method creates a new layer, duplicate the field definitions of the source layer and then duplicate each features of the source layer. The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation. The source layer may come from another dataset.
This method is the same as the C function GDALDatasetCopyLayer() and the deprecated OGR_DS_CopyLayer().
In GDAL 1.X, this method used to be in the OGRDataSource class.
poSrcLayer | source layer. |
pszNewName | the name of the layer to create. |
papszOptions | a StringList of name=value options. Options are driver specific. |
Reimplemented from GDALDataset.
|
virtual |
Delete the indicated layer from the datasource.
If this method is supported the ODsCDeleteLayer capability will test TRUE on the GDALDataset.
This method is the same as the C function GDALDatasetDeleteLayer() and the deprecated OGR_DS_DeleteLayer().
In GDAL 1.X, this method used to be in the OGRDataSource class.
iLayer | the index of the layer to delete. |
Reimplemented from GDALDataset.
|
virtual |
Execute an SQL statement against the data store.
The result of an SQL query is either NULL for statements that are in error, or that have no results set, or an OGRLayer pointer representing a results set from the query. Note that this OGRLayer is in addition to the layers in the data store and must be destroyed with ReleaseResultSet() before the dataset is closed (destroyed).
This method is the same as the C function GDALDatasetExecuteSQL() and the deprecated OGR_DS_ExecuteSQL().
For more information on the SQL dialect supported internally by OGR review the OGR SQL document. Some drivers (ie. Oracle and PostGIS) pass the SQL directly through to the underlying RDBMS.
Starting with OGR 1.10, the SQLITE dialect can also be used.
In GDAL 1.X, this method used to be in the OGRDataSource class.
pszStatement | the SQL statement to execute. |
poSpatialFilter | geometry which represents a spatial filter. Can be NULL. |
pszDialect | allows control of the statement dialect. If set to NULL, the OGR SQL engine will be used, except for RDBMS drivers that will use their dedicated SQL engine, unless OGRSQL is explicitly passed as the dialect. Starting with OGR 1.10, the SQLITE dialect can also be used. |
Reimplemented from GDALDataset.
|
virtual |
Flush all write cached data to disk.
Any raster (or other GDAL) data written via GDAL calls, but buffered internally will be written to disk.
The default implementation of this method just calls the FlushCache() method on each of the raster bands and the SyncToDisk() method on each of the layers. Conceptionally, calling FlushCache() on a dataset should include any work that might be accomplished by calling SyncToDisk() on layers in that dataset.
Using this method does not prevent use from calling GDALClose() to properly close a dataset and ensure that important data not addressed by FlushCache() is written in the file.
This method is the same as the C function GDALFlushCache().
Reimplemented from GDALDataset.
|
virtual |
Fetch a layer by index.
The returned layer remains owned by the GDALDataset and should not be deleted by the application.
This method is the same as the C function GDALDatasetGetLayer() and the deprecated OGR_DS_GetLayer().
In GDAL 1.X, this method used to be in the OGRDataSource class.
iLayer | a layer number between 0 and GetLayerCount()-1. |
Reimplemented from GDALDataset.
|
virtual |
Fetch a layer by name.
The returned layer remains owned by the GDALDataset and should not be deleted by the application.
This method is the same as the C function GDALDatasetGetLayerByName() and the deprecated OGR_DS_GetLayerByName().
In GDAL 1.X, this method used to be in the OGRDataSource class.
pszLayerName | the layer name of the layer to fetch. |
Reimplemented from GDALDataset.
|
virtual |
Get the number of layers in this dataset.
This method is the same as the C function GDALDatasetGetLayerCount(), and the deprecated OGR_DS_GetLayerCount().
In GDAL 1.X, this method used to be in the OGRDataSource class.
Reimplemented from GDALDataset.
|
virtual |
Fetch metadata.
The returned string list is owned by the object, and may change at any time. It is formated as a "Name=value" list with the last pointer value being NULL. Use the the CPL StringList functions such as CSLFetchNameValue() to manipulate it.
Note that relatively few formats return any metadata at this time.
This method does the same thing as the C function GDALGetMetadata().
pszDomain | the domain of interest. Use "" or NULL for the default domain. |
Reimplemented from GDALMajorObject.
|
virtual |
Fetch single metadata item.
The C function GDALGetMetadataItem() does the same thing as this method.
pszName | the key for the metadata item to fetch. |
pszDomain | the domain to fetch for, use NULL for the default domain. |
Reimplemented from GDALMajorObject.
|
virtual |
Returns dataset style table.
This method is the same as the C function GDALDatasetGetStyleTable() and the deprecated OGR_DS_GetStyleTable().
In GDAL 1.X, this method used to be in the OGRDataSource class.
Reimplemented from GDALDataset.
|
virtual |
This method attempts to create a new layer on the dataset with the indicated name, coordinate system, geometry type.
This method is reserved to implementation by drivers.
The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation.
pszName | the name for the new layer. This should ideally not match any existing layer on the datasource. |
poSpatialRef | the coordinate system to use for the new layer, or NULL if no coordinate system is available. |
eGType | the geometry type for the layer. Use wkbUnknown if there are no constraints on the types geometry to be written. |
papszOptions | a StringList of name=value options. Options are driver specific. |
Reimplemented from GDALDataset.
|
virtual |
Release results of ExecuteSQL().
This method should only be used to deallocate OGRLayers resulting from an ExecuteSQL() call on the same GDALDataset. Failure to deallocate a results set before destroying the GDALDataset may cause errors.
This method is the same as the C function GDALDatasetReleaseResultSet() and the deprecated OGR_DS_ReleaseResultSet().
In GDAL 1.X, this method used to be in the OGRDataSource class.
poResultsSet | the result of a previous ExecuteSQL() call. |
Reimplemented from GDALDataset.
|
virtual |
For datasources which support transactions, RollbackTransaction will roll back a datasource to its state before the start of the current transaction.
If no transaction is active, or the rollback fails, will return OGRERR_FAILURE. Datasources which do not support transactions will always return OGRERR_UNSUPPORTED_OPERATION.
This function is the same as the C function GDALDatasetRollbackTransaction().
Reimplemented from GDALDataset.
|
virtual |
Set metadata.
The C function GDALSetMetadata() does the same thing as this method.
papszMetadataIn | the metadata in name=value string list format to apply. |
pszDomain | the domain of interest. Use "" or NULL for the default domain. |
Reimplemented from GDALMajorObject.
|
virtual |
Set single metadata item.
The C function GDALSetMetadataItem() does the same thing as this method.
pszName | the key for the metadata item to fetch. |
pszValue | the value to assign to the key. |
pszDomain | the domain to set within, use NULL for the default domain. |
Reimplemented from GDALMajorObject.
|
virtual |
Set dataset style table.
This method operate exactly as SetStyleTableDirectly() except that it does not assume ownership of the passed table.
This method is the same as the C function GDALDatasetSetStyleTable() and the deprecated OGR_DS_SetStyleTable().
In GDAL 1.X, this method used to be in the OGRDataSource class.
poStyleTable | pointer to style table to set |
Reimplemented from GDALDataset.
|
virtual |
Set dataset style table.
This method operate exactly as SetStyleTable() except that it assumes ownership of the passed table.
This method is the same as the C function GDALDatasetSetStyleTableDirectly() and the deprecated OGR_DS_SetStyleTableDirectly().
In GDAL 1.X, this method used to be in the OGRDataSource class.
poStyleTable | pointer to style table to set |
Reimplemented from GDALDataset.
|
virtual |
For datasources which support transactions, StartTransaction creates a transaction.
If starting the transaction fails, will return OGRERR_FAILURE. Datasources which do not support transactions will always return OGRERR_UNSUPPORTED_OPERATION.
Nested transactions are not supported.
All changes done after the start of the transaction are definitely applied in the datasource if CommitTransaction() is called. They may be cancelled by calling RollbackTransaction() instead.
At the time of writing, transactions only apply on vector layers.
Datasets that support transactions will advertize the ODsCTransactions capability. Use of transactions at dataset level is generally prefered to transactions at layer level, whose scope is rarely limited to the layer from which it was started.
In case StartTransaction() fails, neither CommitTransaction() or RollbackTransaction() should be called.
If an error occurs after a successful StartTransaction(), the whole transaction may or may not be implicitely cancelled, depending on drivers. (e.g. the PG driver will cancel it, SQLite/GPKG not). In any case, in the event of an error, an explicit call to RollbackTransaction() should be done to keep things balanced.
By default, when bForce is set to FALSE, only "efficient" transactions will be attempted. Some drivers may offer an emulation of transactions, but sometimes with significant overhead, in which case the user must explicitly allow for such an emulation by setting bForce to TRUE. Drivers that offer emulated transactions should advertize the ODsCEmulatedTransactions capability (and not ODsCTransactions).
This function is the same as the C function GDALDatasetStartTransaction().
bForce | can be set to TRUE if an emulation, possibly slow, of a transaction mechanism is acceptable. |
Reimplemented from GDALDataset.
|
virtual |
Test if capability is available.
One of the following dataset capability names can be passed into this method, and a TRUE or FALSE value will be returned indicating whether or not the capability is available for this object.
ODsCCreateLayer: True if this datasource can create new layers.
ODsCDeleteLayer: True if this datasource can delete existing layers.
ODsCCreateGeomFieldAfterCreateLayer: True if the layers of this datasource support CreateGeomField() just after layer creation.
ODsCCurveGeometries: True if this datasource supports curve geometries.
ODsCTransactions: True if this datasource supports (efficient) transactions.
ODsCEmulatedTransactions: True if this datasource supports transactions through emulation.
The #define macro forms of the capability names should be used in preference to the strings themselves to avoid mispelling.
This method is the same as the C function GDALDatasetTestCapability() and the deprecated OGR_DS_TestCapability().
In GDAL 1.X, this method used to be in the OGRDataSource class.
pszCapability | the capability to test. |
Reimplemented from GDALDataset.