00001 /****************************************************************************** 00002 * $Id: ogrmutexeddatasource.h 27044 2014-03-16 23:41:27Z rouault $ 00003 * 00004 * Project: OpenGIS Simple Features Reference Implementation 00005 * Purpose: Defines OGRLMutexedDataSource class 00006 * Author: Even Rouault, even dot rouault at mines dash paris dot org 00007 * 00008 ****************************************************************************** 00009 * Copyright (c) 2013, Even Rouault <even dot rouault at mines-paris dot org> 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining a 00012 * copy of this software and associated documentation files (the "Software"), 00013 * to deal in the Software without restriction, including without limitation 00014 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00015 * and/or sell copies of the Software, and to permit persons to whom the 00016 * Software is furnished to do so, subject to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be included 00019 * in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00022 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00024 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00026 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00027 * DEALINGS IN THE SOFTWARE. 00028 ****************************************************************************/ 00029 00030 #ifndef _OGRMUTEXEDDATASOURCELAYER_H_INCLUDED 00031 #define _OGRMUTEXEDDATASOURCELAYER_H_INCLUDED 00032 00033 #include "ogrsf_frmts.h" 00034 00042 class CPL_DLL OGRMutexedDataSource : public OGRDataSource 00043 { 00044 protected: 00045 OGRDataSource *m_poBaseDataSource; 00046 int m_bHasOwnership; 00047 void *m_hGlobalMutex; 00048 00049 public: 00050 00051 /* The construction of the object isn't protected by the mutex */ 00052 OGRMutexedDataSource(OGRDataSource* poBaseDataSource, 00053 int bTakeOwnership, 00054 void* hMutexIn); 00055 00056 /* The destruction of the object isn't protected by the mutex */ 00057 virtual ~OGRMutexedDataSource(); 00058 00059 virtual const char *GetName(); 00060 00061 virtual int GetLayerCount() ; 00062 virtual OGRLayer *GetLayer(int); 00063 virtual OGRLayer *GetLayerByName(const char *); 00064 virtual OGRErr DeleteLayer(int); 00065 00066 virtual int TestCapability( const char * ); 00067 00068 virtual OGRLayer *CreateLayer( const char *pszName, 00069 OGRSpatialReference *poSpatialRef = NULL, 00070 OGRwkbGeometryType eGType = wkbUnknown, 00071 char ** papszOptions = NULL ); 00072 virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer, 00073 const char *pszNewName, 00074 char **papszOptions = NULL ); 00075 00076 virtual OGRStyleTable *GetStyleTable(); 00077 virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable ); 00078 00079 virtual void SetStyleTable(OGRStyleTable *poStyleTable); 00080 00081 virtual OGRLayer * ExecuteSQL( const char *pszStatement, 00082 OGRGeometry *poSpatialFilter, 00083 const char *pszDialect ); 00084 virtual void ReleaseResultSet( OGRLayer * poResultsSet ); 00085 00086 virtual OGRErr SyncToDisk(); 00087 }; 00088 00089 #endif // _OGRMUTEXEDDATASOURCELAYER_H_INCLUDED