GDAL
gdalalg_vector_select.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "select" step of "vector pipeline"
5 * Author: Even Rouault <even dot rouault at spatialys.com>
6 *
7 ******************************************************************************
8 * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_VECTOR_SELECT_INCLUDED
14#define GDALALG_VECTOR_SELECT_INCLUDED
15
16#include "gdalalg_vector_pipeline.h"
17
19
20/************************************************************************/
21/* GDALVectorSelectAlgorithm */
22/************************************************************************/
23
24class GDALVectorSelectAlgorithm /* non final */
25 : public GDALVectorPipelineStepAlgorithm
26{
27 public:
28 static constexpr const char *NAME = "select";
29 static constexpr const char *DESCRIPTION =
30 "Select a subset of fields from a vector dataset.";
31 static constexpr const char *HELP_URL = "/programs/gdal_vector_select.html";
32
33 explicit GDALVectorSelectAlgorithm(bool standaloneStep = false);
34
35 private:
36 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
37
38 std::string m_activeLayer{};
39 std::vector<std::string> m_fields{};
40 bool m_ignoreMissingFields = false;
41 bool m_exclude = false;
42};
43
44/************************************************************************/
45/* GDALVectorSelectAlgorithmStandalone */
46/************************************************************************/
47
48class GDALVectorSelectAlgorithmStandalone final
49 : public GDALVectorSelectAlgorithm
50{
51 public:
52 GDALVectorSelectAlgorithmStandalone()
53 : GDALVectorSelectAlgorithm(/* standaloneStep = */ true)
54 {
55 }
56
57 ~GDALVectorSelectAlgorithmStandalone() override;
58};
59
61
62#endif /* GDALALG_VECTOR_SELECT_INCLUDED */