|
|
const std::string & | GetName () const |
| | Get the algorithm name.
|
|
const std::string & | GetDescription () const |
| | Get the algorithm description (a few sentences at most).
|
| const std::string & | GetLongDescription () const |
| | Get the long algorithm description.
|
| const std::string & | GetHelpURL () const |
| | Get the algorithm help URL.
|
|
const std::string & | GetHelpFullURL () const |
| | Get the algorithm full URL, resolving relative URLs.
|
|
bool | IsHidden () const |
| | Returns whether this algorithm is hidden.
|
|
bool | HasSubAlgorithms () const |
| | Returns whether this algorithm has sub-algorithms.
|
| std::vector< std::string > | GetSubAlgorithmNames () const |
| | Get the names of registered algorithms.
|
|
std::unique_ptr< GDALAlgorithm > | InstantiateSubAlgorithm (const std::string &name, bool suggestionAllowed=true) const |
| | Instantiate an algorithm by its name (or its alias).
|
|
const std::vector< std::unique_ptr< GDALAlgorithmArg > > & | GetArgs () const |
| | Return the potential arguments of the algorithm.
|
|
std::vector< std::unique_ptr< GDALAlgorithmArg > > & | GetArgs () |
| | Return the potential arguments of the algorithm.
|
|
std::string | GetSuggestionForArgumentName (const std::string &osName) const |
| | Return a likely matching argument using a Damerau-Levenshtein distance.
|
|
GDALAlgorithmArg * | GetArg (const std::string &osName, bool suggestionAllowed=false) |
| | Return an argument from its long name, short name or an alias.
|
|
GDALAlgorithmArg & | operator[] (const std::string &osName) |
| | Return an argument from its long name, short name or an alias.
|
|
const GDALAlgorithmArg * | GetArg (const std::string &osName, bool suggestionAllowed=false) const |
| | Return an argument from its long name, short name or an alias.
|
|
const GDALAlgorithmArg & | operator[] (const std::string &osName) const |
| | Return an argument from its long name, short name or an alias.
|
| void | SetCallPath (const std::vector< std::string > &path) |
| | Set the calling path to this algorithm.
|
| void | SetParseForAutoCompletion () |
| | Set hint before calling ParseCommandLineArguments() that it must try to be be graceful when possible, e.g.
|
| void | SetReferencePathForRelativePaths (const std::string &referencePath) |
| | Set the reference file paths used to interpret relative paths.
|
|
const std::string & | GetReferencePathForRelativePaths () const |
| | Return the reference file paths used to interpret relative paths.
|
|
bool | SupportsStreamedOutput () const |
| | Returns whether this algorithm supports a streamed output dataset.
|
| void | SetExecutionForStreamedOutput () |
| | Indicates that the algorithm must be run to generate a streamed output dataset.
|
|
virtual bool | ParseCommandLineArguments (const std::vector< std::string > &args) |
| | Parse a command line argument, which does not include the algorithm name, to set the value of corresponding arguments.
|
| virtual bool | ValidateArguments () |
| | Validate that all constraints are met.
|
|
bool | Run (GDALProgressFunc pfnProgress=nullptr, void *pProgressData=nullptr) |
| | Execute the algorithm, starting with ValidateArguments() and then calling RunImpl().
|
| virtual bool | Finalize () |
| | Complete any pending actions, and return the final status.
|
|
virtual std::string | GetUsageForCLI (bool shortUsage, const UsageOptions &usageOptions=UsageOptions()) const |
| | Return the usage as a string appropriate for command-line interface --help output.
|
| virtual std::string | GetUsageAsJSON () const |
| | Return the usage of the algorithm as a JSON-serialized string.
|
| GDALAlgorithm & | GetActualAlgorithm () |
| | Return the actual algorithm that is going to be invoked, when the current algorithm has sub-algorithms.
|
|
bool | IsHelpRequested () const |
| | Whether the --help flag has been specified.
|
|
bool | IsJSONUsageRequested () const |
| | Whether the --json-usage flag has been specified.
|
|
bool | IsProgressBarRequested () const |
| | Whether the --progress flag has been specified.
|
|
const std::vector< std::string > & | GetAliases () const |
| | Return alias names (generally short) for the current algorithm.
|
|
bool | PropagateSpecialActionTo (GDALAlgorithm *target) |
| | Used by the "gdal info" special algorithm when it first tries to run "gdal raster info", to inherit from the potential special flags, such as --help or --json-usage, that this later algorithm has received.
|
|
virtual std::vector< std::string > | GetAutoComplete (std::vector< std::string > &args, bool lastWordIsComplete, bool showAllOptions) |
| | Return auto completion suggestions.
|
|
void | SetCalledFromCommandLine () |
| | Set whether the algorithm is called from the command line.
|
|
bool | IsCalledFromCommandLine () const |
| | Return whether the algorithm is called from the command line.
|
|
virtual bool | HasOutputString () const |
| | Whether the algorithm generates an output string.
|
|
|
| GDALAlgorithm (const std::string &name, const std::string &description, const std::string &helpURL) |
| | Constructor.
|
|
bool | ProcessDatasetArg (GDALAlgorithmArg *arg, GDALAlgorithm *algForOutput) |
| | Special processing for an argument of type GAAT_DATASET.
|
|
template<class MyAlgorithm> |
| bool | RegisterSubAlgorithm () |
| | Register the sub-algorithm of type MyAlgorithm.
|
|
bool | RegisterSubAlgorithm (const GDALAlgorithmRegistry::AlgInfo &info) |
| | Register a sub-algoritm by its AlgInfo structure.
|
|
void | AllowArbitraryLongNameArgs () |
| | Allow arbitrary user arguments using long name syntax (–something).
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, bool *pValue) |
| | Add boolean argument.
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, std::string *pValue) |
| | Add string argument.
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, int *pValue) |
| | Add integer argument.
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, double *pValue) |
| | Add real argument.
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, GDALArgDatasetValue *pValue, GDALArgDatasetType type=GDAL_OF_RASTER|GDAL_OF_VECTOR|GDAL_OF_MULTIDIM_RASTER) |
| | Add dataset argument.
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, std::vector< std::string > *pValue) |
| | Add list of string argument.
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, std::vector< int > *pValue) |
| | Add list of integer argument.
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, std::vector< double > *pValue) |
| | Add list of real argument.
|
|
GDALInConstructionAlgorithmArg & | AddArg (const std::string &longName, char chShortName, const std::string &helpMessage, std::vector< GDALArgDatasetValue > *pValue, GDALArgDatasetType type=GDAL_OF_RASTER|GDAL_OF_VECTOR|GDAL_OF_MULTIDIM_RASTER) |
| | Add list of dataset argument.
|
|
GDALInConstructionAlgorithmArg & | AddInputDatasetArg (GDALArgDatasetValue *pValue, GDALArgDatasetType type=GDAL_OF_RASTER|GDAL_OF_VECTOR|GDAL_OF_MULTIDIM_RASTER, bool positionalAndRequired=true, const char *helpMessage=nullptr) |
| | Add input dataset argument.
|
|
GDALInConstructionAlgorithmArg & | AddInputDatasetArg (std::vector< GDALArgDatasetValue > *pValue, GDALArgDatasetType type=GDAL_OF_RASTER|GDAL_OF_VECTOR|GDAL_OF_MULTIDIM_RASTER, bool positionalAndRequired=true, const char *helpMessage=nullptr) |
| | Add input dataset argument.
|
|
GDALInConstructionAlgorithmArg & | AddOpenOptionsArg (std::vector< std::string > *pValue, const char *helpMessage=nullptr) |
| | Add (input) open option(s) argument.
|
|
GDALInConstructionAlgorithmArg & | AddOutputOpenOptionsArg (std::vector< std::string > *pValue, const char *helpMessage=nullptr) |
| | Add output open option(s) argument.
|
|
GDALInConstructionAlgorithmArg & | AddInputFormatsArg (std::vector< std::string > *pValue, const char *helpMessage=nullptr) |
| | Add input format(s) argument.
|
|
GDALInConstructionAlgorithmArg & | AddOutputDatasetArg (GDALArgDatasetValue *pValue, GDALArgDatasetType type=GDAL_OF_RASTER|GDAL_OF_VECTOR|GDAL_OF_MULTIDIM_RASTER, bool positionalAndRequired=true, const char *helpMessage=nullptr) |
| | Add output dataset argument.
|
|
GDALInConstructionAlgorithmArg & | AddOverwriteArg (bool *pValue, const char *helpMessage=nullptr) |
| | Add --overwrite argument.
|
|
GDALInConstructionAlgorithmArg & | AddOverwriteLayerArg (bool *pValue, const char *helpMessage=nullptr) |
| | Add --overwrite-layer argument.
|
|
GDALInConstructionAlgorithmArg & | AddUpdateArg (bool *pValue, const char *helpMessage=nullptr) |
| | Add --update argument.
|
|
GDALInConstructionAlgorithmArg & | AddAppendLayerArg (bool *pValue, const char *helpMessage=nullptr) |
| | Add --append argument for a vector layer.
|
|
GDALInConstructionAlgorithmArg & | AddOutputStringArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add (non-CLI) output-string argument.
|
|
GDALInConstructionAlgorithmArg & | AddStdoutArg (bool *pValue, const char *helpMessage=nullptr) |
| | Add (hidden) stdout argument.
|
|
GDALInConstructionAlgorithmArg & | AddOutputFormatArg (std::string *pValue, bool bStreamAllowed=false, bool bGDALGAllowed=false, const char *helpMessage=nullptr) |
| | Add output format argument.
|
|
GDALInConstructionAlgorithmArg & | AddOutputDataTypeArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add output data type argument.
|
|
GDALInConstructionAlgorithmArg & | AddNodataArg (std::string *pValue, bool noneAllowed, const std::string &optionName="nodata", const char *helpMessage=nullptr) |
| | Add nodata argument.
|
|
GDALInConstructionAlgorithmArg & | AddCreationOptionsArg (std::vector< std::string > *pValue, const char *helpMessage=nullptr) |
| | Add creation option(s) argument.
|
|
GDALInConstructionAlgorithmArg & | AddLayerCreationOptionsArg (std::vector< std::string > *pValue, const char *helpMessage=nullptr) |
| | Add layer creation option(s) argument.
|
|
GDALInConstructionAlgorithmArg & | AddLayerNameArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add (single) layer name argument.
|
|
GDALInConstructionAlgorithmArg & | AddOutputLayerNameArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add (single) output layer name argument.
|
|
GDALInConstructionAlgorithmArg & | AddLayerNameArg (std::vector< std::string > *pValue, const char *helpMessage=nullptr) |
| | Add (potentially multiple) layer name(s) argument.
|
|
GDALInConstructionAlgorithmArg & | AddArrayNameArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add (single) (multidimensional) array name argument.
|
|
GDALInConstructionAlgorithmArg & | AddArrayNameArg (std::vector< std::string > *pValue, const char *helpMessage=nullptr) |
| | Add (multiple) (multidimensional) array name argument.
|
| GDALInConstructionAlgorithmArg & | AddMemorySizeArg (size_t *pValue, std::string *pStrValue, const std::string &optionName, const char *helpMessage) |
| | Add a memory size argument(s), The final value is stored in *pValue.
|
|
GDALInConstructionAlgorithmArg & | AddGeometryTypeArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add geometry type argument.
|
|
GDALInConstructionAlgorithmArg & | AddFieldNameArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add a field name argument.
|
|
GDALInConstructionAlgorithmArg & | AddFieldTypeSubtypeArg (OGRFieldType *pTypeValue, OGRFieldSubType *pSubtypeValue, std::string *pStrValue, const std::string &argName=std::string(), const char *helpMessage=nullptr) |
| | Add a field type (or subtype) argument.
|
|
GDALInConstructionAlgorithmArg & | AddBandArg (int *pValue, const char *helpMessage=nullptr) |
| | Add (single) band argument.
|
|
GDALInConstructionAlgorithmArg & | AddBandArg (std::vector< int > *pValue, const char *helpMessage=nullptr) |
| | Add (potentially multiple) band argument.
|
|
GDALInConstructionAlgorithmArg & | AddBBOXArg (std::vector< double > *pValue, const char *helpMessage=nullptr) |
| | Add bbox=xmin,ymin,xmax,ymax argument.
|
|
GDALInConstructionAlgorithmArg & | AddActiveLayerArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add active layer argument.
|
| GDALInConstructionAlgorithmArg & | AddNumThreadsArg (int *pValue, std::string *pStrValue, const char *helpMessage=nullptr) |
| | A number of thread argument.
|
|
GDALInConstructionAlgorithmArg & | AddAbsolutePathArg (bool *pValue, const char *helpMessage=nullptr) |
| | Add an argument to ask writing absolute paths.
|
|
GDALInConstructionAlgorithmArg & | AddPixelFunctionNameArg (std::string *pValue, const char *helpMessage=nullptr) |
| | Add an argument for pixel function name.
|
|
GDALInConstructionAlgorithmArg & | AddPixelFunctionArgsArg (std::vector< std::string > *pValue, const char *helpMessage=nullptr) |
| | Add an argument for pixel function arguments.
|
|
void | AddProgressArg () |
| | Add --quiet (and hidden --progress) argument.
|
| void | AddValidationAction (std::function< bool()> f) |
| | Register an action that is executed by the ValidateArguments() method.
|
|
bool | ParseAndValidateKeyValue (GDALAlgorithmArg &arg) |
| | Validation function to use for key=value type of arguments.
|
|
bool | RunPreStepPipelineValidations () const |
| | Method used by GDALRaster|VectorPipelineAlgorithm.
|
|
bool | IsGDALGOutput () const |
| | Return whether output-format or output arguments express GDALG output.
|
|
virtual ProcessGDALGOutputRet | ProcessGDALGOutput () |
| | Process output to a .gdalg file.
|
|
virtual bool | CheckSafeForStreamOutput () |
| | Method executed by Run() when m_executionForStreamOutput is set to ensure the command is safe to execute in a streamed dataset context.
|
|
bool | ValidateFormat (const GDALAlgorithmArg &arg, bool bStreamAllowed, bool bGDALGAllowed) const |
| | Validate a format argument.
|
|
void | SetDisplayInJSONUsage (bool b) |
| | Set whether this algorithm should be reported in JSON usage.
|
| virtual void | WarnIfDeprecated () |
| | Method that an algorithm can implement to issue a warning message about its deprecation.
|
|
std::pair< std::vector< std::pair< GDALAlgorithmArg *, std::string > >, size_t > | GetArgNamesForCLI () const |
| | Return the list of arguments for CLI usage.
|
GDAL algorithm.
An algorithm declares its name, description, help URL. It also defined arguments or (mutual exclusion) sub-algorithms.
It can be used from the command line with the ParseCommandLineArguments() method, or users can iterate over the available arguments with the GetArgs() or GetArg() method and fill them programmatically with GDALAlgorithmArg::Set().
Execution of the algorithm is done with the Run() method.
This is an abstract class. Implementations must sub-class it and implement the RunImpl() method.