GDAL

gdalalgorithm_cpp.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: GDALAlgorithm C++ API
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 GDAL_ALGORITHM_CPP_INCLUDED
14#define GDAL_ALGORITHM_CPP_INCLUDED
15
16#include "gdalalgorithm_c.h"
17
18/************************************************************************/
19/************************************************************************/
20/* GDAL Algorithm C++ API */
21/************************************************************************/
22/************************************************************************/
23
24// This header requires C++17
25// _MSC_VER >= 1920 : Visual Studio >= 2019
26#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) && \
27 (defined(DOXYGEN_SKIP) || __cplusplus >= 201703L || _MSC_VER >= 1920)
28
29#include "cpl_error.h"
30
31#include <limits>
32#include <functional>
33#include <map>
34#include <memory>
35#include <string>
36#include <string_view>
37#include <type_traits>
38#include <utility>
39#include <variant>
40#include <vector>
41
42 class GDALDataset;
43 class OGRSpatialReference;
44
46 constexpr const char *GAAC_COMMON = "Common";
47
49 constexpr const char *GAAC_BASE = "Base";
50
52 constexpr const char *GAAC_ADVANCED = "Advanced";
53
55 constexpr const char *GAAC_ESOTERIC = "Esoteric";
56
59 constexpr const char *GAAMDI_REQUIRED_CAPABILITIES = "required_capabilities";
60
62 constexpr const char *GAAMDI_VRT_COMPATIBLE = "vrt_compatible";
63
65 constexpr const char *GAAMDI_ALLOWED_FORMATS = "allowed_formats";
66
68 constexpr const char *GAAMDI_EXCLUDED_FORMATS = "excluded_formats";
69
71 constexpr const char *GDAL_ARG_NAME_INPUT = "input";
72
74 constexpr const char *GDAL_ARG_NAME_INPUT_FORMAT = "input-format";
75
77 constexpr const char *GDAL_ARG_NAME_INPUT_LAYER = "input-layer";
78
80 constexpr const char *GDAL_ARG_NAME_OPEN_OPTION = "open-option";
81
83 constexpr const char *GDAL_ARG_NAME_OUTPUT = "output";
84
86 constexpr const char *GDAL_ARG_NAME_OUTPUT_STRING = "output-string";
87
89 constexpr const char *GDAL_ARG_NAME_STDOUT = "stdout";
90
92 constexpr const char *GDAL_ARG_NAME_OUTPUT_FORMAT = "output-format";
93
95 constexpr const char *GDAL_ARG_NAME_OUTPUT_LAYER = "output-layer";
96
98 constexpr const char *GDAL_ARG_NAME_CREATION_OPTION = "creation-option";
99
101 constexpr const char *GDAL_ARG_NAME_LAYER_CREATION_OPTION =
102 "layer-creation-option";
103
105 constexpr const char *GDAL_ARG_NAME_UPDATE = "update";
106
108 constexpr const char *GDAL_ARG_NAME_OVERWRITE = "overwrite";
109
111 constexpr const char *GDAL_ARG_NAME_OVERWRITE_LAYER = "overwrite-layer";
112
114 constexpr const char *GDAL_ARG_NAME_APPEND = "append";
115
117 constexpr const char *GDAL_ARG_NAME_READ_ONLY = "read-only";
118
120 constexpr const char *GDAL_ARG_NAME_NUM_THREADS = "num-threads";
121
123 constexpr const char *GDAL_ARG_NAME_NUM_THREADS_INT_HIDDEN =
124 "num-threads-int-hidden";
125
127 constexpr const char *GDAL_ARG_NAME_QUIET = "quiet";
128
132 constexpr const char *GDAL_ALG_DCAP_RASTER_OR_MULTIDIM_RASTER =
133 "raster-or-multidim-raster";
134
135/************************************************************************/
136/* GDALArgDatasetValue */
137/************************************************************************/
138
140std::string CPL_DLL GDALAlgorithmArgDatasetTypeName(GDALArgDatasetType);
141
142 class GDALAlgorithmArg;
143
148 class CPL_DLL GDALArgDatasetValue final
149{
150 public:
152 GDALArgDatasetValue() = default;
153
155 explicit GDALArgDatasetValue(const std::string &name)
156 : m_name(name), m_nameSet(true)
157 {
158 }
159
161 explicit GDALArgDatasetValue(GDALDataset *poDS);
162
164 GDALArgDatasetValue(GDALArgDatasetValue &&other);
165
168 ~GDALArgDatasetValue();
169
172 bool Close();
173
175 GDALArgDatasetValue &operator=(GDALArgDatasetValue &&other);
176
181 GDALDataset *GetDatasetIncreaseRefCount();
182
187 GDALDataset *GetDatasetRef()
188 {
189 return m_poDS;
190 }
191
196 const GDALDataset *GetDatasetRef() const
197 {
198 return m_poDS;
199 }
200
204 GDALDataset *BorrowDataset()
205 {
206 GDALDataset *ret = m_poDS;
207 m_poDS = nullptr;
208 return ret;
209 }
210
214 void BorrowDatasetFrom(GDALArgDatasetValue &other)
215 {
216 Close();
217 m_poDS = other.BorrowDataset();
218 m_name = other.m_name;
219 }
220
222 const std::string &GetName() const
223 {
224 return m_name;
225 }
226
228 bool IsNameSet() const
229 {
230 return m_nameSet;
231 }
232
234 void Set(const std::string &name);
235
238 void Set(std::unique_ptr<GDALDataset> poDS);
239
241 void Set(GDALDataset *poDS);
242
246 void SetFrom(const GDALArgDatasetValue &other);
247
249 void SetDatasetOpenedByAlgorithm()
250 {
251 m_openedByAlgorithm = true;
252 }
253
255 bool HasDatasetBeenOpenedByAlgorithm() const
256 {
257 return m_openedByAlgorithm;
258 }
259
260 protected:
261 friend class GDALAlgorithm;
262
264 void SetOwnerArgument(GDALAlgorithmArg *arg)
265 {
266 CPLAssert(!m_ownerArg);
267 m_ownerArg = arg;
268 }
269
270 private:
272 GDALAlgorithmArg *m_ownerArg = nullptr;
273
275 GDALDataset *m_poDS = nullptr;
276
278 std::string m_name{};
279
281 bool m_nameSet = false;
282
284 bool m_openedByAlgorithm = false;
285
286 GDALArgDatasetValue(const GDALArgDatasetValue &) = delete;
287 GDALArgDatasetValue &operator=(const GDALArgDatasetValue &) = delete;
288};
289
290/************************************************************************/
291/* GDALAlgorithmArgDecl */
292/************************************************************************/
293
298 class CPL_DLL GDALAlgorithmArgDecl final
299{
300 public:
303 static constexpr int UNBOUNDED = std::numeric_limits<int>::max();
304
313 GDALAlgorithmArgDecl(const std::string &longName, char chShortName,
314 const std::string &description,
315 GDALAlgorithmArgType type);
316
318 GDALAlgorithmArgDecl &AddAlias(const std::string &alias)
319 {
320 m_aliases.push_back(alias);
321 return *this;
322 }
323
325 GDALAlgorithmArgDecl &AddShortNameAlias(char shortNameAlias)
326 {
327 m_shortNameAliases.push_back(shortNameAlias);
328 return *this;
329 }
330
333 GDALAlgorithmArgDecl &AddHiddenAlias(const std::string &alias)
334 {
335 m_hiddenAliases.push_back(alias);
336 return *this;
337 }
338
341 GDALAlgorithmArgDecl &SetPositional()
342 {
343 m_positional = true;
344 return *this;
345 }
346
349 GDALAlgorithmArgDecl &SetRequired()
350 {
351 m_required = true;
352 return *this;
353 }
354
359 GDALAlgorithmArgDecl &SetMetaVar(const std::string &metaVar)
360 {
361 m_metaVar = metaVar;
362 return *this;
363 }
364
368 GDALAlgorithmArgDecl &SetCategory(const std::string &category)
369 {
370 m_category = category;
371 return *this;
372 }
373
376 template <class T> GDALAlgorithmArgDecl &SetDefault(const T &value)
377 {
378 m_hasDefaultValue = true;
379 try
380 {
381 switch (m_type)
382 {
383 case GAAT_BOOLEAN:
384 {
385 if constexpr (std::is_same_v<T, bool>)
386 {
387 m_defaultValue = value;
388 return *this;
389 }
390 break;
391 }
392
393 case GAAT_STRING:
394 {
395 if constexpr (std::is_same_v<T, std::string>)
396 {
397 m_defaultValue = value;
398 return *this;
399 }
400 break;
401 }
402
403 case GAAT_INTEGER:
404 {
405 if constexpr (std::is_same_v<T, int>)
406 {
407 m_defaultValue = value;
408 return *this;
409 }
410 break;
411 }
412
413 case GAAT_REAL:
414 {
415 if constexpr (std::is_assignable_v<double &, T>)
416 {
417 m_defaultValue = static_cast<double>(value);
418 return *this;
419 }
420 break;
421 }
422
423 case GAAT_STRING_LIST:
424 {
425 if constexpr (std::is_same_v<T, std::string>)
426 {
427 m_defaultValue = std::vector<std::string>{value};
428 return *this;
429 }
430 else if constexpr (std::is_same_v<T,
431 std::vector<std::string>>)
432 {
433 m_defaultValue = value;
434 return *this;
435 }
436 break;
437 }
438
439 case GAAT_INTEGER_LIST:
440 {
441 if constexpr (std::is_same_v<T, int>)
442 {
443 m_defaultValue = std::vector<int>{value};
444 return *this;
445 }
446 else if constexpr (std::is_same_v<T, std::vector<int>>)
447 {
448 m_defaultValue = value;
449 return *this;
450 }
451 break;
452 }
453
454 case GAAT_REAL_LIST:
455 {
456 if constexpr (std::is_assignable_v<double &, T>)
457 {
458 m_defaultValue =
459 std::vector<double>{static_cast<double>(value)};
460 return *this;
461 }
462 else if constexpr (std::is_same_v<T, std::vector<double>>)
463 {
464 m_defaultValue = value;
465 return *this;
466 }
467 break;
468 }
469
470 case GAAT_DATASET:
471 case GAAT_DATASET_LIST:
472 break;
473 }
474 }
475 catch (const std::bad_variant_access &)
476 {
477 // should not happen
478 // fallthrough
479 }
480 CPLError(CE_Failure, CPLE_AppDefined,
481 "Argument %s: SetDefault(): unexpected type for value",
482 GetName().c_str());
483 return *this;
484 }
485
488 GDALAlgorithmArgDecl &SetDefault(const char *value)
489 {
490 return SetDefault(std::string(value));
491 }
492
499 GDALAlgorithmArgDecl &SetMinCount(int count);
500
505 GDALAlgorithmArgDecl &SetMaxCount(int count);
506
510 GDALAlgorithmArgDecl &SetDisplayHintAboutRepetition(bool displayHint)
511 {
512 m_displayHintAboutRepetition = displayHint;
513 return *this;
514 }
515
520 GDALAlgorithmArgDecl &SetPackedValuesAllowed(bool allowed)
521 {
522 m_packedValuesAllowed = allowed;
523 return *this;
524 }
525
530 GDALAlgorithmArgDecl &SetRepeatedArgAllowed(bool allowed)
531 {
532 m_repeatedArgAllowed = allowed;
533 return *this;
534 }
535
537 GDALAlgorithmArgDecl &SetChoices()
538 {
539 return *this;
540 }
541
543
547 template <
548 typename T, typename... U,
549 typename std::enable_if<!std::is_same_v<T, std::vector<std::string> &>,
550 bool>::type = true>
551 GDALAlgorithmArgDecl &SetChoices(T &&first, U &&...rest)
552 {
553 m_choices.push_back(std::forward<T>(first));
554 SetChoices(std::forward<U>(rest)...);
555 return *this;
556 }
557
561 GDALAlgorithmArgDecl &SetChoices(const std::vector<std::string> &choices)
562 {
563 m_choices = choices;
564 return *this;
565 }
566
572 GDALAlgorithmArgDecl &SetMinValueIncluded(double min)
573 {
574 m_minVal = min;
575 m_minValIsIncluded = true;
576 return *this;
577 }
578
584 GDALAlgorithmArgDecl &SetMinValueExcluded(double min)
585 {
586 m_minVal = min;
587 m_minValIsIncluded = false;
588 return *this;
589 }
590
592 GDALAlgorithmArgDecl &SetMaxValueIncluded(double max)
593 {
594 m_maxVal = max;
595 m_maxValIsIncluded = true;
596 return *this;
597 }
598
600 GDALAlgorithmArgDecl &SetMaxValueExcluded(double max)
601 {
602 m_maxVal = max;
603 m_maxValIsIncluded = false;
604 return *this;
605 }
606
610 GDALAlgorithmArgDecl &SetMinCharCount(int count)
611 {
612 m_minCharCount = count;
613 return *this;
614 }
615
617 GDALAlgorithmArgDecl &SetHiddenChoices()
618 {
619 return *this;
620 }
621
623
627 template <typename T, typename... U>
628 GDALAlgorithmArgDecl &SetHiddenChoices(T &&first, U &&...rest)
629 {
630 m_hiddenChoices.push_back(std::forward<T>(first));
631 SetHiddenChoices(std::forward<U>(rest)...);
632 return *this;
633 }
634
639 GDALAlgorithmArgDecl &SetHiddenForCLI(bool hiddenForCLI = true)
640 {
641 m_hiddenForCLI = hiddenForCLI;
642 return *this;
643 }
644
648 GDALAlgorithmArgDecl &SetHiddenForAPI(bool hiddenForAPI = true)
649 {
650 m_hiddenForAPI = hiddenForAPI;
651 return *this;
652 }
653
657 GDALAlgorithmArgDecl &SetHidden()
658 {
659 m_hiddenForCLI = true;
660 m_hiddenForAPI = true;
661 return *this;
662 }
663
667 GDALAlgorithmArgDecl &SetIsInput(bool isInput = true)
668 {
669 m_isInput = isInput;
670 return *this;
671 }
672
682 GDALAlgorithmArgDecl &SetIsOutput(bool isOutput = true)
683 {
684 m_isOutput = isOutput;
685 return *this;
686 }
687
691 GDALAlgorithmArgDecl &SetMutualExclusionGroup(const std::string &group)
692 {
693 m_mutualExclusionGroup = group;
694 return *this;
695 }
696
699 GDALAlgorithmArgDecl &
700 AddMetadataItem(const std::string &name,
701 const std::vector<std::string> &values)
702 {
703 m_metadata[name] = values;
704 return *this;
705 }
706
711 GDALAlgorithmArgDecl &SetReadFromFileAtSyntaxAllowed()
712 {
713 m_readFromFileAtSyntaxAllowed = true;
714 return *this;
715 }
716
719 GDALAlgorithmArgDecl &SetRemoveSQLCommentsEnabled()
720 {
721 m_removeSQLComments = true;
722 return *this;
723 }
724
728 GDALAlgorithmArgDecl &SetAutoOpenDataset(bool autoOpen)
729 {
730 m_autoOpenDataset = autoOpen;
731 return *this;
732 }
733
737 GDALAlgorithmArgDecl &SetUserProvided()
738 {
739 m_userProvided = true;
740 return *this;
741 }
742
744 inline const std::string &GetName() const
745 {
746 return m_longName;
747 }
748
750 inline const std::string &GetShortName() const
751 {
752 return m_shortName;
753 }
754
756 inline const std::vector<std::string> &GetAliases() const
757 {
758 return m_aliases;
759 }
760
762 inline const std::vector<char> &GetShortNameAliases() const
763 {
764 return m_shortNameAliases;
765 }
766
768 inline const std::string &GetDescription() const
769 {
770 return m_description;
771 }
772
777 inline const std::string &GetMetaVar() const
778 {
779 return m_metaVar;
780 }
781
785 inline const std::string &GetCategory() const
786 {
787 return m_category;
788 }
789
791 inline GDALAlgorithmArgType GetType() const
792 {
793 return m_type;
794 }
795
799 inline const std::vector<std::string> &GetChoices() const
800 {
801 return m_choices;
802 }
803
807 inline const std::vector<std::string> &GetHiddenChoices() const
808 {
809 return m_hiddenChoices;
810 }
811
813 inline std::pair<double, bool> GetMinValue() const
814 {
815 return {m_minVal, m_minValIsIncluded};
816 }
817
819 inline std::pair<double, bool> GetMaxValue() const
820 {
821 return {m_maxVal, m_maxValIsIncluded};
822 }
823
827 inline int GetMinCharCount() const
828 {
829 return m_minCharCount;
830 }
831
834 inline bool IsRequired() const
835 {
836 return m_required;
837 }
838
842 inline int GetMinCount() const
843 {
844 return m_minCount;
845 }
846
851 inline int GetMaxCount() const
852 {
853 return m_maxCount;
854 }
855
859 inline bool GetDisplayHintAboutRepetition() const
860 {
861 return m_displayHintAboutRepetition;
862 }
863
868 inline bool GetPackedValuesAllowed() const
869 {
870 return m_packedValuesAllowed;
871 }
872
877 inline bool GetRepeatedArgAllowed() const
878 {
879 return m_repeatedArgAllowed;
880 }
881
883 inline bool IsPositional() const
884 {
885 return m_positional;
886 }
887
889 inline bool HasDefaultValue() const
890 {
891 return m_hasDefaultValue;
892 }
893
896 inline bool IsHidden() const
897 {
898 return m_hiddenForCLI && m_hiddenForAPI;
899 }
900
905 inline bool IsHiddenForCLI() const
906 {
907 return m_hiddenForCLI;
908 }
909
914 inline bool IsOnlyForCLI() const
915 CPL_WARN_DEPRECATED("Use IsHiddenForAPI() instead")
916 {
917 return m_hiddenForAPI;
918 }
919
922 inline bool IsHiddenForAPI() const
923 {
924 return m_hiddenForAPI;
925 }
926
930 inline bool IsInput() const
931 {
932 return m_isInput;
933 }
934
944 inline bool IsOutput() const
945 {
946 return m_isOutput;
947 }
948
953 inline const std::string &GetMutualExclusionGroup() const
954 {
955 return m_mutualExclusionGroup;
956 }
957
962 inline bool IsReadFromFileAtSyntaxAllowed() const
963 {
964 return m_readFromFileAtSyntaxAllowed;
965 }
966
969 bool IsRemoveSQLCommentsEnabled() const
970 {
971 return m_removeSQLComments;
972 }
973
977 bool AutoOpenDataset() const
978 {
979 return m_autoOpenDataset;
980 }
981
984 bool IsUserProvided() const
985 {
986 return m_userProvided;
987 }
988
990 inline const std::map<std::string, std::vector<std::string>>
991 GetMetadata() const
992 {
993 return m_metadata;
994 }
995
997 inline const std::vector<std::string> *
998 GetMetadataItem(const std::string &name) const
999 {
1000 const auto iter = m_metadata.find(name);
1001 return iter == m_metadata.end() ? nullptr : &(iter->second);
1002 }
1003
1018 template <class T> inline const T &GetDefault() const
1019 {
1020 return std::get<T>(m_defaultValue);
1021 }
1022
1028 GDALArgDatasetType GetDatasetType() const
1029 {
1030 return m_datasetType;
1031 }
1032
1038 void SetDatasetType(GDALArgDatasetType type)
1039 {
1040 m_datasetType = type;
1041 }
1042
1054 int GetDatasetInputFlags() const
1055 {
1056 return m_datasetInputFlags;
1057 }
1058
1069 int GetDatasetOutputFlags() const
1070 {
1071 return m_datasetOutputFlags;
1072 }
1073
1078 void SetDatasetInputFlags(int flags)
1079 {
1080 m_datasetInputFlags = flags;
1081 }
1082
1087 void SetDatasetOutputFlags(int flags)
1088 {
1089 m_datasetOutputFlags = flags;
1090 }
1091
1092 private:
1093 const std::string m_longName;
1094 const std::string m_shortName;
1095 const std::string m_description;
1096 const GDALAlgorithmArgType m_type;
1097 std::string m_category = GAAC_BASE;
1098 std::string m_metaVar{};
1099 std::string m_mutualExclusionGroup{};
1100 int m_minCount = 0;
1101 int m_maxCount = 0;
1102 bool m_required = false;
1103 bool m_positional = false;
1104 bool m_hasDefaultValue = false;
1105 bool m_hiddenForCLI = false;
1106 bool m_hiddenForAPI = false;
1107 bool m_isInput = true;
1108 bool m_isOutput = false;
1109 bool m_packedValuesAllowed = true;
1110 bool m_repeatedArgAllowed = true;
1111 bool m_displayHintAboutRepetition = true;
1112 bool m_readFromFileAtSyntaxAllowed = false;
1113 bool m_removeSQLComments = false;
1114 bool m_autoOpenDataset = true;
1115 bool m_userProvided = false;
1116 std::map<std::string, std::vector<std::string>> m_metadata{};
1117 std::vector<std::string> m_aliases{};
1118 std::vector<std::string> m_hiddenAliases{};
1119 std::vector<char> m_shortNameAliases{};
1120 std::vector<std::string> m_choices{};
1121 std::vector<std::string> m_hiddenChoices{};
1122 std::variant<bool, std::string, int, double, std::vector<std::string>,
1123 std::vector<int>, std::vector<double>>
1124 m_defaultValue{};
1125 double m_minVal = std::numeric_limits<double>::quiet_NaN();
1126 double m_maxVal = std::numeric_limits<double>::quiet_NaN();
1127 bool m_minValIsIncluded = false;
1128 bool m_maxValIsIncluded = false;
1129 int m_minCharCount = 0;
1130 GDALArgDatasetType m_datasetType =
1131 GDAL_OF_RASTER | GDAL_OF_VECTOR | GDAL_OF_MULTIDIM_RASTER;
1132
1136 int m_datasetInputFlags = GADV_NAME | GADV_OBJECT;
1137
1141 int m_datasetOutputFlags = GADV_OBJECT;
1142};
1143
1144/************************************************************************/
1145/* GDALAlgorithmArg */
1146/************************************************************************/
1147
1148 class GDALAlgorithm;
1149
1152 class CPL_DLL GDALAlgorithmArg /* non-final */
1153{
1154 public:
1156 template <class T>
1157 GDALAlgorithmArg(const GDALAlgorithmArgDecl &decl, T *pValue)
1158 : m_decl(decl), m_value(pValue)
1159 {
1160 if constexpr (!std::is_same_v<T, GDALArgDatasetValue> &&
1161 !std::is_same_v<T, std::vector<GDALArgDatasetValue>>)
1162 {
1163 if (decl.HasDefaultValue())
1164 {
1165 try
1166 {
1167 *std::get<T *>(m_value) = decl.GetDefault<T>();
1168 }
1169 catch (const std::bad_variant_access &e)
1170 {
1171 // I don't think that can happen, but Coverity Scan thinks
1172 // so
1173 CPLError(CE_Failure, CPLE_AppDefined,
1174 "*std::get<T *>(m_value) = decl.GetDefault<T>() "
1175 "failed: %s",
1176 e.what());
1177 }
1178 }
1179 }
1180 }
1181
1183 virtual ~GDALAlgorithmArg();
1184
1186 const GDALAlgorithmArgDecl &GetDeclaration() const
1187 {
1188 return m_decl;
1189 }
1190
1192 inline const std::string &GetName() const
1193 {
1194 return m_decl.GetName();
1195 }
1196
1198 inline const std::string &GetShortName() const
1199 {
1200 return m_decl.GetShortName();
1201 }
1202
1204 inline const std::vector<std::string> &GetAliases() const
1205 {
1206 return m_decl.GetAliases();
1207 }
1208
1210 inline const std::vector<char> &GetShortNameAliases() const
1211 {
1212 return m_decl.GetShortNameAliases();
1213 }
1214
1216 inline const std::string &GetDescription() const
1217 {
1218 return m_decl.GetDescription();
1219 }
1220
1222 inline const std::string &GetMetaVar() const
1223 {
1224 return m_decl.GetMetaVar();
1225 }
1226
1228 inline GDALAlgorithmArgType GetType() const
1229 {
1230 return m_decl.GetType();
1231 }
1232
1234 inline const std::string &GetCategory() const
1235 {
1236 return m_decl.GetCategory();
1237 }
1238
1240 inline bool IsRequired() const
1241 {
1242 return m_decl.IsRequired();
1243 }
1244
1246 inline int GetMinCount() const
1247 {
1248 return m_decl.GetMinCount();
1249 }
1250
1252 inline int GetMaxCount() const
1253 {
1254 return m_decl.GetMaxCount();
1255 }
1256
1258 inline bool GetDisplayHintAboutRepetition() const
1259 {
1260 return m_decl.GetDisplayHintAboutRepetition();
1261 }
1262
1264 inline bool GetPackedValuesAllowed() const
1265 {
1266 return m_decl.GetPackedValuesAllowed();
1267 }
1268
1270 inline bool GetRepeatedArgAllowed() const
1271 {
1272 return m_decl.GetRepeatedArgAllowed();
1273 }
1274
1276 inline bool IsPositional() const
1277 {
1278 return m_decl.IsPositional();
1279 }
1280
1282 inline const std::vector<std::string> &GetChoices() const
1283 {
1284 return m_decl.GetChoices();
1285 }
1286
1288 inline const std::vector<std::string> &GetHiddenChoices() const
1289 {
1290 return m_decl.GetHiddenChoices();
1291 }
1292
1296 inline std::vector<std::string>
1297 GetAutoCompleteChoices(const std::string &currentValue) const
1298 {
1299 if (m_autoCompleteFunction)
1300 return m_autoCompleteFunction(currentValue);
1301 return {};
1302 }
1303
1305 inline std::pair<double, bool> GetMinValue() const
1306 {
1307 return m_decl.GetMinValue();
1308 }
1309
1311 inline std::pair<double, bool> GetMaxValue() const
1312 {
1313 return m_decl.GetMaxValue();
1314 }
1315
1317 inline int GetMinCharCount() const
1318 {
1319 return m_decl.GetMinCharCount();
1320 }
1321
1323 inline bool IsExplicitlySet() const
1324 {
1325 return m_explicitlySet;
1326 }
1327
1329 inline bool HasDefaultValue() const
1330 {
1331 return m_decl.HasDefaultValue();
1332 }
1333
1335 inline bool IsHidden() const
1336 {
1337 return m_decl.IsHidden();
1338 }
1339
1341 inline bool IsHiddenForCLI() const
1342 {
1343 return m_decl.IsHiddenForCLI();
1344 }
1345
1347 inline bool IsOnlyForCLI() const
1348 CPL_WARN_DEPRECATED("Use IsHiddenForAPI() instead")
1349 {
1350 return m_decl.IsHiddenForAPI();
1351 }
1352
1354 inline bool IsHiddenForAPI() const
1355 {
1356 return m_decl.IsHiddenForAPI();
1357 }
1358
1360 inline bool IsInput() const
1361 {
1362 return m_decl.IsInput();
1363 }
1364
1366 inline bool IsOutput() const
1367 {
1368 return m_decl.IsOutput();
1369 }
1370
1372 inline bool IsReadFromFileAtSyntaxAllowed() const
1373 {
1374 return m_decl.IsReadFromFileAtSyntaxAllowed();
1375 }
1376
1378 inline bool IsRemoveSQLCommentsEnabled() const
1379 {
1380 return m_decl.IsRemoveSQLCommentsEnabled();
1381 }
1382
1384 inline const std::string &GetMutualExclusionGroup() const
1385 {
1386 return m_decl.GetMutualExclusionGroup();
1387 }
1388
1390 inline const std::map<std::string, std::vector<std::string>>
1391 GetMetadata() const
1392 {
1393 return m_decl.GetMetadata();
1394 }
1395
1397 inline const std::vector<std::string> *
1398 GetMetadataItem(const std::string &name) const
1399 {
1400 return m_decl.GetMetadataItem(name);
1401 }
1402
1404 template <class T> inline const T &GetDefault() const
1405 {
1406 return m_decl.GetDefault<T>();
1407 }
1408
1410 inline bool AutoOpenDataset() const
1411 {
1412 return m_decl.AutoOpenDataset();
1413 }
1414
1416 inline bool IsUserProvided() const
1417 {
1418 return m_decl.IsUserProvided();
1419 }
1420
1422 inline GDALArgDatasetType GetDatasetType() const
1423 {
1424 return m_decl.GetDatasetType();
1425 }
1426
1428 inline int GetDatasetInputFlags() const
1429 {
1430 return m_decl.GetDatasetInputFlags();
1431 }
1432
1434 inline int GetDatasetOutputFlags() const
1435 {
1436 return m_decl.GetDatasetOutputFlags();
1437 }
1438
1455 template <class T> inline T &Get()
1456 {
1457 return *(std::get<T *>(m_value));
1458 }
1459
1476 template <class T> inline const T &Get() const
1477 {
1478 return *(std::get<T *>(m_value));
1479 }
1480
1486 bool Set(bool value);
1487
1493 bool Set(const std::string &value);
1494
1500 bool Set(const char *value)
1501 {
1502 return Set(std::string(value ? value : ""));
1503 }
1504
1510 bool Set(GDALDataType dt)
1511 {
1512 return Set(GDALGetDataTypeName(dt));
1513 }
1514
1521 bool Set(const OGRSpatialReference &);
1522
1528 bool Set(int value);
1529
1531 bool Set(double value);
1532
1539 bool Set(GDALDataset *ds);
1540
1546 bool Set(std::unique_ptr<GDALDataset> ds);
1547
1553 bool SetDatasetName(const std::string &name);
1554
1561 bool SetFrom(const GDALArgDatasetValue &other);
1562
1568 bool Set(const std::vector<std::string> &value);
1569
1575 bool Set(const std::vector<int> &value);
1576
1582 bool Set(const std::vector<double> &value);
1583
1589 bool Set(std::vector<GDALArgDatasetValue> &&value);
1590
1592 inline GDALAlgorithmArg &operator=(bool value)
1593 {
1594 Set(value);
1595 return *this;
1596 }
1597
1599 inline GDALAlgorithmArg &operator=(int value)
1600 {
1601 Set(value);
1602 return *this;
1603 }
1604
1606 inline GDALAlgorithmArg &operator=(double value)
1607 {
1608 Set(value);
1609 return *this;
1610 }
1611
1613 inline GDALAlgorithmArg &operator=(const std::string &value)
1614 {
1615 Set(value);
1616 return *this;
1617 }
1618
1620 inline GDALAlgorithmArg &operator=(const char *value)
1621 {
1622 Set(value);
1623 return *this;
1624 }
1625
1627 inline GDALAlgorithmArg &operator=(GDALDataType value)
1628 {
1629 Set(value);
1630 return *this;
1631 }
1632
1634 inline GDALAlgorithmArg &operator=(const OGRSpatialReference &value)
1635 {
1636 Set(value);
1637 return *this;
1638 }
1639
1641 inline GDALAlgorithmArg &operator=(const std::vector<int> &value)
1642 {
1643 Set(value);
1644 return *this;
1645 }
1646
1648 inline GDALAlgorithmArg &operator=(const std::vector<double> &value)
1649 {
1650 Set(value);
1651 return *this;
1652 }
1653
1655 inline GDALAlgorithmArg &operator=(const std::vector<std::string> &value)
1656 {
1657 Set(value);
1658 return *this;
1659 }
1660
1662 inline GDALAlgorithmArg &operator=(GDALDataset *value)
1663 {
1664 Set(value);
1665 return *this;
1666 }
1667
1669 GDALAlgorithmArg &operator=(std::unique_ptr<GDALDataset> value);
1670
1677 bool SetFrom(const GDALAlgorithmArg &other);
1678
1681 void SetSkipIfAlreadySet(bool skip = true)
1682 {
1683 m_skipIfAlreadySet = skip;
1684 }
1685
1688 bool SkipIfAlreadySet() const
1689 {
1690 return m_skipIfAlreadySet;
1691 }
1692
1697 bool Serialize(std::string &serializedArg, bool absolutePath = false) const;
1698
1700 static std::string GetEscapedString(const std::string &s);
1701
1703 void NotifyValueSet()
1704 {
1705 m_explicitlySet = true;
1706 }
1707
1709
1710 protected:
1711 friend class GDALAlgorithm;
1713 GDALAlgorithmArgDecl m_decl;
1715 std::variant<bool *, std::string *, int *, double *, GDALArgDatasetValue *,
1716 std::vector<std::string> *, std::vector<int> *,
1717 std::vector<double> *, std::vector<GDALArgDatasetValue> *>
1718 m_value{};
1720 std::vector<std::function<void()>> m_actions{};
1722 std::vector<std::function<bool()>> m_validationActions{};
1724 std::function<std::vector<std::string>(const std::string &)>
1725 m_autoCompleteFunction{};
1727 GDALAlgorithm *m_owner = nullptr;
1728
1729 private:
1730 bool m_skipIfAlreadySet = false;
1731 bool m_explicitlySet = false;
1732
1733 template <class T> bool SetInternal(const T &value)
1734 {
1735 m_explicitlySet = true;
1736 *std::get<T *>(m_value) = value;
1737 return RunAllActions();
1738 }
1739
1740 bool ProcessString(std::string &value) const;
1741
1742 bool RunAllActions();
1743 void RunActions();
1744 bool RunValidationActions();
1745 std::string ValidateChoice(const std::string &value) const;
1746 bool ValidateIntRange(int val) const;
1747 bool ValidateRealRange(double val) const;
1748
1749 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,
1750 ...) const CPL_PRINT_FUNC_FORMAT(4, 5);
1751
1752 CPL_DISALLOW_COPY_ASSIGN(GDALAlgorithmArg)
1753};
1754
1755/************************************************************************/
1756/* GDALInConstructionAlgorithmArg */
1757/************************************************************************/
1758
1760namespace test_gdal_algorithm
1761{
1762 struct test_gdal_algorithm;
1763}
1764
1766
1770 class CPL_DLL GDALInConstructionAlgorithmArg final : public GDALAlgorithmArg
1771{
1772 friend struct test_gdal_algorithm::test_gdal_algorithm;
1773
1774 public:
1776 template <class T>
1777 GDALInConstructionAlgorithmArg(GDALAlgorithm *owner,
1778 const GDALAlgorithmArgDecl &decl, T *pValue)
1779 : GDALAlgorithmArg(decl, pValue)
1780 {
1781 m_owner = owner;
1782 }
1783
1785 ~GDALInConstructionAlgorithmArg() override;
1786
1788 GDALInConstructionAlgorithmArg &AddAlias(const std::string &alias);
1789
1791 GDALInConstructionAlgorithmArg &AddHiddenAlias(const std::string &alias);
1792
1794 GDALInConstructionAlgorithmArg &AddShortNameAlias(char shortNameAlias);
1795
1797 GDALInConstructionAlgorithmArg &SetPositional();
1798
1800 GDALInConstructionAlgorithmArg &SetRequired()
1801 {
1802 m_decl.SetRequired();
1803 return *this;
1804 }
1805
1807 GDALInConstructionAlgorithmArg &SetMetaVar(const std::string &metaVar)
1808 {
1809 m_decl.SetMetaVar(metaVar);
1810 return *this;
1811 }
1812
1814 GDALInConstructionAlgorithmArg &SetCategory(const std::string &category)
1815 {
1816 m_decl.SetCategory(category);
1817 return *this;
1818 }
1819
1821 template <class T>
1822 GDALInConstructionAlgorithmArg &SetDefault(const T &value)
1823 {
1824 m_decl.SetDefault(value);
1825
1826 if constexpr (!std::is_same_v<T, GDALArgDatasetValue> &&
1827 !std::is_same_v<T, std::vector<GDALArgDatasetValue>>)
1828 {
1829 try
1830 {
1831 switch (m_decl.GetType())
1832 {
1833 case GAAT_BOOLEAN:
1834 *std::get<bool *>(m_value) = m_decl.GetDefault<bool>();
1835 break;
1836 case GAAT_STRING:
1837 *std::get<std::string *>(m_value) =
1838 m_decl.GetDefault<std::string>();
1839 break;
1840 case GAAT_INTEGER:
1841 *std::get<int *>(m_value) = m_decl.GetDefault<int>();
1842 break;
1843 case GAAT_REAL:
1844 *std::get<double *>(m_value) =
1845 m_decl.GetDefault<double>();
1846 break;
1847 case GAAT_STRING_LIST:
1848 *std::get<std::vector<std::string> *>(m_value) =
1849 m_decl.GetDefault<std::vector<std::string>>();
1850 break;
1851 case GAAT_INTEGER_LIST:
1852 *std::get<std::vector<int> *>(m_value) =
1853 m_decl.GetDefault<std::vector<int>>();
1854 break;
1855 case GAAT_REAL_LIST:
1856 *std::get<std::vector<double> *>(m_value) =
1857 m_decl.GetDefault<std::vector<double>>();
1858 break;
1859 case GAAT_DATASET:
1860 case GAAT_DATASET_LIST:
1861 break;
1862 }
1863 }
1864 catch (const std::bad_variant_access &)
1865 {
1866 // I don't think that can happen, but Coverity Scan thinks so
1867 CPLError(CE_Failure, CPLE_AppDefined,
1868 "Argument %s: SetDefault(): unexpected type for value",
1869 GetName().c_str());
1870 }
1871 }
1872 return *this;
1873 }
1874
1876 GDALInConstructionAlgorithmArg &SetDefault(const char *value)
1877 {
1878 return SetDefault(std::string(value));
1879 }
1880
1882 GDALInConstructionAlgorithmArg &SetMinCount(int count)
1883 {
1884 m_decl.SetMinCount(count);
1885 return *this;
1886 }
1887
1889 GDALInConstructionAlgorithmArg &SetMaxCount(int count)
1890 {
1891 m_decl.SetMaxCount(count);
1892 return *this;
1893 }
1894
1896 GDALInConstructionAlgorithmArg &
1897 SetDisplayHintAboutRepetition(bool displayHint)
1898 {
1899 m_decl.SetDisplayHintAboutRepetition(displayHint);
1900 return *this;
1901 }
1902
1904 GDALInConstructionAlgorithmArg &SetPackedValuesAllowed(bool allowed)
1905 {
1906 m_decl.SetPackedValuesAllowed(allowed);
1907 return *this;
1908 }
1909
1911 GDALInConstructionAlgorithmArg &SetRepeatedArgAllowed(bool allowed)
1912 {
1913 m_decl.SetRepeatedArgAllowed(allowed);
1914 return *this;
1915 }
1916
1918 template <
1919 typename T, typename... U,
1920 typename std::enable_if<!std::is_same_v<T, std::vector<std::string> &>,
1921 bool>::type = true>
1922 GDALInConstructionAlgorithmArg &SetChoices(T &&first, U &&...rest)
1923 {
1924 m_decl.SetChoices(std::forward<T>(first), std::forward<U>(rest)...);
1925 return *this;
1926 }
1927
1929 GDALInConstructionAlgorithmArg &
1930 SetChoices(const std::vector<std::string> &choices)
1931 {
1932 m_decl.SetChoices(choices);
1933 return *this;
1934 }
1935
1937 template <typename T, typename... U>
1938 GDALInConstructionAlgorithmArg &SetHiddenChoices(T &&first, U &&...rest)
1939 {
1940 m_decl.SetHiddenChoices(std::forward<T>(first),
1941 std::forward<U>(rest)...);
1942 return *this;
1943 }
1944
1946 GDALInConstructionAlgorithmArg &SetMinValueIncluded(double min)
1947 {
1948 m_decl.SetMinValueIncluded(min);
1949 return *this;
1950 }
1951
1953 GDALInConstructionAlgorithmArg &SetMinValueExcluded(double min)
1954 {
1955 m_decl.SetMinValueExcluded(min);
1956 return *this;
1957 }
1958
1960 GDALInConstructionAlgorithmArg &SetMaxValueIncluded(double max)
1961 {
1962 m_decl.SetMaxValueIncluded(max);
1963 return *this;
1964 }
1965
1967 GDALInConstructionAlgorithmArg &SetMaxValueExcluded(double max)
1968 {
1969 m_decl.SetMaxValueExcluded(max);
1970 return *this;
1971 }
1972
1974 GDALInConstructionAlgorithmArg &SetMinCharCount(int count)
1975 {
1976 m_decl.SetMinCharCount(count);
1977 return *this;
1978 }
1979
1981 GDALInConstructionAlgorithmArg &SetHidden()
1982 {
1983 m_decl.SetHidden();
1984 return *this;
1985 }
1986
1988 GDALInConstructionAlgorithmArg &SetHiddenForCLI(bool hiddenForCLI = true)
1989 {
1990 m_decl.SetHiddenForCLI(hiddenForCLI);
1991 return *this;
1992 }
1993
1995 GDALInConstructionAlgorithmArg &SetHiddenForAPI(bool hiddenForAPI = true)
1996 {
1997 m_decl.SetHiddenForAPI(hiddenForAPI);
1998 return *this;
1999 }
2000
2002 GDALInConstructionAlgorithmArg &SetIsInput(bool isInput = true)
2003 {
2004 m_decl.SetIsInput(isInput);
2005 return *this;
2006 }
2007
2009 GDALInConstructionAlgorithmArg &SetIsOutput(bool isOutput = true)
2010 {
2011 m_decl.SetIsOutput(isOutput);
2012 return *this;
2013 }
2014
2016 GDALInConstructionAlgorithmArg &SetReadFromFileAtSyntaxAllowed()
2017 {
2018 m_decl.SetReadFromFileAtSyntaxAllowed();
2019 return *this;
2020 }
2021
2023 GDALInConstructionAlgorithmArg &SetRemoveSQLCommentsEnabled()
2024 {
2025 m_decl.SetRemoveSQLCommentsEnabled();
2026 return *this;
2027 }
2028
2030 GDALInConstructionAlgorithmArg &SetAutoOpenDataset(bool autoOpen)
2031 {
2032 m_decl.SetAutoOpenDataset(autoOpen);
2033 return *this;
2034 }
2035
2037 GDALInConstructionAlgorithmArg &
2038 SetMutualExclusionGroup(const std::string &group)
2039 {
2040 m_decl.SetMutualExclusionGroup(group);
2041 return *this;
2042 }
2043
2045 GDALInConstructionAlgorithmArg &
2046 AddMetadataItem(const std::string &name,
2047 const std::vector<std::string> &values)
2048 {
2049 m_decl.AddMetadataItem(name, values);
2050 return *this;
2051 }
2052
2054 GDALInConstructionAlgorithmArg &
2055 SetDatasetType(GDALArgDatasetType datasetType)
2056 {
2057 m_decl.SetDatasetType(datasetType);
2058 return *this;
2059 }
2060
2062 GDALInConstructionAlgorithmArg &SetDatasetInputFlags(int flags)
2063 {
2064 m_decl.SetDatasetInputFlags(flags);
2065 return *this;
2066 }
2067
2069 GDALInConstructionAlgorithmArg &SetDatasetOutputFlags(int flags)
2070 {
2071 m_decl.SetDatasetOutputFlags(flags);
2072 return *this;
2073 }
2074
2078 GDALInConstructionAlgorithmArg &AddAction(std::function<void()> f)
2079 {
2080 m_actions.push_back(f);
2081 return *this;
2082 }
2083
2090 GDALInConstructionAlgorithmArg &AddValidationAction(std::function<bool()> f)
2091 {
2092 m_validationActions.push_back(f);
2093 return *this;
2094 }
2095
2099 GDALInConstructionAlgorithmArg &SetAutoCompleteFunction(
2100 std::function<std::vector<std::string>(const std::string &)> f)
2101 {
2102 m_autoCompleteFunction = std::move(f);
2103 return *this;
2104 }
2105
2112 GDALInConstructionAlgorithmArg &
2113 SetIsCRSArg(bool noneAllowed = false,
2114 const std::vector<std::string> &specialValues =
2115 std::vector<std::string>());
2116
2118 GDALInConstructionAlgorithmArg &SetUserProvided()
2119 {
2120 m_decl.SetUserProvided();
2121 return *this;
2122 }
2123};
2124
2125/************************************************************************/
2126/* GDALAlgorithmRegistry */
2127/************************************************************************/
2128
2131 class CPL_DLL GDALAlgorithmRegistry
2132{
2133 public:
2136 static constexpr const char *HIDDEN_ALIAS_SEPARATOR = "==hide==";
2137
2138 virtual ~GDALAlgorithmRegistry();
2139
2141 class AlgInfo
2142 {
2143 public:
2145 std::string m_name{};
2147 std::vector<std::string> m_aliases{};
2148#ifdef DOXYGEN_SKIP
2150 std::function m_creationFunc{};
2151#else
2153 std::function<std::unique_ptr<GDALAlgorithm>(void)> m_creationFunc{};
2154#endif
2155 };
2156
2159 template <class MyAlgorithm> bool Register()
2160 {
2161 AlgInfo info;
2162 info.m_name = MyAlgorithm::NAME;
2163 info.m_aliases = MyAlgorithm::GetAliasesStatic();
2164 info.m_creationFunc = []() -> std::unique_ptr<GDALAlgorithm>
2165 { return std::make_unique<MyAlgorithm>(); };
2166 return Register(info);
2167 }
2168
2171 bool Register(const AlgInfo &info);
2172
2178 std::vector<std::string> GetNames() const;
2179
2183 std::unique_ptr<GDALAlgorithm> Instantiate(const std::string &name) const;
2184
2189 std::unique_ptr<GDALAlgorithm>
2190 Instantiate(const std::vector<std::string> &path) const;
2191
2196 template <typename... V>
2197 inline std::unique_ptr<GDALAlgorithm> Instantiate(const std::string &first,
2198 V &&...rest)
2199 {
2200 std::vector<std::string> path;
2201 return InstantiateInternal(path, first, std::forward<V>(rest)...);
2202 }
2203
2205 const AlgInfo *GetInfo(const std::string &name) const
2206 {
2207 auto iter = m_mapNameToInfo.find(name);
2208 return iter != m_mapNameToInfo.end() ? &(iter->second) : nullptr;
2209 }
2210
2212 bool empty() const
2213 {
2214 return m_mapNameToInfo.empty();
2215 }
2216
2217 protected:
2219 virtual std::unique_ptr<GDALAlgorithm>
2220 InstantiateTopLevel(const std::string &name) const;
2221
2222 private:
2223 std::map<std::string, AlgInfo> m_mapNameToInfo{};
2224 std::map<std::string, AlgInfo> m_mapAliasToInfo{};
2225 std::map<std::string, AlgInfo> m_mapHiddenAliasToInfo{};
2226
2227 std::unique_ptr<GDALAlgorithm>
2228 InstantiateInternal(std::vector<std::string> &path);
2229
2230 template <typename... V>
2231 std::unique_ptr<GDALAlgorithm>
2232 InstantiateInternal(std::vector<std::string> &path,
2233 const std::string &first, V &&...rest)
2234 {
2235 path.push_back(first);
2236 return InstantiateInternal(path, std::forward<V>(rest)...);
2237 }
2238};
2239
2240/************************************************************************/
2241/* GDALAlgorithm */
2242/************************************************************************/
2243
2260/* abstract */ class CPL_DLL GDALAlgorithm
2261{
2262 friend struct test_gdal_algorithm::test_gdal_algorithm;
2263
2264 public:
2265 virtual ~GDALAlgorithm();
2266
2268 const std::string &GetName() const
2269 {
2270 return m_name;
2271 }
2272
2274 const std::string &GetDescription() const
2275 {
2276 return m_description;
2277 }
2278
2280 const std::string &GetLongDescription() const
2281 {
2282 return m_longDescription;
2283 }
2284
2288 const std::string &GetHelpURL() const
2289 {
2290 return m_helpURL;
2291 }
2292
2294 const std::string &GetHelpFullURL() const
2295 {
2296 return m_helpFullURL;
2297 }
2298
2300 bool IsHidden() const
2301 {
2302 return m_hidden;
2303 }
2304
2306 bool HasSubAlgorithms() const;
2307
2313 std::vector<std::string> GetSubAlgorithmNames() const;
2314
2316 std::unique_ptr<GDALAlgorithm>
2317 InstantiateSubAlgorithm(const std::string &name,
2318 bool suggestionAllowed = true) const;
2319
2321 const std::vector<std::unique_ptr<GDALAlgorithmArg>> &GetArgs() const
2322 {
2323 return m_args;
2324 }
2325
2327 std::vector<std::unique_ptr<GDALAlgorithmArg>> &GetArgs()
2328 {
2329 return m_args;
2330 }
2331
2333 std::string GetSuggestionForArgumentName(const std::string &osName) const;
2334
2336 GDALAlgorithmArg *GetArg(const std::string &osName,
2337 bool suggestionAllowed = false)
2338 {
2339 return GetArg(osName, suggestionAllowed, /* isConst = */ false);
2340 }
2341
2343 GDALAlgorithmArg &operator[](const std::string &osName)
2344 {
2345 auto alg = GetArg(osName, false);
2346 if (!alg)
2347 {
2348 ReportError(CE_Failure, CPLE_AppDefined,
2349 "Argument '%s' does not exist", osName.c_str());
2350 return m_dummyArg;
2351 }
2352 return *alg;
2353 }
2354
2356 const GDALAlgorithmArg *GetArg(const std::string &osName,
2357 bool suggestionAllowed = false) const
2358 {
2359 return const_cast<GDALAlgorithm *>(this)->GetArg(
2360 osName, suggestionAllowed, /* isConst = */ true);
2361 }
2362
2364 const GDALAlgorithmArg &operator[](const std::string &osName) const
2365 {
2366 const auto alg = GetArg(osName, false);
2367 if (!alg)
2368 {
2369 ReportError(CE_Failure, CPLE_AppDefined,
2370 "Argument '%s' does not exist", osName.c_str());
2371 return m_dummyArg;
2372 }
2373 return *alg;
2374 }
2375
2381 void SetCallPath(const std::vector<std::string> &path)
2382 {
2383 m_callPath = path;
2384 }
2385
2390 void SetParseForAutoCompletion()
2391 {
2392 m_parseForAutoCompletion = true;
2393 }
2394
2399 void SetReferencePathForRelativePaths(const std::string &referencePath)
2400 {
2401 m_referencePath = referencePath;
2402 }
2403
2405 const std::string &GetReferencePathForRelativePaths() const
2406 {
2407 return m_referencePath;
2408 }
2409
2411 bool SupportsStreamedOutput() const
2412 {
2413 return m_supportsStreamedOutput;
2414 }
2415
2423 void SetExecutionForStreamedOutput()
2424 {
2425 m_executionForStreamOutput = true;
2426 }
2427
2431 virtual bool
2432 ParseCommandLineArguments(const std::vector<std::string> &args);
2433
2443 virtual bool ValidateArguments();
2444
2448 bool Run(GDALProgressFunc pfnProgress = nullptr,
2449 void *pProgressData = nullptr);
2450
2454 virtual bool Finalize();
2455
2457 struct UsageOptions
2458 {
2460 bool isPipelineStep;
2462 size_t maxOptLen;
2464 bool isPipelineMain;
2465
2466 UsageOptions()
2467 : isPipelineStep(false), maxOptLen(0), isPipelineMain(false)
2468 {
2469 }
2470 };
2471
2475 virtual std::string
2476 GetUsageForCLI(bool shortUsage,
2477 const UsageOptions &usageOptions = UsageOptions()) const;
2478
2483 virtual std::string GetUsageAsJSON() const;
2484
2490 GDALAlgorithm &GetActualAlgorithm()
2491 {
2492 if (m_selectedSubAlg)
2493 return m_selectedSubAlg->GetActualAlgorithm();
2494 return *this;
2495 }
2496
2498 bool IsHelpRequested() const
2499 {
2500 return m_helpRequested;
2501 }
2502
2504 bool IsJSONUsageRequested() const
2505 {
2506 return m_JSONUsageRequested;
2507 }
2508
2510 bool IsProgressBarRequested() const
2511 {
2512 if (m_selectedSubAlg)
2513 return m_selectedSubAlg->IsProgressBarRequested();
2514 return m_progressBarRequested;
2515 }
2516
2518 const std::vector<std::string> &GetAliases() const
2519 {
2520 return m_aliases;
2521 }
2522
2524
2527 static std::vector<std::string> GetAliasesStatic()
2528 {
2529 return {};
2530 }
2531
2533
2538 bool PropagateSpecialActionTo(GDALAlgorithm *target)
2539 {
2540 target->m_calledFromCommandLine = m_calledFromCommandLine;
2541 target->m_progressBarRequested = m_progressBarRequested;
2542 target->m_quiet = m_quiet;
2543 if (m_specialActionRequested)
2544 {
2545 target->m_specialActionRequested = m_specialActionRequested;
2546 target->m_helpRequested = m_helpRequested;
2547 target->m_helpDocRequested = m_helpDocRequested;
2548 target->m_JSONUsageRequested = m_JSONUsageRequested;
2549 return true;
2550 }
2551 return false;
2552 }
2553
2555 virtual std::vector<std::string>
2556 GetAutoComplete(std::vector<std::string> &args, bool lastWordIsComplete,
2557 bool showAllOptions);
2558
2560 void SetCalledFromCommandLine()
2561 {
2562 m_calledFromCommandLine = true;
2563 }
2564
2566 bool IsCalledFromCommandLine() const
2567 {
2568 return m_calledFromCommandLine;
2569 }
2570
2572 virtual bool HasOutputString() const;
2573
2577 static bool SaveGDALG(const std::string &filename, std::string &outString,
2578 const std::string &commandLine);
2579
2581 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,
2582 ...) const CPL_PRINT_FUNC_FORMAT(4, 5);
2584
2585 protected:
2586 friend class GDALInConstructionAlgorithmArg;
2587 friend class GDALRasterReprojectUtils;
2588
2591 GDALAlgorithm *m_selectedSubAlg = nullptr;
2592
2596 std::vector<std::string> m_callPath{};
2597
2599 std::string m_longDescription{};
2600
2602 bool m_progressBarRequested = true;
2603
2605 bool m_quiet = false;
2606
2608 bool m_skipValidationInParseCommandLine = false;
2609
2610 friend class GDALAlgorithmRegistry; // to set m_aliases
2612 std::vector<std::string> m_aliases{};
2613
2615 bool m_supportsStreamedOutput = false;
2616
2618 bool m_executionForStreamOutput = false;
2619
2621 bool m_hidden = false;
2622
2624 std::map<std::string, GDALDataset *> m_oMapDatasetNameToDataset{};
2625
2627 GDALAlgorithm(const std::string &name, const std::string &description,
2628 const std::string &helpURL);
2629
2631 bool ProcessDatasetArg(GDALAlgorithmArg *arg, GDALAlgorithm *algForOutput);
2632
2635 template <class MyAlgorithm> bool RegisterSubAlgorithm()
2636 {
2637 return m_subAlgRegistry.Register<MyAlgorithm>();
2638 }
2639
2642 bool RegisterSubAlgorithm(const GDALAlgorithmRegistry::AlgInfo &info)
2643 {
2644 return m_subAlgRegistry.Register(info);
2645 }
2646
2648 void AllowArbitraryLongNameArgs()
2649 {
2650 m_arbitraryLongNameArgsAllowed = true;
2651 }
2652
2654 GDALInConstructionAlgorithmArg &AddArg(const std::string &longName,
2655 char chShortName,
2656 const std::string &helpMessage,
2657 bool *pValue);
2658
2660 GDALInConstructionAlgorithmArg &AddArg(const std::string &longName,
2661 char chShortName,
2662 const std::string &helpMessage,
2663 std::string *pValue);
2664
2666 GDALInConstructionAlgorithmArg &AddArg(const std::string &longName,
2667 char chShortName,
2668 const std::string &helpMessage,
2669 int *pValue);
2670
2672 GDALInConstructionAlgorithmArg &AddArg(const std::string &longName,
2673 char chShortName,
2674 const std::string &helpMessage,
2675 double *pValue);
2676
2678 static void
2679 SetAutoCompleteFunctionForFilename(GDALInConstructionAlgorithmArg &arg,
2680 GDALArgDatasetType type);
2681
2683 GDALInConstructionAlgorithmArg &
2684 AddArg(const std::string &longName, char chShortName,
2685 const std::string &helpMessage, GDALArgDatasetValue *pValue,
2686 GDALArgDatasetType type = GDAL_OF_RASTER | GDAL_OF_VECTOR |
2687 GDAL_OF_MULTIDIM_RASTER);
2688
2690 GDALInConstructionAlgorithmArg &AddArg(const std::string &longName,
2691 char chShortName,
2692 const std::string &helpMessage,
2693 std::vector<std::string> *pValue);
2694
2696 GDALInConstructionAlgorithmArg &AddArg(const std::string &longName,
2697 char chShortName,
2698 const std::string &helpMessage,
2699 std::vector<int> *pValue);
2700
2702 GDALInConstructionAlgorithmArg &AddArg(const std::string &longName,
2703 char chShortName,
2704 const std::string &helpMessage,
2705 std::vector<double> *pValue);
2706
2708 GDALInConstructionAlgorithmArg &
2709 AddArg(const std::string &longName, char chShortName,
2710 const std::string &helpMessage,
2711 std::vector<GDALArgDatasetValue> *pValue,
2712 GDALArgDatasetType type = GDAL_OF_RASTER | GDAL_OF_VECTOR |
2713 GDAL_OF_MULTIDIM_RASTER);
2714
2716 GDALInConstructionAlgorithmArg &AddInputDatasetArg(
2717 GDALArgDatasetValue *pValue,
2718 GDALArgDatasetType type = GDAL_OF_RASTER | GDAL_OF_VECTOR |
2719 GDAL_OF_MULTIDIM_RASTER,
2720 bool positionalAndRequired = true, const char *helpMessage = nullptr);
2721
2723 GDALInConstructionAlgorithmArg &AddInputDatasetArg(
2724 std::vector<GDALArgDatasetValue> *pValue,
2725 GDALArgDatasetType type = GDAL_OF_RASTER | GDAL_OF_VECTOR |
2726 GDAL_OF_MULTIDIM_RASTER,
2727 bool positionalAndRequired = true, const char *helpMessage = nullptr);
2728
2730 GDALInConstructionAlgorithmArg &
2731 AddOpenOptionsArg(std::vector<std::string> *pValue,
2732 const char *helpMessage = nullptr);
2733
2735 GDALInConstructionAlgorithmArg &
2736 AddOutputOpenOptionsArg(std::vector<std::string> *pValue,
2737 const char *helpMessage = nullptr);
2738
2740 GDALInConstructionAlgorithmArg &
2741 AddInputFormatsArg(std::vector<std::string> *pValue,
2742 const char *helpMessage = nullptr);
2743
2745 GDALInConstructionAlgorithmArg &AddOutputDatasetArg(
2746 GDALArgDatasetValue *pValue,
2747 GDALArgDatasetType type = GDAL_OF_RASTER | GDAL_OF_VECTOR |
2748 GDAL_OF_MULTIDIM_RASTER,
2749 bool positionalAndRequired = true, const char *helpMessage = nullptr);
2750
2752 GDALInConstructionAlgorithmArg &
2753 AddOverwriteArg(bool *pValue, const char *helpMessage = nullptr);
2754
2756 GDALInConstructionAlgorithmArg &
2757 AddOverwriteLayerArg(bool *pValue, const char *helpMessage = nullptr);
2758
2760 GDALInConstructionAlgorithmArg &
2761 AddUpdateArg(bool *pValue, const char *helpMessage = nullptr);
2762
2764 GDALInConstructionAlgorithmArg &
2765 AddAppendLayerArg(bool *pValue, const char *helpMessage = nullptr);
2766
2768 GDALInConstructionAlgorithmArg &
2769 AddOutputStringArg(std::string *pValue, const char *helpMessage = nullptr);
2770
2772 GDALInConstructionAlgorithmArg &
2773 AddStdoutArg(bool *pValue, const char *helpMessage = nullptr);
2774
2776 GDALInConstructionAlgorithmArg &
2777 AddOutputFormatArg(std::string *pValue, bool bStreamAllowed = false,
2778 bool bGDALGAllowed = false,
2779 const char *helpMessage = nullptr);
2780
2782 GDALInConstructionAlgorithmArg &
2783 AddOutputDataTypeArg(std::string *pValue,
2784 const char *helpMessage = nullptr);
2785
2787 GDALInConstructionAlgorithmArg &
2788 AddNodataArg(std::string *pValue, bool noneAllowed,
2789 const std::string &optionName = "nodata",
2790 const char *helpMessage = nullptr);
2791
2793 GDALInConstructionAlgorithmArg &
2794 AddCreationOptionsArg(std::vector<std::string> *pValue,
2795 const char *helpMessage = nullptr);
2796
2798 GDALInConstructionAlgorithmArg &
2799 AddLayerCreationOptionsArg(std::vector<std::string> *pValue,
2800 const char *helpMessage = nullptr);
2801
2803 GDALInConstructionAlgorithmArg &
2804 AddLayerNameArg(std::string *pValue, const char *helpMessage = nullptr);
2805
2807 GDALInConstructionAlgorithmArg &
2808 AddOutputLayerNameArg(std::string *pValue,
2809 const char *helpMessage = nullptr);
2810
2812 GDALInConstructionAlgorithmArg &
2813 AddLayerNameArg(std::vector<std::string> *pValue,
2814 const char *helpMessage = nullptr);
2815
2817 GDALInConstructionAlgorithmArg &
2818 AddArrayNameArg(std::string *pValue, const char *helpMessage = nullptr);
2819
2821 GDALInConstructionAlgorithmArg &
2822 AddArrayNameArg(std::vector<std::string> *pValue,
2823 const char *helpMessage = nullptr);
2824
2829 GDALInConstructionAlgorithmArg &
2830 AddMemorySizeArg(size_t *pValue, std::string *pStrValue,
2831 const std::string &optionName, const char *helpMessage);
2832
2834 GDALInConstructionAlgorithmArg &
2835 AddGeometryTypeArg(std::string *pValue, const char *helpMessage = nullptr);
2836
2838 static void SetAutoCompleteFunctionForLayerName(
2839 GDALInConstructionAlgorithmArg &layerArg,
2840 GDALInConstructionAlgorithmArg &datasetArg);
2841
2843 static void SetAutoCompleteFunctionForFieldName(
2844 GDALInConstructionAlgorithmArg &fieldArg,
2845 GDALInConstructionAlgorithmArg &layerNameArg,
2846 std::vector<GDALArgDatasetValue> &datasetArg);
2847
2849 GDALInConstructionAlgorithmArg &
2850 AddFieldNameArg(std::string *pValue, const char *helpMessage = nullptr);
2851
2853 GDALInConstructionAlgorithmArg &AddFieldTypeSubtypeArg(
2854 OGRFieldType *pTypeValue, OGRFieldSubType *pSubtypeValue,
2855 std::string *pStrValue, const std::string &argName = std::string(),
2856 const char *helpMessage = nullptr);
2857
2859 GDALInConstructionAlgorithmArg &
2860 AddBandArg(int *pValue, const char *helpMessage = nullptr);
2861
2863 GDALInConstructionAlgorithmArg &
2864 AddBandArg(std::vector<int> *pValue, const char *helpMessage = nullptr);
2865
2867 GDALInConstructionAlgorithmArg &
2868 AddBBOXArg(std::vector<double> *pValue, const char *helpMessage = nullptr);
2869
2871 GDALInConstructionAlgorithmArg &
2872 AddActiveLayerArg(std::string *pValue, const char *helpMessage = nullptr);
2873
2878 GDALInConstructionAlgorithmArg &
2879 AddNumThreadsArg(int *pValue, std::string *pStrValue,
2880 const char *helpMessage = nullptr);
2881
2883 GDALInConstructionAlgorithmArg &
2884 AddAbsolutePathArg(bool *pValue, const char *helpMessage = nullptr);
2885
2887 GDALInConstructionAlgorithmArg &
2888 AddPixelFunctionNameArg(std::string *pValue,
2889 const char *helpMessage = nullptr);
2890
2892 GDALInConstructionAlgorithmArg &
2893 AddPixelFunctionArgsArg(std::vector<std::string> *pValue,
2894 const char *helpMessage = nullptr);
2895
2897 void AddProgressArg();
2898
2905 void AddValidationAction(std::function<bool()> f)
2906 {
2907 m_validationActions.push_back(f);
2908 }
2909
2911 static bool AddOptionsSuggestions(const char *pszXML, int datasetType,
2912 const std::string &currentValue,
2913 std::vector<std::string> &oRet);
2914
2916 bool ParseAndValidateKeyValue(GDALAlgorithmArg &arg);
2917
2919 bool RunPreStepPipelineValidations() const;
2920
2922 bool IsGDALGOutput() const;
2923
2925 enum class ProcessGDALGOutputRet
2926 {
2928 GDALG_OK,
2930 GDALG_ERROR,
2932 NOT_GDALG,
2933 };
2934
2936 virtual ProcessGDALGOutputRet ProcessGDALGOutput();
2937
2941 virtual bool CheckSafeForStreamOutput();
2942
2944 bool ValidateFormat(const GDALAlgorithmArg &arg, bool bStreamAllowed,
2945 bool bGDALGAllowed) const;
2946
2948 static std::vector<std::string>
2949 FormatAutoCompleteFunction(const GDALAlgorithmArg &arg, bool bStreamAllowed,
2950 bool bGDALGAllowed);
2951
2953 void AddAliasFor(GDALInConstructionAlgorithmArg *arg,
2954 const std::string &alias);
2955
2956 void AddShortNameAliasFor(GDALInConstructionAlgorithmArg *arg,
2957 char shortNameAlias);
2958
2959 void SetPositional(GDALInConstructionAlgorithmArg *arg);
2960
2961 std::vector<std::string>
2962 OpenOptionCompleteFunction(const std::string &currentValue) const;
2963
2965
2967 static bool IsKnownOutputRelatedBooleanArgName(std::string_view osName);
2968
2970 void SetDisplayInJSONUsage(bool b)
2971 {
2972 m_displayInJSONUsage = b;
2973 }
2974
2978 virtual void WarnIfDeprecated()
2979 {
2980 }
2981
2983 std::pair<std::vector<std::pair<GDALAlgorithmArg *, std::string>>, size_t>
2984 GetArgNamesForCLI() const;
2985
2987 std::string GetUsageForCLIEnd() const;
2989
2990 private:
2991 const std::string m_name{};
2992 const std::string m_description{};
2993 const std::string m_helpURL{};
2994 const std::string m_helpFullURL{};
2995 bool m_parsedSubStringAlreadyCalled = false;
2996 bool m_displayInJSONUsage = true;
2997 bool m_specialActionRequested = false;
2998 bool m_helpRequested = false;
2999 bool m_calledFromCommandLine = false;
3000
3001 // Used by program-output directives in .rst files
3002 bool m_helpDocRequested = false;
3003
3004 bool m_JSONUsageRequested = false;
3005 bool m_parseForAutoCompletion = false;
3006 std::string m_referencePath{};
3007 std::vector<std::string> m_dummyConfigOptions{};
3008 std::vector<std::unique_ptr<GDALAlgorithmArg>> m_args{};
3009 std::map<std::string, GDALAlgorithmArg *> m_mapLongNameToArg{};
3010 std::map<std::string, GDALAlgorithmArg *> m_mapShortNameToArg{};
3011 std::vector<GDALAlgorithmArg *> m_positionalArgs{};
3012 GDALAlgorithmRegistry m_subAlgRegistry{};
3013 std::unique_ptr<GDALAlgorithm> m_selectedSubAlgHolder{};
3014 std::function<std::vector<std::string>(const std::vector<std::string> &)>
3015 m_autoCompleteFunction{};
3016 std::vector<std::function<bool()>> m_validationActions{};
3017
3018 std::string m_dummyVal{};
3019 GDALAlgorithmArg m_dummyArg{
3020 GDALAlgorithmArgDecl("dummy", 0, "", GAAT_STRING), &m_dummyVal};
3021
3025 bool m_arbitraryLongNameArgsAllowed = false;
3026
3027 std::vector<std::unique_ptr<std::string>>
3028 m_arbitraryLongNameArgsValuesStr{};
3029 std::vector<std::unique_ptr<bool>> m_arbitraryLongNameArgsValuesBool{};
3030
3031 friend GDALAlgorithmArgH GDALAlgorithmGetArg(GDALAlgorithmH hAlg,
3032 const char *pszArgName);
3033 friend GDALAlgorithmArgH
3034 GDALAlgorithmGetArgNonConst(GDALAlgorithmH hAlg, const char *pszArgName);
3035 GDALAlgorithmArg *GetArg(const std::string &osName, bool suggestionAllowed,
3036 bool isConst);
3037
3038 GDALInConstructionAlgorithmArg &
3039 AddArg(std::unique_ptr<GDALInConstructionAlgorithmArg> arg);
3040 bool ParseArgument(
3041 GDALAlgorithmArg *arg, const std::string &name,
3042 const std::string &value,
3043 std::map<
3044 GDALAlgorithmArg *,
3045 std::variant<std::vector<std::string>, std::vector<int>,
3046 std::vector<double>, std::vector<GDALArgDatasetValue>>>
3047 &inConstructionValues);
3048
3049 bool ValidateBandArg() const;
3050
3051 virtual bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) = 0;
3052
3056 void ExtractLastOptionAndValue(std::vector<std::string> &args,
3057 std::string &option,
3058 std::string &value) const;
3059
3060 std::vector<std::string> AutoCompleteArrayName() const;
3061
3062 GDALAlgorithm(const GDALAlgorithm &) = delete;
3063 GDALAlgorithm &operator=(const GDALAlgorithm &) = delete;
3064};
3065
3067 struct GDALAlgorithmHS
3068{
3069 private:
3070 std::unique_ptr<GDALAlgorithm> uniquePtr{};
3071
3072 GDALAlgorithmHS(const GDALAlgorithmHS &) = delete;
3073 GDALAlgorithmHS &operator=(const GDALAlgorithmHS &) = delete;
3074
3075 public:
3076 GDALAlgorithm *ptr = nullptr;
3077
3078 GDALAlgorithmHS() = default;
3079
3080 explicit GDALAlgorithmHS(std::unique_ptr<GDALAlgorithm> alg)
3081 : uniquePtr(std::move(alg)), ptr(uniquePtr.get())
3082 {
3083 }
3084
3085 static std::unique_ptr<GDALAlgorithmHS> FromRef(GDALAlgorithm &alg)
3086 {
3087 auto ret = std::make_unique<GDALAlgorithmHS>();
3088 ret->ptr = &alg;
3089 return ret;
3090 }
3091};
3092
3093/************************************************************************/
3094/* GDALContainerAlgorithm */
3095/************************************************************************/
3096
3097 class CPL_DLL GDALContainerAlgorithm : public GDALAlgorithm
3098{
3099 public:
3100 explicit GDALContainerAlgorithm(
3101 const std::string &name, const std::string &description = std::string(),
3102 const std::string &helpURL = std::string())
3103 : GDALAlgorithm(name, description, helpURL)
3104 {
3105 }
3106
3107 protected:
3108 bool RunImpl(GDALProgressFunc, void *) override;
3109};
3110
3112
3113/************************************************************************/
3114/* GDALGlobalAlgorithmRegistry */
3115/************************************************************************/
3116
3119 class CPL_DLL GDALGlobalAlgorithmRegistry final : public GDALAlgorithmRegistry
3120{
3121 public:
3123 static constexpr const char *ROOT_ALG_NAME = "gdal";
3124
3126 static GDALGlobalAlgorithmRegistry &GetSingleton();
3127
3129 using InstantiateFunc = std::function<std::unique_ptr<GDALAlgorithm>()>;
3130
3137 void DeclareAlgorithm(const std::vector<std::string> &path,
3138 InstantiateFunc instantiateFunc);
3139
3142 std::vector<std::string>
3143 GetDeclaredSubAlgorithmNames(const std::vector<std::string> &path) const;
3144
3146 bool HasDeclaredSubAlgorithm(const std::vector<std::string> &path) const;
3147
3149 std::unique_ptr<GDALAlgorithm>
3150 InstantiateDeclaredSubAlgorithm(const std::vector<std::string> &path) const;
3151
3152 protected:
3153 std::unique_ptr<GDALAlgorithm>
3154 InstantiateTopLevel(const std::string &name) const override;
3155
3156 private:
3157 struct Node
3158 {
3159 InstantiateFunc instantiateFunc{};
3160 std::map<std::string, Node> children{};
3161 };
3162
3163 Node m_root{};
3164
3165 GDALGlobalAlgorithmRegistry();
3166 ~GDALGlobalAlgorithmRegistry() override;
3167
3168 const Node *GetNodeFromPath(const std::vector<std::string> &path) const;
3169};
3170
3171#endif // #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) && (defined(DOXYGEN_SKIP) || __cplusplus >= 201703L || _MSC_VER >= 1920)
3172
3173#endif // GDAL_ALGORITHM_CPP_INCLUDED
GDALAlgorithmArgDecl
Argument declaration.
Definition gdalalgorithm_cpp.h:299
GDALAlgorithmArgDecl::GetCategory
const std::string & GetCategory() const
Return the argument category: GAAC_COMMON, GAAC_BASE, GAAC_ADVANCED, GAAC_ESOTERIC or a custom catego...
Definition gdalalgorithm_cpp.h:785
GDALAlgorithmArgDecl::GetMaxValue
std::pair< double, bool > GetMaxValue() const
Return the maximum value and whether it is included.
Definition gdalalgorithm_cpp.h:819
GDALAlgorithmArgDecl::AddShortNameAlias
GDALAlgorithmArgDecl & AddShortNameAlias(char shortNameAlias)
Declare a shortname alias.
Definition gdalalgorithm_cpp.h:325
GDALAlgorithmArgDecl::GetPackedValuesAllowed
bool GetPackedValuesAllowed() const
Return whether, for list type of arguments, several values, space separated, may be specified.
Definition gdalalgorithm_cpp.h:868
GDALAlgorithmArgDecl::SetReadFromFileAtSyntaxAllowed
GDALAlgorithmArgDecl & SetReadFromFileAtSyntaxAllowed()
Set that this (string) argument accepts the @filename syntax to mean that the content of the specifie...
Definition gdalalgorithm_cpp.h:711
GDALAlgorithmArgDecl::GetDatasetOutputFlags
int GetDatasetOutputFlags() const
Indicates which components among name and dataset are modified, when this argument serves as an outpu...
Definition gdalalgorithm_cpp.h:1069
GDALAlgorithmArgDecl::GetMaxCount
int GetMaxCount() const
Return the maximum number of values for the argument.
Definition gdalalgorithm_cpp.h:851
GDALAlgorithmArgDecl::IsOutput
bool IsOutput() const
Return whether (at least part of) the value of the argument is set during the execution of the algori...
Definition gdalalgorithm_cpp.h:944
GDALAlgorithmArgDecl::SetMinCount
GDALAlgorithmArgDecl & SetMinCount(int count)
Declare the minimum number of values for the argument.
Definition gdalalgorithm.cpp:192
GDALAlgorithmArgDecl::SetPackedValuesAllowed
GDALAlgorithmArgDecl & SetPackedValuesAllowed(bool allowed)
Declares whether, for list type of arguments, several values, comma separated, may be specified.
Definition gdalalgorithm_cpp.h:520
GDALAlgorithmArgDecl::IsOnlyForCLI
bool IsOnlyForCLI() const
Return whether the argument is only for CLI usage.
Definition gdalalgorithm_cpp.h:914
GDALAlgorithmArgDecl::SetMaxCount
GDALAlgorithmArgDecl & SetMaxCount(int count)
Declare the maximum number of values for the argument.
Definition gdalalgorithm.cpp:211
GDALAlgorithmArgDecl::HasDefaultValue
bool HasDefaultValue() const
Return if the argument has a declared default value.
Definition gdalalgorithm_cpp.h:889
GDALAlgorithmArgDecl::GetShortName
const std::string & GetShortName() const
Return the short name, or empty string if there is none.
Definition gdalalgorithm_cpp.h:750
GDALAlgorithmArgDecl::SetDatasetOutputFlags
void SetDatasetOutputFlags(int flags)
Set which components among name and dataset are modified when this argument serves as an output.
Definition gdalalgorithm_cpp.h:1087
GDALAlgorithmArgDecl::SetHiddenChoices
GDALAlgorithmArgDecl & SetHiddenChoices(T &&first, U &&...rest)
Declares the, hidden, allowed values (as strings) for the argument.
Definition gdalalgorithm_cpp.h:628
GDALAlgorithmArgDecl::SetDefault
GDALAlgorithmArgDecl & SetDefault(const char *value)
Declare a default value for the argument.
Definition gdalalgorithm_cpp.h:488
GDALAlgorithmArgDecl::GetType
GDALAlgorithmArgType GetType() const
Return the type.
Definition gdalalgorithm_cpp.h:791
GDALAlgorithmArgDecl::GetHiddenChoices
const std::vector< std::string > & GetHiddenChoices() const
Return the allowed hidden values (as strings) for the argument.
Definition gdalalgorithm_cpp.h:807
GDALAlgorithmArgDecl::IsHidden
bool IsHidden() const
Return whether the argument is hidden.
Definition gdalalgorithm_cpp.h:896
GDALAlgorithmArgDecl::IsInput
bool IsInput() const
Indicate whether the value of the argument is read-only during the execution of the algorithm.
Definition gdalalgorithm_cpp.h:930
GDALAlgorithmArgDecl::SetMaxValueIncluded
GDALAlgorithmArgDecl & SetMaxValueIncluded(double max)
Set the maximum (included) value allowed.
Definition gdalalgorithm_cpp.h:592
GDALAlgorithmArgDecl::IsHiddenForAPI
bool IsHiddenForAPI() const
Return whether the argument is hidden for API usage For example "--help".
Definition gdalalgorithm_cpp.h:922
GDALAlgorithmArgDecl::SetHiddenForAPI
GDALAlgorithmArgDecl & SetHiddenForAPI(bool hiddenForAPI=true)
Declare that the argument is hidden in the context of an API use.
Definition gdalalgorithm_cpp.h:648
GDALAlgorithmArgDecl::GetMetaVar
const std::string & GetMetaVar() const
Return the "meta-var" hint.
Definition gdalalgorithm_cpp.h:777
GDALAlgorithmArgDecl::GetDisplayHintAboutRepetition
bool GetDisplayHintAboutRepetition() const
Returns whether in --help message one should display hints about the minimum/maximum number of values...
Definition gdalalgorithm_cpp.h:859
GDALAlgorithmArgDecl::GetAliases
const std::vector< std::string > & GetAliases() const
Return the aliases (potentially none)
Definition gdalalgorithm_cpp.h:756
GDALAlgorithmArgDecl::IsPositional
bool IsPositional() const
Return if the argument is a positional one.
Definition gdalalgorithm_cpp.h:883
GDALAlgorithmArgDecl::SetMaxValueExcluded
GDALAlgorithmArgDecl & SetMaxValueExcluded(double max)
Set the maximum (excluded) value allowed.
Definition gdalalgorithm_cpp.h:600
GDALAlgorithmArgDecl::SetDatasetType
void SetDatasetType(GDALArgDatasetType type)
Set which type of dataset is allowed / generated.
Definition gdalalgorithm_cpp.h:1038
GDALAlgorithmArgDecl::IsRequired
bool IsRequired() const
Return whether the argument is required.
Definition gdalalgorithm_cpp.h:834
GDALAlgorithmArgDecl::IsRemoveSQLCommentsEnabled
bool IsRemoveSQLCommentsEnabled() const
Returns whether SQL comments must be removed from a (string) argument.
Definition gdalalgorithm_cpp.h:969
GDALAlgorithmArgDecl::SetMutualExclusionGroup
GDALAlgorithmArgDecl & SetMutualExclusionGroup(const std::string &group)
Set the name of the mutual exclusion group to which this argument belongs to.
Definition gdalalgorithm_cpp.h:691
GDALAlgorithmArgDecl::GetMinCount
int GetMinCount() const
Return the minimum number of values for the argument.
Definition gdalalgorithm_cpp.h:842
GDALAlgorithmArgDecl::SetCategory
GDALAlgorithmArgDecl & SetCategory(const std::string &category)
Declare the argument category: GAAC_COMMON, GAAC_BASE, GAAC_ADVANCED, GAAC_ESOTERIC or a custom categ...
Definition gdalalgorithm_cpp.h:368
GDALAlgorithmArgDecl::SetChoices
GDALAlgorithmArgDecl & SetChoices(T &&first, U &&...rest)
Declares the allowed values (as strings) for the argument.
Definition gdalalgorithm_cpp.h:551
GDALAlgorithmArgDecl::GetMetadataItem
const std::vector< std::string > * GetMetadataItem(const std::string &name) const
Get user-defined metadata by item name.
Definition gdalalgorithm_cpp.h:998
GDALAlgorithmArgDecl::GetRepeatedArgAllowed
bool GetRepeatedArgAllowed() const
Return whether, for list type of arguments, the argument may be repeated.
Definition gdalalgorithm_cpp.h:877
GDALAlgorithmArgDecl::SetIsInput
GDALAlgorithmArgDecl & SetIsInput(bool isInput=true)
Indicate whether the value of the argument is read-only during the execution of the algorithm.
Definition gdalalgorithm_cpp.h:667
GDALAlgorithmArgDecl::SetDatasetInputFlags
void SetDatasetInputFlags(int flags)
Set which components among name and dataset are accepted as input, when this argument serves as an in...
Definition gdalalgorithm_cpp.h:1078
GDALAlgorithmArgDecl::SetRepeatedArgAllowed
GDALAlgorithmArgDecl & SetRepeatedArgAllowed(bool allowed)
Declares whether, for list type of arguments, the argument may be repeated.
Definition gdalalgorithm_cpp.h:530
GDALAlgorithmArgDecl::GetMinCharCount
int GetMinCharCount() const
Return the minimum number of characters (for arguments of type GAAT_STRING and GAAT_STRING_LIST)
Definition gdalalgorithm_cpp.h:827
GDALAlgorithmArgDecl::GetShortNameAliases
const std::vector< char > & GetShortNameAliases() const
Return the shortname aliases (potentially none)
Definition gdalalgorithm_cpp.h:762
GDALAlgorithmArgDecl::GetMutualExclusionGroup
const std::string & GetMutualExclusionGroup() const
Return the name of the mutual exclusion group to which this argument belongs to, or empty string if i...
Definition gdalalgorithm_cpp.h:953
GDALAlgorithmArgDecl::SetMinCharCount
GDALAlgorithmArgDecl & SetMinCharCount(int count)
Sets the minimum number of characters (for arguments of type GAAT_STRING and GAAT_STRING_LIST)
Definition gdalalgorithm_cpp.h:610
GDALAlgorithmArgDecl::IsReadFromFileAtSyntaxAllowed
bool IsReadFromFileAtSyntaxAllowed() const
Return if this (string) argument accepts the @filename syntax to mean that the content of the specifi...
Definition gdalalgorithm_cpp.h:962
GDALAlgorithmArgDecl::AddAlias
GDALAlgorithmArgDecl & AddAlias(const std::string &alias)
Declare an alias.
Definition gdalalgorithm_cpp.h:318
GDALAlgorithmArgDecl::IsHiddenForCLI
bool IsHiddenForCLI() const
Return whether the argument must not be mentioned in CLI usage.
Definition gdalalgorithm_cpp.h:905
GDALAlgorithmArgDecl::SetPositional
GDALAlgorithmArgDecl & SetPositional()
Declare that the argument is positional.
Definition gdalalgorithm_cpp.h:341
GDALAlgorithmArgDecl::GetDatasetType
GDALArgDatasetType GetDatasetType() const
Get which type of dataset is allowed / generated.
Definition gdalalgorithm_cpp.h:1028
GDALAlgorithmArgDecl::SetRequired
GDALAlgorithmArgDecl & SetRequired()
Declare that the argument is required.
Definition gdalalgorithm_cpp.h:349
GDALAlgorithmArgDecl::SetUserProvided
GDALAlgorithmArgDecl & SetUserProvided()
Declares that this argument has been created on-the-fly from user-provided argument.
Definition gdalalgorithm_cpp.h:737
GDALAlgorithmArgDecl::GetChoices
const std::vector< std::string > & GetChoices() const
Return the allowed values (as strings) for the argument.
Definition gdalalgorithm_cpp.h:799
GDALAlgorithmArgDecl::AutoOpenDataset
bool AutoOpenDataset() const
Returns whether the dataset should be opened automatically by GDALAlgorithm.
Definition gdalalgorithm_cpp.h:977
GDALAlgorithmArgDecl::SetMetaVar
GDALAlgorithmArgDecl & SetMetaVar(const std::string &metaVar)
Declare the "meta-var" hint.
Definition gdalalgorithm_cpp.h:359
GDALAlgorithmArgDecl::IsUserProvided
bool IsUserProvided() const
Returns whether the argument has been user-provided.
Definition gdalalgorithm_cpp.h:984
GDALAlgorithmArgDecl::GetMinValue
std::pair< double, bool > GetMinValue() const
Return the minimum value and whether it is included.
Definition gdalalgorithm_cpp.h:813
GDALAlgorithmArgDecl::AddMetadataItem
GDALAlgorithmArgDecl & AddMetadataItem(const std::string &name, const std::vector< std::string > &values)
Set user-defined metadata item.
Definition gdalalgorithm_cpp.h:700
GDALAlgorithmArgDecl::GetDatasetInputFlags
int GetDatasetInputFlags() const
Indicates which components among name and dataset are accepted as input, when this argument serves as...
Definition gdalalgorithm_cpp.h:1054
GDALAlgorithmArgDecl::GetDefault
const T & GetDefault() const
Return the default value of the argument.
Definition gdalalgorithm_cpp.h:1018
GDALAlgorithmArgDecl::GetDescription
const std::string & GetDescription() const
Return the description.
Definition gdalalgorithm_cpp.h:768
GDALAlgorithmArgDecl::AddHiddenAlias
GDALAlgorithmArgDecl & AddHiddenAlias(const std::string &alias)
Declare an hidden alias (i.e.
Definition gdalalgorithm_cpp.h:333
GDALAlgorithmArgDecl::SetMinValueIncluded
GDALAlgorithmArgDecl & SetMinValueIncluded(double min)
Set the minimum (included) value allowed.
Definition gdalalgorithm_cpp.h:572
GDALAlgorithmArgDecl::SetDefault
GDALAlgorithmArgDecl & SetDefault(const T &value)
Declare a default value for the argument.
Definition gdalalgorithm_cpp.h:376
GDALAlgorithmArgDecl::SetChoices
GDALAlgorithmArgDecl & SetChoices(const std::vector< std::string > &choices)
Declares the allowed values (as strings) for the argument.
Definition gdalalgorithm_cpp.h:561
GDALAlgorithmArgDecl::SetHiddenForCLI
GDALAlgorithmArgDecl & SetHiddenForCLI(bool hiddenForCLI=true)
Declare that the argument must not be mentioned in CLI usage.
Definition gdalalgorithm_cpp.h:639
GDALAlgorithmArgDecl::SetIsOutput
GDALAlgorithmArgDecl & SetIsOutput(bool isOutput=true)
Indicate whether (at least part of) the value of the argument is set during the execution of the algo...
Definition gdalalgorithm_cpp.h:682
GDALAlgorithmArgDecl::SetAutoOpenDataset
GDALAlgorithmArgDecl & SetAutoOpenDataset(bool autoOpen)
Sets whether the dataset should be opened automatically by GDALAlgorithm.
Definition gdalalgorithm_cpp.h:728
GDALAlgorithmArgDecl::SetDisplayHintAboutRepetition
GDALAlgorithmArgDecl & SetDisplayHintAboutRepetition(bool displayHint)
Declare whether in --help message one should display hints about the minimum/maximum number of values...
Definition gdalalgorithm_cpp.h:510
GDALAlgorithmArgDecl::SetHidden
GDALAlgorithmArgDecl & SetHidden()
Declare that the argument is hidden.
Definition gdalalgorithm_cpp.h:657
GDALAlgorithmArgDecl::GetName
const std::string & GetName() const
Return the (long) name.
Definition gdalalgorithm_cpp.h:744
GDALAlgorithmArgDecl::GetMetadata
const std::map< std::string, std::vector< std::string > > GetMetadata() const
Get user-defined metadata.
Definition gdalalgorithm_cpp.h:991
GDALAlgorithmArgDecl::SetMinValueExcluded
GDALAlgorithmArgDecl & SetMinValueExcluded(double min)
Set the minimum (excluded) value allowed.
Definition gdalalgorithm_cpp.h:584
GDALAlgorithmArgDecl::SetRemoveSQLCommentsEnabled
GDALAlgorithmArgDecl & SetRemoveSQLCommentsEnabled()
Sets that SQL comments must be removed from a (string) argument.
Definition gdalalgorithm_cpp.h:719
GDALAlgorithmArg
Argument of an algorithm.
Definition gdalalgorithm_cpp.h:1153
GDALAlgorithmArg::IsRemoveSQLCommentsEnabled
bool IsRemoveSQLCommentsEnabled() const
Alias for GDALAlgorithmArgDecl::IsRemoveSQLCommentsEnabled()
Definition gdalalgorithm_cpp.h:1378
GDALAlgorithmArg::Get
T & Get()
Return the value of the argument, which is by decreasing order of priority:
Definition gdalalgorithm_cpp.h:1455
GDALAlgorithmArg::GetAliases
const std::vector< std::string > & GetAliases() const
Alias for GDALAlgorithmArgDecl::GetAliases()
Definition gdalalgorithm_cpp.h:1204
GDALAlgorithmArg::IsExplicitlySet
bool IsExplicitlySet() const
Return whether the argument value has been explicitly set with Set()
Definition gdalalgorithm_cpp.h:1323
GDALAlgorithmArg::GetMinCount
int GetMinCount() const
Alias for GDALAlgorithmArgDecl::GetMinCount()
Definition gdalalgorithm_cpp.h:1246
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(const std::string &value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1613
GDALAlgorithmArg::GetCategory
const std::string & GetCategory() const
Alias for GDALAlgorithmArgDecl::GetCategory()
Definition gdalalgorithm_cpp.h:1234
GDALAlgorithmArg::IsInput
bool IsInput() const
Alias for GDALAlgorithmArgDecl::IsInput()
Definition gdalalgorithm_cpp.h:1360
GDALAlgorithmArg::GetMinCharCount
int GetMinCharCount() const
Alias for GDALAlgorithmArgDecl::GetMinCharCount()
Definition gdalalgorithm_cpp.h:1317
GDALAlgorithmArg::Get
const T & Get() const
Return the value of the argument, which is by decreasing order of priority:
Definition gdalalgorithm_cpp.h:1476
GDALAlgorithmArg::IsRequired
bool IsRequired() const
Alias for GDALAlgorithmArgDecl::IsRequired()
Definition gdalalgorithm_cpp.h:1240
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(int value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1599
GDALAlgorithmArg::GetName
const std::string & GetName() const
Alias for GDALAlgorithmArgDecl::GetName()
Definition gdalalgorithm_cpp.h:1192
GDALAlgorithmArg::GetDatasetInputFlags
int GetDatasetInputFlags() const
Alias for GDALAlgorithmArgDecl::GetDatasetInputFlags()
Definition gdalalgorithm_cpp.h:1428
GDALAlgorithmArg::GetMaxCount
int GetMaxCount() const
Alias for GDALAlgorithmArgDecl::GetMaxCount()
Definition gdalalgorithm_cpp.h:1252
GDALAlgorithmArg::IsReadFromFileAtSyntaxAllowed
bool IsReadFromFileAtSyntaxAllowed() const
Alias for GDALAlgorithmArgDecl::IsReadFromFileAtSyntaxAllowed()
Definition gdalalgorithm_cpp.h:1372
GDALAlgorithmArg::GetMetaVar
const std::string & GetMetaVar() const
Alias for GDALAlgorithmArgDecl::GetMetaVar()
Definition gdalalgorithm_cpp.h:1222
GDALAlgorithmArg::GetDatasetOutputFlags
int GetDatasetOutputFlags() const
Alias for GDALAlgorithmArgDecl::GetDatasetOutputFlags()
Definition gdalalgorithm_cpp.h:1434
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(const std::vector< int > &value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1641
GDALAlgorithmArg::GetMetadata
const std::map< std::string, std::vector< std::string > > GetMetadata() const
Alias for GDALAlgorithmArgDecl::GetMetadata()
Definition gdalalgorithm_cpp.h:1391
GDALAlgorithmArg::GetHiddenChoices
const std::vector< std::string > & GetHiddenChoices() const
Alias for GDALAlgorithmArgDecl::GetHiddenChoices()
Definition gdalalgorithm_cpp.h:1288
GDALAlgorithmArg::GetShortName
const std::string & GetShortName() const
Alias for GDALAlgorithmArgDecl::GetShortName()
Definition gdalalgorithm_cpp.h:1198
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(const OGRSpatialReference &value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1634
GDALAlgorithmArg::GetDescription
const std::string & GetDescription() const
Alias for GDALAlgorithmArgDecl::GetDescription()
Definition gdalalgorithm_cpp.h:1216
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(const char *value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1620
GDALAlgorithmArg::GetMetadataItem
const std::vector< std::string > * GetMetadataItem(const std::string &name) const
Alias for GDALAlgorithmArgDecl::GetMetadataItem()
Definition gdalalgorithm_cpp.h:1398
GDALAlgorithmArg::GetShortNameAliases
const std::vector< char > & GetShortNameAliases() const
Alias for GDALAlgorithmArgDecl::GetShortNameAliases()
Definition gdalalgorithm_cpp.h:1210
GDALAlgorithmArg::GetMaxValue
std::pair< double, bool > GetMaxValue() const
Alias for GDALAlgorithmArgDecl::GetMaxValue()
Definition gdalalgorithm_cpp.h:1311
GDALAlgorithmArg::Set
bool Set(GDALDataType dt)
Set the value for a GAAT_STRING argument from a GDALDataType It cannot be called several times for a ...
Definition gdalalgorithm_cpp.h:1510
GDALAlgorithmArg::GetChoices
const std::vector< std::string > & GetChoices() const
Alias for GDALAlgorithmArgDecl::GetChoices()
Definition gdalalgorithm_cpp.h:1282
GDALAlgorithmArg::SetSkipIfAlreadySet
void SetSkipIfAlreadySet(bool skip=true)
Advanced method used to make "gdal info" and "gdal raster|vector info" to avoid re-opening an already...
Definition gdalalgorithm_cpp.h:1681
GDALAlgorithmArg::GetPackedValuesAllowed
bool GetPackedValuesAllowed() const
Alias for GDALAlgorithmArgDecl::GetPackedValuesAllowed()
Definition gdalalgorithm_cpp.h:1264
GDALAlgorithmArg::IsOnlyForCLI
bool IsOnlyForCLI() const
Alias for GDALAlgorithmArgDecl::IsOnlyForCLI()
Definition gdalalgorithm_cpp.h:1347
GDALAlgorithmArg::IsOutput
bool IsOutput() const
Alias for GDALAlgorithmArgDecl::IsOutput()
Definition gdalalgorithm_cpp.h:1366
GDALAlgorithmArg::~GDALAlgorithmArg
virtual ~GDALAlgorithmArg()
Destructor.
GDALAlgorithmArg::HasDefaultValue
bool HasDefaultValue() const
Alias for GDALAlgorithmArgDecl::HasDefaultValue()
Definition gdalalgorithm_cpp.h:1329
GDALAlgorithmArg::GetAutoCompleteChoices
std::vector< std::string > GetAutoCompleteChoices(const std::string &currentValue) const
Return auto completion choices, if a auto completion function has been registered.
Definition gdalalgorithm_cpp.h:1297
GDALAlgorithmArg::IsHidden
bool IsHidden() const
Alias for GDALAlgorithmArgDecl::IsHidden()
Definition gdalalgorithm_cpp.h:1335
GDALAlgorithmArg::Set
bool Set(const char *value)
Set the value for a GAAT_STRING argument.
Definition gdalalgorithm_cpp.h:1500
GDALAlgorithmArg::GetDisplayHintAboutRepetition
bool GetDisplayHintAboutRepetition() const
Alias for GDALAlgorithmArgDecl::GetDisplayHintAboutRepetition()
Definition gdalalgorithm_cpp.h:1258
GDALAlgorithmArg::m_decl
GDALAlgorithmArgDecl m_decl
Argument declaration.
Definition gdalalgorithm_cpp.h:1713
GDALAlgorithmArg::GDALAlgorithmArg
GDALAlgorithmArg(const GDALAlgorithmArgDecl &decl, T *pValue)
Constructor.
Definition gdalalgorithm_cpp.h:1157
GDALAlgorithmArg::IsPositional
bool IsPositional() const
Alias for GDALAlgorithmArgDecl::IsPositional()
Definition gdalalgorithm_cpp.h:1276
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(const std::vector< double > &value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1648
GDALAlgorithmArg::AutoOpenDataset
bool AutoOpenDataset() const
Alias for GDALAlgorithmArgDecl::AutoOpenDataset()
Definition gdalalgorithm_cpp.h:1410
GDALAlgorithmArg::SkipIfAlreadySet
bool SkipIfAlreadySet() const
Advanced method used to make "gdal info" and "gdal raster|vector info" to avoid re-opening an already...
Definition gdalalgorithm_cpp.h:1688
GDALAlgorithmArg::GetDeclaration
const GDALAlgorithmArgDecl & GetDeclaration() const
Return the argument declaration.
Definition gdalalgorithm_cpp.h:1186
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(const std::vector< std::string > &value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1655
GDALAlgorithmArg::GetRepeatedArgAllowed
bool GetRepeatedArgAllowed() const
Alias for GDALAlgorithmArgDecl::GetRepeatedArgAllowed()
Definition gdalalgorithm_cpp.h:1270
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(double value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1606
GDALAlgorithmArg::GetMinValue
std::pair< double, bool > GetMinValue() const
Alias for GDALAlgorithmArgDecl::GetMinValue()
Definition gdalalgorithm_cpp.h:1305
GDALAlgorithmArg::GetType
GDALAlgorithmArgType GetType() const
Alias for GDALAlgorithmArgDecl::GetType()
Definition gdalalgorithm_cpp.h:1228
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(GDALDataset *value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1662
GDALAlgorithmArg::GetMutualExclusionGroup
const std::string & GetMutualExclusionGroup() const
Alias for GDALAlgorithmArgDecl::GetMutualExclusionGroup()
Definition gdalalgorithm_cpp.h:1384
GDALAlgorithmArg::IsHiddenForAPI
bool IsHiddenForAPI() const
Alias for GDALAlgorithmArgDecl::IsHiddenForAPI()
Definition gdalalgorithm_cpp.h:1354
GDALAlgorithmArg::IsUserProvided
bool IsUserProvided() const
Alias for GDALAlgorithmArgDecl::IsUserProvided()
Definition gdalalgorithm_cpp.h:1416
GDALAlgorithmArg::GetDatasetType
GDALArgDatasetType GetDatasetType() const
Alias for GDALAlgorithmArgDecl::GetDatasetType()
Definition gdalalgorithm_cpp.h:1422
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(bool value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1592
GDALAlgorithmArg::IsHiddenForCLI
bool IsHiddenForCLI() const
Alias for GDALAlgorithmArgDecl::IsHiddenForCLI()
Definition gdalalgorithm_cpp.h:1341
GDALAlgorithmArg::operator=
GDALAlgorithmArg & operator=(GDALDataType value)
Set the value of the argument.
Definition gdalalgorithm_cpp.h:1627
GDALAlgorithmArg::GetDefault
const T & GetDefault() const
Alias for GDALAlgorithmArgDecl::GetDefault()
Definition gdalalgorithm_cpp.h:1404
GDALAlgorithmRegistry::AlgInfo
Algorithm information.
Definition gdalalgorithm_cpp.h:2142
GDALAlgorithmRegistry::AlgInfo::m_creationFunc
std::function m_creationFunc
Creation function.
Definition gdalalgorithm_cpp.h:2150
GDALAlgorithmRegistry::AlgInfo::m_name
std::string m_name
Algorithm (short) name.
Definition gdalalgorithm_cpp.h:2145
GDALAlgorithmRegistry::AlgInfo::m_aliases
std::vector< std::string > m_aliases
Aliases.
Definition gdalalgorithm_cpp.h:2147
GDALAlgorithmRegistry
Registry of GDAL algorithms.
Definition gdalalgorithm_cpp.h:2132
GDALAlgorithmRegistry::empty
bool empty() const
Returns true if there are no algorithms registered.
Definition gdalalgorithm_cpp.h:2212
GDALAlgorithmRegistry::Instantiate
std::unique_ptr< GDALAlgorithm > Instantiate(const std::string &first, V &&...rest)
Instantiate an algorithm by its path.
Definition gdalalgorithm_cpp.h:2197
GDALAlgorithmRegistry::GetInfo
const AlgInfo * GetInfo(const std::string &name) const
Get an algorithm by its name.
Definition gdalalgorithm_cpp.h:2205
GDALAlgorithmRegistry::Register
bool Register()
Register the algorithm of type MyAlgorithm.
Definition gdalalgorithm_cpp.h:2159
GDALAlgorithm
GDAL algorithm.
Definition gdalalgorithm_cpp.h:2261
GDALAlgorithm::WarnIfDeprecated
virtual void WarnIfDeprecated()
Method that an algorithm can implement to issue a warning message about its deprecation.
Definition gdalalgorithm_cpp.h:2978
GDALAlgorithm::SupportsStreamedOutput
bool SupportsStreamedOutput() const
Returns whether this algorithm supports a streamed output dataset.
Definition gdalalgorithm_cpp.h:2411
GDALAlgorithm::AddValidationAction
void AddValidationAction(std::function< bool()> f)
Register an action that is executed by the ValidateArguments() method.
Definition gdalalgorithm_cpp.h:2905
GDALAlgorithm::GetHelpFullURL
const std::string & GetHelpFullURL() const
Get the algorithm full URL, resolving relative URLs.
Definition gdalalgorithm_cpp.h:2294
GDALAlgorithm::SetCallPath
void SetCallPath(const std::vector< std::string > &path)
Set the calling path to this algorithm.
Definition gdalalgorithm_cpp.h:2381
GDALAlgorithm::IsJSONUsageRequested
bool IsJSONUsageRequested() const
Whether the --json-usage flag has been specified.
Definition gdalalgorithm_cpp.h:2504
GDALAlgorithm::SetReferencePathForRelativePaths
void SetReferencePathForRelativePaths(const std::string &referencePath)
Set the reference file paths used to interpret relative paths.
Definition gdalalgorithm_cpp.h:2399
GDALAlgorithm::m_progressBarRequested
bool m_progressBarRequested
Whether a progress bar is requested (value of --progress argument)
Definition gdalalgorithm_cpp.h:2602
GDALAlgorithm::IsHidden
bool IsHidden() const
Returns whether this algorithm is hidden.
Definition gdalalgorithm_cpp.h:2300
GDALAlgorithm::GetLongDescription
const std::string & GetLongDescription() const
Get the long algorithm description.
Definition gdalalgorithm_cpp.h:2280
GDALAlgorithm::GetArgs
std::vector< std::unique_ptr< GDALAlgorithmArg > > & GetArgs()
Return the potential arguments of the algorithm.
Definition gdalalgorithm_cpp.h:2327
GDALAlgorithm::SetCalledFromCommandLine
void SetCalledFromCommandLine()
Set whether the algorithm is called from the command line.
Definition gdalalgorithm_cpp.h:2560
GDALAlgorithm::RegisterSubAlgorithm
bool RegisterSubAlgorithm()
Register the sub-algorithm of type MyAlgorithm.
Definition gdalalgorithm_cpp.h:2635
GDALAlgorithm::GetDescription
const std::string & GetDescription() const
Get the algorithm description (a few sentences at most)
Definition gdalalgorithm_cpp.h:2274
GDALAlgorithm::ProcessGDALGOutputRet
ProcessGDALGOutputRet
Return value for ProcessGDALGOutput.
Definition gdalalgorithm_cpp.h:2926
GDALAlgorithm::IsCalledFromCommandLine
bool IsCalledFromCommandLine() const
Return whether the algorithm is called from the command line.
Definition gdalalgorithm_cpp.h:2566
GDALAlgorithm::GetActualAlgorithm
GDALAlgorithm & GetActualAlgorithm()
Return the actual algorithm that is going to be invoked, when the current algorithm has sub-algorithm...
Definition gdalalgorithm_cpp.h:2490
GDALAlgorithm::GetArg
const GDALAlgorithmArg * GetArg(const std::string &osName, bool suggestionAllowed=false) const
Return an argument from its long name, short name or an alias.
Definition gdalalgorithm_cpp.h:2356
GDALAlgorithm::AllowArbitraryLongNameArgs
void AllowArbitraryLongNameArgs()
Allow arbitrary user arguments using long name syntax (–something)
Definition gdalalgorithm_cpp.h:2648
GDALAlgorithm::operator[]
GDALAlgorithmArg & operator[](const std::string &osName)
Return an argument from its long name, short name or an alias.
Definition gdalalgorithm_cpp.h:2343
GDALAlgorithm::GetArg
GDALAlgorithmArg * GetArg(const std::string &osName, bool suggestionAllowed=false)
Return an argument from its long name, short name or an alias.
Definition gdalalgorithm_cpp.h:2336
GDALAlgorithm::m_quiet
bool m_quiet
Whether a progress bar is disabled (value of --quiet argument)
Definition gdalalgorithm_cpp.h:2605
GDALAlgorithm::GetHelpURL
const std::string & GetHelpURL() const
Get the algorithm help URL.
Definition gdalalgorithm_cpp.h:2288
GDALAlgorithm::GetArgs
const std::vector< std::unique_ptr< GDALAlgorithmArg > > & GetArgs() const
Return the potential arguments of the algorithm.
Definition gdalalgorithm_cpp.h:2321
GDALAlgorithm::GetName
const std::string & GetName() const
Get the algorithm name.
Definition gdalalgorithm_cpp.h:2268
GDALAlgorithm::RegisterSubAlgorithm
bool RegisterSubAlgorithm(const GDALAlgorithmRegistry::AlgInfo &info)
Register a sub-algoritm by its AlgInfo structure.
Definition gdalalgorithm_cpp.h:2642
GDALAlgorithm::SetParseForAutoCompletion
void SetParseForAutoCompletion()
Set hint before calling ParseCommandLineArguments() that it must try to be be graceful when possible,...
Definition gdalalgorithm_cpp.h:2390
GDALAlgorithm::SetExecutionForStreamedOutput
void SetExecutionForStreamedOutput()
Indicates that the algorithm must be run to generate a streamed output dataset.
Definition gdalalgorithm_cpp.h:2423
GDALAlgorithm::operator[]
const GDALAlgorithmArg & operator[](const std::string &osName) const
Return an argument from its long name, short name or an alias.
Definition gdalalgorithm_cpp.h:2364
GDALAlgorithm::IsProgressBarRequested
bool IsProgressBarRequested() const
Whether the --progress flag has been specified.
Definition gdalalgorithm_cpp.h:2510
GDALAlgorithm::GetReferencePathForRelativePaths
const std::string & GetReferencePathForRelativePaths() const
Return the reference file paths used to interpret relative paths.
Definition gdalalgorithm_cpp.h:2405
GDALAlgorithm::GetAliases
const std::vector< std::string > & GetAliases() const
Return alias names (generally short) for the current algorithm.
Definition gdalalgorithm_cpp.h:2518
GDALAlgorithm::SetDisplayInJSONUsage
void SetDisplayInJSONUsage(bool b)
Set whether this algorithm should be reported in JSON usage.
Definition gdalalgorithm_cpp.h:2970
GDALAlgorithm::PropagateSpecialActionTo
bool PropagateSpecialActionTo(GDALAlgorithm *target)
Used by the "gdal info" special algorithm when it first tries to run "gdal raster info",...
Definition gdalalgorithm_cpp.h:2538
GDALAlgorithm::IsHelpRequested
bool IsHelpRequested() const
Whether the --help flag has been specified.
Definition gdalalgorithm_cpp.h:2498
GDALArgDatasetValue
Value for an argument that points to a GDALDataset.
Definition gdalalgorithm_cpp.h:149
GDALArgDatasetValue::GDALArgDatasetValue
GDALArgDatasetValue()=default
Default (empty) constructor.
GDALArgDatasetValue::GetName
const std::string & GetName() const
Get dataset name.
Definition gdalalgorithm_cpp.h:222
GDALArgDatasetValue::BorrowDataset
GDALDataset * BorrowDataset()
Borrow the GDALDataset* instance (may be null), leaving its reference counter unchanged.
Definition gdalalgorithm_cpp.h:204
GDALArgDatasetValue::GDALArgDatasetValue
GDALArgDatasetValue(const std::string &name)
Constructor by dataset name.
Definition gdalalgorithm_cpp.h:155
GDALArgDatasetValue::GetDatasetRef
const GDALDataset * GetDatasetRef() const
Get a GDALDataset* instance (may be null).
Definition gdalalgorithm_cpp.h:196
GDALArgDatasetValue::GetDatasetRef
GDALDataset * GetDatasetRef()
Get a GDALDataset* instance (may be null).
Definition gdalalgorithm_cpp.h:187
GDALArgDatasetValue::HasDatasetBeenOpenedByAlgorithm
bool HasDatasetBeenOpenedByAlgorithm() const
Whether the dataset has been opened by the algorithm.
Definition gdalalgorithm_cpp.h:255
GDALArgDatasetValue::SetOwnerArgument
void SetOwnerArgument(GDALAlgorithmArg *arg)
Set the argument that owns us.
Definition gdalalgorithm_cpp.h:264
GDALArgDatasetValue::SetDatasetOpenedByAlgorithm
void SetDatasetOpenedByAlgorithm()
Set that the dataset has been opened by the algorithm.
Definition gdalalgorithm_cpp.h:249
GDALArgDatasetValue::IsNameSet
bool IsNameSet() const
Return whether a dataset name has been set.
Definition gdalalgorithm_cpp.h:228
GDALArgDatasetValue::BorrowDatasetFrom
void BorrowDatasetFrom(GDALArgDatasetValue &other)
Borrow the GDALDataset* instance from another GDALArgDatasetValue, leaving its reference counter unch...
Definition gdalalgorithm_cpp.h:214
GDALDataset
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:76
GDALGlobalAlgorithmRegistry
Global registry of GDAL algorithms.
Definition gdalalgorithm_cpp.h:3120
GDALGlobalAlgorithmRegistry::InstantiateFunc
std::function< std::unique_ptr< GDALAlgorithm >()> InstantiateFunc
Instantiation function.
Definition gdalalgorithm_cpp.h:3129
GDALInConstructionAlgorithmArg
Technical class used by GDALAlgorithm when constructing argument declarations.
Definition gdalalgorithm_cpp.h:1771
GDALInConstructionAlgorithmArg::SetDatasetInputFlags
GDALInConstructionAlgorithmArg & SetDatasetInputFlags(int flags)
Alias for GDALAlgorithmArgDecl::SetDatasetInputFlags()
Definition gdalalgorithm_cpp.h:2062
GDALInConstructionAlgorithmArg::SetDefault
GDALInConstructionAlgorithmArg & SetDefault(const T &value)
Alias for GDALAlgorithmArgDecl::SetDefault()
Definition gdalalgorithm_cpp.h:1822
GDALInConstructionAlgorithmArg::AddAction
GDALInConstructionAlgorithmArg & AddAction(std::function< void()> f)
Register an action that is executed, once and exactly once, if the argument is explicitly set,...
Definition gdalalgorithm_cpp.h:2078
GDALInConstructionAlgorithmArg::SetHiddenChoices
GDALInConstructionAlgorithmArg & SetHiddenChoices(T &&first, U &&...rest)
Alias for GDALAlgorithmArgDecl::SetHiddenChoices()
Definition gdalalgorithm_cpp.h:1938
GDALInConstructionAlgorithmArg::SetMaxValueIncluded
GDALInConstructionAlgorithmArg & SetMaxValueIncluded(double max)
Alias for GDALAlgorithmArgDecl::SetMaxValueIncluded()
Definition gdalalgorithm_cpp.h:1960
GDALInConstructionAlgorithmArg::SetHidden
GDALInConstructionAlgorithmArg & SetHidden()
Alias for GDALAlgorithmArgDecl::SetHidden()
Definition gdalalgorithm_cpp.h:1981
GDALInConstructionAlgorithmArg::SetDatasetOutputFlags
GDALInConstructionAlgorithmArg & SetDatasetOutputFlags(int flags)
Alias for GDALAlgorithmArgDecl::SetDatasetOutputFlags()
Definition gdalalgorithm_cpp.h:2069
GDALInConstructionAlgorithmArg::SetReadFromFileAtSyntaxAllowed
GDALInConstructionAlgorithmArg & SetReadFromFileAtSyntaxAllowed()
Alias for GDALAlgorithmArgDecl::SetReadFromFileAtSyntaxAllowed()
Definition gdalalgorithm_cpp.h:2016
GDALInConstructionAlgorithmArg::~GDALInConstructionAlgorithmArg
~GDALInConstructionAlgorithmArg() override
Destructor.
GDALInConstructionAlgorithmArg::SetMinCount
GDALInConstructionAlgorithmArg & SetMinCount(int count)
Alias for GDALAlgorithmArgDecl::SetMinCount()
Definition gdalalgorithm_cpp.h:1882
GDALInConstructionAlgorithmArg::SetIsOutput
GDALInConstructionAlgorithmArg & SetIsOutput(bool isOutput=true)
Alias for GDALAlgorithmArgDecl::SetIsOutput()
Definition gdalalgorithm_cpp.h:2009
GDALInConstructionAlgorithmArg::SetRemoveSQLCommentsEnabled
GDALInConstructionAlgorithmArg & SetRemoveSQLCommentsEnabled()
Alias for GDALAlgorithmArgDecl::SetRemoveSQLCommentsEnabled()
Definition gdalalgorithm_cpp.h:2023
GDALInConstructionAlgorithmArg::SetDefault
GDALInConstructionAlgorithmArg & SetDefault(const char *value)
Alias for GDALAlgorithmArgDecl::SetDefault()
Definition gdalalgorithm_cpp.h:1876
GDALInConstructionAlgorithmArg::SetMaxCount
GDALInConstructionAlgorithmArg & SetMaxCount(int count)
Alias for GDALAlgorithmArgDecl::SetMaxCount()
Definition gdalalgorithm_cpp.h:1889
GDALInConstructionAlgorithmArg::SetMaxValueExcluded
GDALInConstructionAlgorithmArg & SetMaxValueExcluded(double max)
Alias for GDALAlgorithmArgDecl::SetMaxValueExcluded()
Definition gdalalgorithm_cpp.h:1967
GDALInConstructionAlgorithmArg::SetHiddenForAPI
GDALInConstructionAlgorithmArg & SetHiddenForAPI(bool hiddenForAPI=true)
Alias for GDALAlgorithmArgDecl::SetHiddenForAPI()
Definition gdalalgorithm_cpp.h:1995
GDALInConstructionAlgorithmArg::SetDisplayHintAboutRepetition
GDALInConstructionAlgorithmArg & SetDisplayHintAboutRepetition(bool displayHint)
Alias for GDALAlgorithmArgDecl::SetDisplayHintAboutRepetition()
Definition gdalalgorithm_cpp.h:1897
GDALInConstructionAlgorithmArg::SetAutoOpenDataset
GDALInConstructionAlgorithmArg & SetAutoOpenDataset(bool autoOpen)
Alias for GDALAlgorithmArgDecl::SetAutoOpenDataset()
Definition gdalalgorithm_cpp.h:2030
GDALInConstructionAlgorithmArg::SetDatasetType
GDALInConstructionAlgorithmArg & SetDatasetType(GDALArgDatasetType datasetType)
Alias for GDALAlgorithmArgDecl::SetDatasetType()
Definition gdalalgorithm_cpp.h:2055
GDALInConstructionAlgorithmArg::SetAutoCompleteFunction
GDALInConstructionAlgorithmArg & SetAutoCompleteFunction(std::function< std::vector< std::string >(const std::string &)> f)
Register a function that will return a list of valid choices for the value of the argument.
Definition gdalalgorithm_cpp.h:2099
GDALInConstructionAlgorithmArg::SetPackedValuesAllowed
GDALInConstructionAlgorithmArg & SetPackedValuesAllowed(bool allowed)
Alias for GDALAlgorithmArgDecl::SetPackedValuesAllowed()
Definition gdalalgorithm_cpp.h:1904
GDALInConstructionAlgorithmArg::SetUserProvided
GDALInConstructionAlgorithmArg & SetUserProvided()
Alias for GDALAlgorithmArgDecl::SetUserProvided()
Definition gdalalgorithm_cpp.h:2118
GDALInConstructionAlgorithmArg::SetChoices
GDALInConstructionAlgorithmArg & SetChoices(const std::vector< std::string > &choices)
Alias for GDALAlgorithmArgDecl::SetChoices()
Definition gdalalgorithm_cpp.h:1930
GDALInConstructionAlgorithmArg::SetMinCharCount
GDALInConstructionAlgorithmArg & SetMinCharCount(int count)
Alias for GDALAlgorithmArgDecl::SetMinCharCount()
Definition gdalalgorithm_cpp.h:1974
GDALInConstructionAlgorithmArg::SetHiddenForCLI
GDALInConstructionAlgorithmArg & SetHiddenForCLI(bool hiddenForCLI=true)
Alias for GDALAlgorithmArgDecl::SetHiddenForCLI()
Definition gdalalgorithm_cpp.h:1988
GDALInConstructionAlgorithmArg::AddMetadataItem
GDALInConstructionAlgorithmArg & AddMetadataItem(const std::string &name, const std::vector< std::string > &values)
Alias for GDALAlgorithmArgDecl::AddMetadataItem()
Definition gdalalgorithm_cpp.h:2046
GDALInConstructionAlgorithmArg::SetMutualExclusionGroup
GDALInConstructionAlgorithmArg & SetMutualExclusionGroup(const std::string &group)
Alias for GDALAlgorithmArgDecl::SetMutualExclusionGroup()
Definition gdalalgorithm_cpp.h:2038
GDALInConstructionAlgorithmArg::SetMinValueIncluded
GDALInConstructionAlgorithmArg & SetMinValueIncluded(double min)
Alias for GDALAlgorithmArgDecl::SetMinValueIncluded()
Definition gdalalgorithm_cpp.h:1946
GDALInConstructionAlgorithmArg::SetChoices
GDALInConstructionAlgorithmArg & SetChoices(T &&first, U &&...rest)
Alias for GDALAlgorithmArgDecl::SetChoices()
Definition gdalalgorithm_cpp.h:1922
GDALInConstructionAlgorithmArg::SetIsInput
GDALInConstructionAlgorithmArg & SetIsInput(bool isInput=true)
Alias for GDALAlgorithmArgDecl::SetIsInput()
Definition gdalalgorithm_cpp.h:2002
GDALInConstructionAlgorithmArg::SetRequired
GDALInConstructionAlgorithmArg & SetRequired()
Alias for GDALAlgorithmArgDecl::SetRequired()
Definition gdalalgorithm_cpp.h:1800
GDALInConstructionAlgorithmArg::SetMetaVar
GDALInConstructionAlgorithmArg & SetMetaVar(const std::string &metaVar)
Alias for GDALAlgorithmArgDecl::SetMetaVar()
Definition gdalalgorithm_cpp.h:1807
GDALInConstructionAlgorithmArg::GDALInConstructionAlgorithmArg
GDALInConstructionAlgorithmArg(GDALAlgorithm *owner, const GDALAlgorithmArgDecl &decl, T *pValue)
Constructor.
Definition gdalalgorithm_cpp.h:1777
GDALInConstructionAlgorithmArg::SetRepeatedArgAllowed
GDALInConstructionAlgorithmArg & SetRepeatedArgAllowed(bool allowed)
Alias for GDALAlgorithmArgDecl::SetRepeatedArgAllowed()
Definition gdalalgorithm_cpp.h:1911
GDALInConstructionAlgorithmArg::SetMinValueExcluded
GDALInConstructionAlgorithmArg & SetMinValueExcluded(double min)
Alias for GDALAlgorithmArgDecl::SetMinValueExcluded()
Definition gdalalgorithm_cpp.h:1953
GDALInConstructionAlgorithmArg::SetCategory
GDALInConstructionAlgorithmArg & SetCategory(const std::string &category)
Alias for GDALAlgorithmArgDecl::SetCategory()
Definition gdalalgorithm_cpp.h:1814
GDALInConstructionAlgorithmArg::AddValidationAction
GDALInConstructionAlgorithmArg & AddValidationAction(std::function< bool()> f)
Register an action that is executed, once and exactly once, if the argument is explicitly set,...
Definition gdalalgorithm_cpp.h:2090
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
cpl_error.h
CPL error handling services.
CPLAssert
#define CPLAssert(expr)
Assert on an expression.
Definition cpl_error.h:330
CPLErr
CPLErr
Error category.
Definition cpl_error.h:37
CPLE_AppDefined
#define CPLE_AppDefined
Application defined error.
Definition cpl_error.h:85
CPLErrorNum
int CPLErrorNum
Error number.
Definition cpl_error.h:80
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition cpl_port.h:844
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition cpl_port.h:936
GDALDataType
GDALDataType
Definition gdal.h:48
GDAL_OF_RASTER
#define GDAL_OF_RASTER
Allow raster drivers to be used.
Definition gdal.h:1086
GDAL_OF_VECTOR
#define GDAL_OF_VECTOR
Allow vector drivers to be used.
Definition gdal.h:1091
GDALGetDataTypeName
const char * GDALGetDataTypeName(GDALDataType)
Get name of data type.
Definition gdal_misc.cpp:715
GDAL_OF_MULTIDIM_RASTER
#define GDAL_OF_MULTIDIM_RASTER
Allow multidimensional raster drivers to be used.
Definition gdal.h:1102
OGRFieldSubType
OGRFieldSubType
List of field subtypes.
Definition ogr_core.h:799
OGRFieldType
OGRFieldType
List of feature field types.
Definition ogr_core.h:772
GDALAlgorithm::UsageOptions
Usage options.
Definition gdalalgorithm_cpp.h:2458
GDALAlgorithm::UsageOptions::isPipelineStep
bool isPipelineStep
Whether this is a pipeline step.
Definition gdalalgorithm_cpp.h:2460
GDALAlgorithm::UsageOptions::maxOptLen
size_t maxOptLen
Maximum width of the names of the options.
Definition gdalalgorithm_cpp.h:2462
GDALAlgorithm::UsageOptions::isPipelineMain
bool isPipelineMain
Whether this is a pipeline main.
Definition gdalalgorithm_cpp.h:2464