Coverage Report

Created: 2026-07-25 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/gcore/gdal_defaultoverviews.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Name:     gdal_defaultoverviews.h
4
 * Project:  GDAL Core
5
 * Purpose:  Declaration of GDALDefaultOverviews class
6
 * Author:   Frank Warmerdam, warmerdam@pobox.com
7
 *
8
 ******************************************************************************
9
 * Copyright (c) 1998, Frank Warmerdam
10
 * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
11
 *
12
 * SPDX-License-Identifier: MIT
13
 ****************************************************************************/
14
15
#ifndef GDALDEFAULTOVERVIEWS_H_INCLUDED
16
#define GDALDEFAULTOVERVIEWS_H_INCLUDED
17
18
#include "cpl_port.h"
19
#include "cpl_progress.h"
20
#include "cpl_string.h"
21
22
/* ******************************************************************** */
23
/*                         GDALDefaultOverviews                         */
24
/* ******************************************************************** */
25
26
//! @cond Doxygen_Suppress
27
class GDALDataset;
28
class GDALOpenInfo;
29
class GDALRasterBand;
30
31
class CPL_DLL GDALDefaultOverviews
32
{
33
    friend class GDALDataset;
34
35
    GDALDataset *poDS;
36
    GDALDataset *poODS;
37
38
    CPLString osOvrFilename{};
39
40
    bool bOvrIsAux;
41
42
    bool bCheckedForMask;
43
    bool bOwnMaskDS;
44
    bool m_bInHaveMaskFile = false;
45
    GDALDataset *poMaskDS;
46
47
    // For "overview datasets" we record base level info so we can
48
    // find our way back to get overview masks.
49
    GDALDataset *poBaseDS;
50
51
    // Stuff for deferred initialize/overviewscans.
52
    bool bCheckedForOverviews;
53
    void OverviewScan();
54
    char *pszInitName;
55
    bool bInitNameIsOVR;
56
    char **papszInitSiblingFiles;
57
58
  public:
59
    GDALDefaultOverviews();
60
    ~GDALDefaultOverviews();
61
62
    void Initialize(GDALDataset *poDSIn, const char *pszName = nullptr,
63
                    CSLConstList papszSiblingFiles = nullptr,
64
                    bool bNameIsOVR = false);
65
66
    void Initialize(GDALDataset *poDSIn, GDALOpenInfo *poOpenInfo,
67
                    const char *pszName = nullptr,
68
                    bool bTransferSiblingFilesIfLoaded = true);
69
70
    void TransferSiblingFiles(char **papszSiblingFiles);
71
72
    int IsInitialized();
73
74
    int CloseDependentDatasets();
75
76
    // Overview Related
77
78
    int GetOverviewCount(int nBand);
79
    GDALRasterBand *GetOverview(int nBand, int iOverview);
80
81
    CPLErr BuildOverviews(const char *pszBasename, const char *pszResampling,
82
                          int nOverviews, const int *panOverviewList,
83
                          int nBands, const int *panBandList,
84
                          GDALProgressFunc pfnProgress, void *pProgressData,
85
                          CSLConstList papszOptions);
86
87
    CPLErr BuildOverviewsSubDataset(const char *pszPhysicalFile,
88
                                    const char *pszResampling, int nOverviews,
89
                                    const int *panOverviewList, int nBands,
90
                                    const int *panBandList,
91
                                    GDALProgressFunc pfnProgress,
92
                                    void *pProgressData,
93
                                    CSLConstList papszOptions);
94
95
    CPLErr BuildOverviewsMask(const char *pszResampling, int nOverviews,
96
                              const int *panOverviewList,
97
                              GDALProgressFunc pfnProgress, void *pProgressData,
98
                              CSLConstList papszOptions);
99
100
    static bool CheckSrcOverviewsConsistencyWithBase(
101
        GDALDataset *poFullResDS,
102
        const std::vector<GDALDataset *> &apoSrcOvrDS);
103
104
    CPLErr AddOverviews(const char *pszBasename,
105
                        const std::vector<GDALDataset *> &apoSrcOvrDS,
106
                        GDALProgressFunc pfnProgress, void *pProgressData,
107
                        CSLConstList papszOptions);
108
109
    CPLErr CleanOverviews();
110
111
    // Mask Related
112
113
    CPLErr CreateMaskBand(int nFlags, int nBand = -1);
114
    GDALRasterBand *GetMaskBand(int nBand);
115
    int GetMaskFlags(int nBand);
116
117
    int HaveMaskFile(char **papszSiblings = nullptr,
118
                     const char *pszBasename = nullptr);
119
120
    CSLConstList GetSiblingFiles() const
121
0
    {
122
0
        return papszInitSiblingFiles;
123
0
    }
124
125
  private:
126
    CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
127
128
    CPLErr CreateOrOpenOverviewFile(const char *pszBasename,
129
                                    CSLConstList papszOptions);
130
};
131
132
//! @endcond
133
134
#endif