Coverage Report

Created: 2026-09-14 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_raster_calc.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  "calc" step of "raster pipeline"
5
 * Author:   Daniel Baston
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2025, ISciences LLC
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef GDALALG_RASTER_CALC_INCLUDED
14
#define GDALALG_RASTER_CALC_INCLUDED
15
16
#include "gdalrasterpipelinestepalgorithm.h"
17
18
//! @cond Doxygen_Suppress
19
20
/************************************************************************/
21
/*                       GDALRasterCalcAlgorithm                        */
22
/************************************************************************/
23
24
class GDALRasterCalcAlgorithm : public GDALRasterPipelineStepAlgorithm
25
{
26
  public:
27
    explicit GDALRasterCalcAlgorithm(bool standaloneStep = false) noexcept;
28
29
    static constexpr const char *NAME = "calc";
30
    static constexpr const char *DESCRIPTION = "Perform raster algebra";
31
    static constexpr const char *HELP_URL = "/programs/gdal_raster_calc.html";
32
33
    bool CanBeFirstStep() const override
34
0
    {
35
0
        return true;
36
0
    }
37
38
    bool CanBeMiddleStep() const override
39
0
    {
40
0
        return true;
41
0
    }
42
43
  private:
44
    bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
45
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
46
47
    std::vector<std::string> m_expr{};
48
    std::string m_dialect{"muparser"};
49
    bool m_flatten{false};
50
    std::string m_type{};
51
    std::string m_nodata{};
52
    bool m_noCheckCRS{false};
53
    bool m_noCheckExtent{false};
54
    bool m_noCheckExpression{false};
55
    bool m_propagateNoData{false};
56
};
57
58
/************************************************************************/
59
/*                  GDALRasterCalcAlgorithmStandalone                   */
60
/************************************************************************/
61
62
class GDALRasterCalcAlgorithmStandalone final : public GDALRasterCalcAlgorithm
63
{
64
  public:
65
    GDALRasterCalcAlgorithmStandalone()
66
0
        : GDALRasterCalcAlgorithm(/* standaloneStep = */ true)
67
0
    {
68
0
    }
69
70
    ~GDALRasterCalcAlgorithmStandalone() override;
71
};
72
73
//! @endcond
74
75
#endif /* GDALALG_RASTER_CALC_INCLUDED */