LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/generic - ogrmutexedlayer.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 80 133 60.2 %
Date: 2025-02-20 10:14:44 Functions: 27 46 58.7 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  OpenGIS Simple Features Reference Implementation
       4             :  * Purpose:  Implements OGRMutexedLayer class
       5             :  * Author:   Even Rouault, even dot rouault at spatialys.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2013, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef DOXYGEN_SKIP
      14             : 
      15             : #include "ogrmutexedlayer.h"
      16             : #include "cpl_multiproc.h"
      17             : 
      18         183 : OGRMutexedLayer::OGRMutexedLayer(OGRLayer *poDecoratedLayer, int bTakeOwnership,
      19         183 :                                  CPLMutex *hMutex)
      20         183 :     : OGRLayerDecorator(poDecoratedLayer, bTakeOwnership), m_hMutex(hMutex)
      21             : {
      22         183 :     SetDescription(poDecoratedLayer->GetDescription());
      23         183 : }
      24             : 
      25         366 : OGRMutexedLayer::~OGRMutexedLayer()
      26             : {
      27         366 : }
      28             : 
      29          17 : OGRGeometry *OGRMutexedLayer::GetSpatialFilter()
      30             : {
      31          34 :     CPLMutexHolderOptionalLockD(m_hMutex);
      32          34 :     return OGRLayerDecorator::GetSpatialFilter();
      33             : }
      34             : 
      35         182 : OGRErr OGRMutexedLayer::ISetSpatialFilter(int iGeomField,
      36             :                                           const OGRGeometry *poGeom)
      37             : {
      38         364 :     CPLMutexHolderOptionalLockD(m_hMutex);
      39         364 :     return OGRLayerDecorator::ISetSpatialFilter(iGeomField, poGeom);
      40             : }
      41             : 
      42         294 : OGRErr OGRMutexedLayer::SetAttributeFilter(const char *poAttrFilter)
      43             : {
      44         588 :     CPLMutexHolderOptionalLockD(m_hMutex);
      45         588 :     return OGRLayerDecorator::SetAttributeFilter(poAttrFilter);
      46             : }
      47             : 
      48         459 : void OGRMutexedLayer::ResetReading()
      49             : {
      50         918 :     CPLMutexHolderOptionalLockD(m_hMutex);
      51         459 :     OGRLayerDecorator::ResetReading();
      52         459 : }
      53             : 
      54        1537 : OGRFeature *OGRMutexedLayer::GetNextFeature()
      55             : {
      56        3074 :     CPLMutexHolderOptionalLockD(m_hMutex);
      57        3074 :     return OGRLayerDecorator::GetNextFeature();
      58             : }
      59             : 
      60          34 : GDALDataset *OGRMutexedLayer::GetDataset()
      61             : {
      62          68 :     CPLMutexHolderOptionalLockD(m_hMutex);
      63          68 :     return OGRLayerDecorator::GetDataset();
      64             : }
      65             : 
      66          99 : bool OGRMutexedLayer::GetArrowStream(struct ArrowArrayStream *out_stream,
      67             :                                      CSLConstList papszOptions)
      68             : {
      69         198 :     CPLMutexHolderOptionalLockD(m_hMutex);
      70         198 :     return OGRLayerDecorator::GetArrowStream(out_stream, papszOptions);
      71             : }
      72             : 
      73          68 : OGRErr OGRMutexedLayer::SetNextByIndex(GIntBig nIndex)
      74             : {
      75         136 :     CPLMutexHolderOptionalLockD(m_hMutex);
      76         136 :     return OGRLayerDecorator::SetNextByIndex(nIndex);
      77             : }
      78             : 
      79         134 : OGRFeature *OGRMutexedLayer::GetFeature(GIntBig nFID)
      80             : {
      81         268 :     CPLMutexHolderOptionalLockD(m_hMutex);
      82         268 :     return OGRLayerDecorator::GetFeature(nFID);
      83             : }
      84             : 
      85          17 : OGRErr OGRMutexedLayer::ISetFeature(OGRFeature *poFeature)
      86             : {
      87          34 :     CPLMutexHolderOptionalLockD(m_hMutex);
      88          34 :     return OGRLayerDecorator::ISetFeature(poFeature);
      89             : }
      90             : 
      91           0 : OGRErr OGRMutexedLayer::ICreateFeature(OGRFeature *poFeature)
      92             : {
      93           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
      94           0 :     return OGRLayerDecorator::ICreateFeature(poFeature);
      95             : }
      96             : 
      97           0 : OGRErr OGRMutexedLayer::IUpsertFeature(OGRFeature *poFeature)
      98             : {
      99           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     100           0 :     return OGRLayerDecorator::IUpsertFeature(poFeature);
     101             : }
     102             : 
     103           0 : OGRErr OGRMutexedLayer::IUpdateFeature(OGRFeature *poFeature,
     104             :                                        int nUpdatedFieldsCount,
     105             :                                        const int *panUpdatedFieldsIdx,
     106             :                                        int nUpdatedGeomFieldsCount,
     107             :                                        const int *panUpdatedGeomFieldsIdx,
     108             :                                        bool bUpdateStyleString)
     109             : {
     110           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     111           0 :     return OGRLayerDecorator::IUpdateFeature(
     112             :         poFeature, nUpdatedFieldsCount, panUpdatedFieldsIdx,
     113           0 :         nUpdatedGeomFieldsCount, panUpdatedGeomFieldsIdx, bUpdateStyleString);
     114             : }
     115             : 
     116          34 : OGRErr OGRMutexedLayer::DeleteFeature(GIntBig nFID)
     117             : {
     118          68 :     CPLMutexHolderOptionalLockD(m_hMutex);
     119          68 :     return OGRLayerDecorator::DeleteFeature(nFID);
     120             : }
     121             : 
     122         141 : const char *OGRMutexedLayer::GetName()
     123             : {
     124         282 :     CPLMutexHolderOptionalLockD(m_hMutex);
     125         282 :     return OGRLayerDecorator::GetName();
     126             : }
     127             : 
     128          17 : OGRwkbGeometryType OGRMutexedLayer::GetGeomType()
     129             : {
     130          34 :     CPLMutexHolderOptionalLockD(m_hMutex);
     131          34 :     return OGRLayerDecorator::GetGeomType();
     132             : }
     133             : 
     134         424 : OGRFeatureDefn *OGRMutexedLayer::GetLayerDefn()
     135             : {
     136         848 :     CPLMutexHolderOptionalLockD(m_hMutex);
     137         848 :     return OGRLayerDecorator::GetLayerDefn();
     138             : }
     139             : 
     140          37 : OGRSpatialReference *OGRMutexedLayer::GetSpatialRef()
     141             : {
     142          74 :     CPLMutexHolderOptionalLockD(m_hMutex);
     143          74 :     return OGRLayerDecorator::GetSpatialRef();
     144             : }
     145             : 
     146         196 : GIntBig OGRMutexedLayer::GetFeatureCount(int bForce)
     147             : {
     148         392 :     CPLMutexHolderOptionalLockD(m_hMutex);
     149         392 :     return OGRLayerDecorator::GetFeatureCount(bForce);
     150             : }
     151             : 
     152          60 : OGRErr OGRMutexedLayer::IGetExtent(int iGeomField, OGREnvelope *psExtent,
     153             :                                    bool bForce)
     154             : {
     155         120 :     CPLMutexHolderOptionalLockD(m_hMutex);
     156         120 :     return OGRLayerDecorator::IGetExtent(iGeomField, psExtent, bForce);
     157             : }
     158             : 
     159         420 : int OGRMutexedLayer::TestCapability(const char *pszCapability)
     160             : {
     161         840 :     CPLMutexHolderOptionalLockD(m_hMutex);
     162         840 :     return OGRLayerDecorator::TestCapability(pszCapability);
     163             : }
     164             : 
     165           0 : OGRErr OGRMutexedLayer::CreateField(const OGRFieldDefn *poField, int bApproxOK)
     166             : {
     167           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     168           0 :     return OGRLayerDecorator::CreateField(poField, bApproxOK);
     169             : }
     170             : 
     171           0 : OGRErr OGRMutexedLayer::DeleteField(int iField)
     172             : {
     173           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     174           0 :     return OGRLayerDecorator::DeleteField(iField);
     175             : }
     176             : 
     177           0 : OGRErr OGRMutexedLayer::ReorderFields(int *panMap)
     178             : {
     179           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     180           0 :     return OGRLayerDecorator::ReorderFields(panMap);
     181             : }
     182             : 
     183           0 : OGRErr OGRMutexedLayer::AlterFieldDefn(int iField, OGRFieldDefn *poNewFieldDefn,
     184             :                                        int nFlagsIn)
     185             : {
     186           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     187           0 :     return OGRLayerDecorator::AlterFieldDefn(iField, poNewFieldDefn, nFlagsIn);
     188             : }
     189             : 
     190           0 : OGRErr OGRMutexedLayer::AlterGeomFieldDefn(
     191             :     int iGeomField, const OGRGeomFieldDefn *poNewGeomFieldDefn, int nFlagsIn)
     192             : {
     193           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     194           0 :     return OGRLayerDecorator::AlterGeomFieldDefn(iGeomField, poNewGeomFieldDefn,
     195           0 :                                                  nFlagsIn);
     196             : }
     197             : 
     198           0 : OGRErr OGRMutexedLayer::SyncToDisk()
     199             : {
     200           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     201           0 :     return OGRLayerDecorator::SyncToDisk();
     202             : }
     203             : 
     204           1 : OGRStyleTable *OGRMutexedLayer::GetStyleTable()
     205             : {
     206           2 :     CPLMutexHolderOptionalLockD(m_hMutex);
     207           2 :     return OGRLayerDecorator::GetStyleTable();
     208             : }
     209             : 
     210           0 : void OGRMutexedLayer::SetStyleTableDirectly(OGRStyleTable *poStyleTable)
     211             : {
     212           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     213           0 :     return OGRLayerDecorator::SetStyleTableDirectly(poStyleTable);
     214             : }
     215             : 
     216           0 : void OGRMutexedLayer::SetStyleTable(OGRStyleTable *poStyleTable)
     217             : {
     218           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     219           0 :     return OGRLayerDecorator::SetStyleTable(poStyleTable);
     220             : }
     221             : 
     222           0 : OGRErr OGRMutexedLayer::StartTransaction()
     223             : {
     224           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     225           0 :     return OGRLayerDecorator::StartTransaction();
     226             : }
     227             : 
     228           0 : OGRErr OGRMutexedLayer::CommitTransaction()
     229             : {
     230           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     231           0 :     return OGRLayerDecorator::CommitTransaction();
     232             : }
     233             : 
     234           0 : OGRErr OGRMutexedLayer::RollbackTransaction()
     235             : {
     236           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     237           0 :     return OGRLayerDecorator::RollbackTransaction();
     238             : }
     239             : 
     240          99 : const char *OGRMutexedLayer::GetFIDColumn()
     241             : {
     242         198 :     CPLMutexHolderOptionalLockD(m_hMutex);
     243         198 :     return OGRLayerDecorator::GetFIDColumn();
     244             : }
     245             : 
     246          33 : const char *OGRMutexedLayer::GetGeometryColumn()
     247             : {
     248          66 :     CPLMutexHolderOptionalLockD(m_hMutex);
     249          66 :     return OGRLayerDecorator::GetGeometryColumn();
     250             : }
     251             : 
     252          34 : OGRErr OGRMutexedLayer::SetIgnoredFields(CSLConstList papszFields)
     253             : {
     254          68 :     CPLMutexHolderOptionalLockD(m_hMutex);
     255          68 :     return OGRLayerDecorator::SetIgnoredFields(papszFields);
     256             : }
     257             : 
     258          17 : char **OGRMutexedLayer::GetMetadata(const char *pszDomain)
     259             : {
     260          34 :     CPLMutexHolderOptionalLockD(m_hMutex);
     261          34 :     return OGRLayerDecorator::GetMetadata(pszDomain);
     262             : }
     263             : 
     264           0 : CPLErr OGRMutexedLayer::SetMetadata(char **papszMetadata, const char *pszDomain)
     265             : {
     266           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     267           0 :     return OGRLayerDecorator::SetMetadata(papszMetadata, pszDomain);
     268             : }
     269             : 
     270          19 : const char *OGRMutexedLayer::GetMetadataItem(const char *pszName,
     271             :                                              const char *pszDomain)
     272             : {
     273          38 :     CPLMutexHolderOptionalLockD(m_hMutex);
     274          38 :     return OGRLayerDecorator::GetMetadataItem(pszName, pszDomain);
     275             : }
     276             : 
     277           0 : CPLErr OGRMutexedLayer::SetMetadataItem(const char *pszName,
     278             :                                         const char *pszValue,
     279             :                                         const char *pszDomain)
     280             : {
     281           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     282           0 :     return OGRLayerDecorator::SetMetadataItem(pszName, pszValue, pszDomain);
     283             : }
     284             : 
     285           0 : OGRErr OGRMutexedLayer::Rename(const char *pszNewName)
     286             : {
     287           0 :     CPLMutexHolderOptionalLockD(m_hMutex);
     288           0 :     return OGRLayerDecorator::Rename(pszNewName);
     289             : }
     290             : 
     291             : #endif /* #ifndef DOXYGEN_SKIP */

Generated by: LCOV version 1.14