LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/generic - ogrmutexeddatasource.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 0 2 0.0 %
Date: 2025-01-18 12:42:00 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  OpenGIS Simple Features Reference Implementation
       4             :  * Purpose:  Defines OGRLMutexedDataSource 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 OGRMUTEXEDDATASOURCELAYER_H_INCLUDED
      14             : #define OGRMUTEXEDDATASOURCELAYER_H_INCLUDED
      15             : 
      16             : #ifndef DOXYGEN_SKIP
      17             : 
      18             : #include "ogrsf_frmts.h"
      19             : #include "cpl_multiproc.h"
      20             : #include "ogrmutexedlayer.h"
      21             : #include <map>
      22             : 
      23             : /** OGRMutexedDataSource class protects all virtual methods of GDALDataset,
      24             :  *  related to vector layers, with a mutex.
      25             :  *  If the passed mutex is NULL, then no locking will be done.
      26             :  *
      27             :  *  Note that the constructors and destructors are not explicitly protected
      28             :  *  by the mutex.
      29             :  */
      30             : class CPL_DLL OGRMutexedDataSource : public GDALDataset
      31             : {
      32             :     CPL_DISALLOW_COPY_ASSIGN(OGRMutexedDataSource)
      33             : 
      34             :   protected:
      35             :     GDALDataset *m_poBaseDataSource;
      36             :     int m_bHasOwnership;
      37             :     CPLMutex *m_hGlobalMutex;
      38             :     int m_bWrapLayersInMutexedLayer;
      39             :     std::map<OGRLayer *, OGRMutexedLayer *> m_oMapLayers{};
      40             :     std::map<OGRMutexedLayer *, OGRLayer *> m_oReverseMapLayers{};
      41             : 
      42             :     OGRLayer *WrapLayerIfNecessary(OGRLayer *poLayer);
      43             : 
      44             :   public:
      45             :     /* The construction of the object isn't protected by the mutex */
      46             :     OGRMutexedDataSource(GDALDataset *poBaseDataSource, int bTakeOwnership,
      47             :                          CPLMutex *hMutexIn, int bWrapLayersInMutexedLayer);
      48             : 
      49             :     /* The destruction of the object isn't protected by the mutex */
      50             :     virtual ~OGRMutexedDataSource() override;
      51             : 
      52           0 :     GDALDataset *GetBaseDataSource()
      53             :     {
      54           0 :         return m_poBaseDataSource;
      55             :     }
      56             : 
      57             :     virtual int GetLayerCount() override;
      58             :     virtual OGRLayer *GetLayer(int) override;
      59             :     virtual OGRLayer *GetLayerByName(const char *) override;
      60             :     virtual OGRErr DeleteLayer(int) override;
      61             :     virtual bool IsLayerPrivate(int iLayer) const override;
      62             : 
      63             :     virtual int TestCapability(const char *) override;
      64             : 
      65             :     virtual OGRLayer *ICreateLayer(const char *pszName,
      66             :                                    const OGRGeomFieldDefn *poGeomFieldDefn,
      67             :                                    CSLConstList papszOptions) override;
      68             :     virtual OGRLayer *CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName,
      69             :                                 char **papszOptions = nullptr) override;
      70             : 
      71             :     virtual OGRStyleTable *GetStyleTable() override;
      72             :     virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable) override;
      73             : 
      74             :     virtual void SetStyleTable(OGRStyleTable *poStyleTable) override;
      75             : 
      76             :     virtual OGRLayer *ExecuteSQL(const char *pszStatement,
      77             :                                  OGRGeometry *poSpatialFilter,
      78             :                                  const char *pszDialect) override;
      79             :     virtual void ReleaseResultSet(OGRLayer *poResultsSet) override;
      80             : 
      81             :     virtual CPLErr FlushCache(bool bAtClosing) override;
      82             : 
      83             :     virtual OGRErr StartTransaction(int bForce = FALSE) override;
      84             :     virtual OGRErr CommitTransaction() override;
      85             :     virtual OGRErr RollbackTransaction() override;
      86             : 
      87             :     virtual char **GetMetadata(const char *pszDomain = "") override;
      88             :     virtual CPLErr SetMetadata(char **papszMetadata,
      89             :                                const char *pszDomain = "") override;
      90             :     virtual const char *GetMetadataItem(const char *pszName,
      91             :                                         const char *pszDomain = "") override;
      92             :     virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
      93             :                                    const char *pszDomain = "") override;
      94             : 
      95             :     virtual std::vector<std::string>
      96             :     GetFieldDomainNames(CSLConstList papszOptions = nullptr) const override;
      97             :     virtual const OGRFieldDomain *
      98             :     GetFieldDomain(const std::string &name) const override;
      99             : 
     100             :     virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
     101             :                                 std::string &failureReason) override;
     102             :     virtual bool DeleteFieldDomain(const std::string &name,
     103             :                                    std::string &failureReason) override;
     104             :     virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
     105             :                                    std::string &failureReason) override;
     106             : 
     107             :     std::vector<std::string>
     108             :     GetRelationshipNames(CSLConstList papszOptions = nullptr) const override;
     109             : 
     110             :     const GDALRelationship *
     111             :     GetRelationship(const std::string &name) const override;
     112             : 
     113             :     virtual std::shared_ptr<GDALGroup> GetRootGroup() const override;
     114             : };
     115             : 
     116             : #endif /* #ifndef DOXYGEN_SKIP */
     117             : 
     118             : #endif  // OGRMUTEXEDDATASOURCELAYER_H_INCLUDED

Generated by: LCOV version 1.14