OGR
ogrmutexeddatasource.h
1 /******************************************************************************
2  * $Id: ogrmutexeddatasource.h 28601 2015-03-03 11:06:40Z rouault $
3  *
4  * Project: OpenGIS Simple Features Reference Implementation
5  * Purpose: Defines OGRLMutexedDataSource class
6  * Author: Even Rouault, even dot rouault at mines dash paris dot org
7  *
8  ******************************************************************************
9  * Copyright (c) 2013, Even Rouault <even dot rouault at mines-paris dot org>
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ****************************************************************************/
29 
30 #ifndef _OGRMUTEXEDDATASOURCELAYER_H_INCLUDED
31 #define _OGRMUTEXEDDATASOURCELAYER_H_INCLUDED
32 
33 #include "ogrsf_frmts.h"
34 #include "cpl_multiproc.h"
35 #include "ogrmutexedlayer.h"
36 #include <map>
37 
45 class CPL_DLL OGRMutexedDataSource : public OGRDataSource
46 {
47  protected:
48  OGRDataSource *m_poBaseDataSource;
49  int m_bHasOwnership;
50  CPLMutex *m_hGlobalMutex;
51  int m_bWrapLayersInMutexedLayer;
52  std::map<OGRLayer*, OGRMutexedLayer* > m_oMapLayers;
53  std::map<OGRMutexedLayer*, OGRLayer* > m_oReverseMapLayers;
54 
55  OGRLayer* WrapLayerIfNecessary(OGRLayer* poLayer);
56 
57  public:
58 
59  /* The construction of the object isn't protected by the mutex */
60  OGRMutexedDataSource(OGRDataSource* poBaseDataSource,
61  int bTakeOwnership,
62  CPLMutex* hMutexIn,
63  int bWrapLayersInMutexedLayer);
64 
65  /* The destruction of the object isn't protected by the mutex */
66  virtual ~OGRMutexedDataSource();
67 
68  OGRDataSource* GetBaseDataSource() { return m_poBaseDataSource; }
69 
70  virtual const char *GetName();
71 
72  virtual int GetLayerCount() ;
73  virtual OGRLayer *GetLayer(int);
74  virtual OGRLayer *GetLayerByName(const char *);
75  virtual OGRErr DeleteLayer(int);
76 
77  virtual int TestCapability( const char * );
78 
79  virtual OGRLayer *ICreateLayer( const char *pszName,
80  OGRSpatialReference *poSpatialRef = NULL,
82  char ** papszOptions = NULL );
83  virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer,
84  const char *pszNewName,
85  char **papszOptions = NULL );
86 
87  virtual OGRStyleTable *GetStyleTable();
88  virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
89 
90  virtual void SetStyleTable(OGRStyleTable *poStyleTable);
91 
92  virtual OGRLayer * ExecuteSQL( const char *pszStatement,
93  OGRGeometry *poSpatialFilter,
94  const char *pszDialect );
95  virtual void ReleaseResultSet( OGRLayer * poResultsSet );
96 
97  virtual void FlushCache();
98 
99  virtual OGRErr StartTransaction(int bForce=FALSE);
100  virtual OGRErr CommitTransaction();
101  virtual OGRErr RollbackTransaction();
102 
103  virtual char **GetMetadata( const char * pszDomain = "" );
104  virtual CPLErr SetMetadata( char ** papszMetadata,
105  const char * pszDomain = "" );
106  virtual const char *GetMetadataItem( const char * pszName,
107  const char * pszDomain = "" );
108  virtual CPLErr SetMetadataItem( const char * pszName,
109  const char * pszValue,
110  const char * pszDomain = "" );
111 };
112 
113 #endif // _OGRMUTEXEDDATASOURCELAYER_H_INCLUDED
Definition: ogrsf_frmts.h:238
Definition: ogrmutexeddatasource.h:45
Definition: ogr_core.h:311
OGRwkbGeometryType
Definition: ogr_core.h:309
Definition: ogr_geometry.h:104
Definition: ogr_spatialref.h:129
Definition: ogrsf_frmts.h:66
Definition: ogr_featurestyle.h:81

Generated for GDAL by doxygen 1.8.10.