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: 2024-11-21 22:18:42 Functions: 0 1 0.0 %

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

Generated by: LCOV version 1.14