Coverage Report

Created: 2026-02-14 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_vector_update.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  "update" step of "vector pipeline"
5
 * Author:   Even Rouault <even dot rouault at spatialys.com>
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef GDALALG_VECTOR_UPDATE_INCLUDED
14
#define GDALALG_VECTOR_UPDATE_INCLUDED
15
16
#include "gdalalg_vector_pipeline.h"
17
18
//! @cond Doxygen_Suppress
19
20
/************************************************************************/
21
/*                      GDALVectorUpdateAlgorithm                       */
22
/************************************************************************/
23
24
class GDALVectorUpdateAlgorithm /* non final */
25
    : public GDALVectorPipelineStepAlgorithm
26
{
27
  public:
28
    static constexpr const char *NAME = "update";
29
    static constexpr const char *DESCRIPTION =
30
        "Update an existing vector dataset with an input vector dataset.";
31
    static constexpr const char *HELP_URL = "/programs/gdal_vector_update.html";
32
33
    explicit GDALVectorUpdateAlgorithm(bool standaloneStep = false);
34
35
    bool IsNativelyStreamingCompatible() const override
36
0
    {
37
0
        return false;
38
0
    }
39
40
    bool OutputDatasetAllowedBeforeRunningStep() const override
41
0
    {
42
0
        return true;
43
0
    }
44
45
  protected:
46
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
47
48
    std::string m_activeLayer{};
49
50
    static constexpr const char *MODE_MERGE = "merge";
51
    static constexpr const char *MODE_UPDATE_ONLY = "update-only";
52
    static constexpr const char *MODE_APPEND_ONLY = "append-only";
53
54
    std::string m_mode{MODE_MERGE};
55
    std::vector<std::string> m_key{};
56
};
57
58
/************************************************************************/
59
/*                 GDALVectorUpdateAlgorithmStandalone                  */
60
/************************************************************************/
61
62
class GDALVectorUpdateAlgorithmStandalone final
63
    : public GDALVectorUpdateAlgorithm
64
{
65
  public:
66
    GDALVectorUpdateAlgorithmStandalone()
67
0
        : GDALVectorUpdateAlgorithm(/* standaloneStep = */ true)
68
0
    {
69
0
    }
70
71
    ~GDALVectorUpdateAlgorithmStandalone() override;
72
73
  private:
74
    bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
75
};
76
77
//! @endcond
78
79
#endif /* GDALALG_VECTOR_UPDATE_INCLUDED */