GDAL
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
GDALAlgorithmArg Class Reference

Argument of an algorithm. More...

#include <gdalalgorithm_cpp.h>

Inheritance diagram for GDALAlgorithmArg:
GDALInConstructionAlgorithmArg

Public Member Functions

template<class T >
 GDALAlgorithmArg (const GDALAlgorithmArgDecl &decl, T *pValue)
 Constructor.
 
virtual ~GDALAlgorithmArg ()
 Destructor.
 
const GDALAlgorithmArgDeclGetDeclaration () const
 Return the argument declaration.
 
const std::string & GetName () const
 Alias for GDALAlgorithmArgDecl::GetName()
 
const std::string & GetShortName () const
 Alias for GDALAlgorithmArgDecl::GetShortName()
 
const std::vector< std::string > & GetAliases () const
 Alias for GDALAlgorithmArgDecl::GetAliases()
 
const std::vector< char > & GetShortNameAliases () const
 Alias for GDALAlgorithmArgDecl::GetShortNameAliases()
 
const std::string & GetDescription () const
 Alias for GDALAlgorithmArgDecl::GetDescription()
 
const std::string & GetMetaVar () const
 Alias for GDALAlgorithmArgDecl::GetMetaVar()
 
GDALAlgorithmArgType GetType () const
 Alias for GDALAlgorithmArgDecl::GetType()
 
const std::string & GetCategory () const
 Alias for GDALAlgorithmArgDecl::GetCategory()
 
bool IsRequired () const
 Alias for GDALAlgorithmArgDecl::IsRequired()
 
int GetMinCount () const
 Alias for GDALAlgorithmArgDecl::GetMinCount()
 
int GetMaxCount () const
 Alias for GDALAlgorithmArgDecl::GetMaxCount()
 
bool GetDisplayHintAboutRepetition () const
 Alias for GDALAlgorithmArgDecl::GetDisplayHintAboutRepetition()
 
bool GetPackedValuesAllowed () const
 Alias for GDALAlgorithmArgDecl::GetPackedValuesAllowed()
 
bool GetRepeatedArgAllowed () const
 Alias for GDALAlgorithmArgDecl::GetRepeatedArgAllowed()
 
bool GetDuplicateValuesAllowed () const
 Alias for GDALAlgorithmArgDecl::GetDuplicateValuesAllowed()
 
bool IsPositional () const
 Alias for GDALAlgorithmArgDecl::IsPositional()
 
const std::vector< std::string > & GetChoices () const
 Alias for GDALAlgorithmArgDecl::GetChoices()
 
const std::vector< std::string > & GetHiddenChoices () const
 Alias for GDALAlgorithmArgDecl::GetHiddenChoices()
 
std::vector< std::string > GetAutoCompleteChoices (const std::string &currentValue) const
 Return auto completion choices, if a auto completion function has been registered.
 
std::pair< double, bool > GetMinValue () const
 Alias for GDALAlgorithmArgDecl::GetMinValue()
 
std::pair< double, bool > GetMaxValue () const
 Alias for GDALAlgorithmArgDecl::GetMaxValue()
 
int GetMinCharCount () const
 Alias for GDALAlgorithmArgDecl::GetMinCharCount()
 
int GetMaxCharCount () const
 Alias for GDALAlgorithmArgDecl::GetMaxCharCount()
 
bool IsExplicitlySet () const
 Return whether the argument value has been explicitly set with Set()
 
bool HasDefaultValue () const
 Alias for GDALAlgorithmArgDecl::HasDefaultValue()
 
bool IsHidden () const
 Alias for GDALAlgorithmArgDecl::IsHidden()
 
bool IsHiddenForCLI () const
 Alias for GDALAlgorithmArgDecl::IsHiddenForCLI()
 
bool IsOnlyForCLI () const
 Alias for GDALAlgorithmArgDecl::IsOnlyForCLI()
 
bool IsHiddenForAPI () const
 Alias for GDALAlgorithmArgDecl::IsHiddenForAPI()
 
bool IsInput () const
 Alias for GDALAlgorithmArgDecl::IsInput()
 
bool IsOutput () const
 Alias for GDALAlgorithmArgDecl::IsOutput()
 
bool IsReadFromFileAtSyntaxAllowed () const
 Alias for GDALAlgorithmArgDecl::IsReadFromFileAtSyntaxAllowed()
 
bool IsRemoveSQLCommentsEnabled () const
 Alias for GDALAlgorithmArgDecl::IsRemoveSQLCommentsEnabled()
 
const std::string & GetMutualExclusionGroup () const
 Alias for GDALAlgorithmArgDecl::GetMutualExclusionGroup()
 
const std::string & GetMutualDependencyGroup () const
 Alias for GDALAlgorithmArgDecl::GetMutualDependencyGroup()
 
const std::vector< std::string > & GetDirectDependencies () const
 Alias for GDALAlgorithmArgDecl::GetDirectDependencies()
 
const std::map< std::string, std::vector< std::string > > GetMetadata () const
 Alias for GDALAlgorithmArgDecl::GetMetadata()
 
const std::vector< std::string > * GetMetadataItem (const std::string &name) const
 Alias for GDALAlgorithmArgDecl::GetMetadataItem()
 
template<class T >
const T & GetDefault () const
 Alias for GDALAlgorithmArgDecl::GetDefault()
 
bool AutoOpenDataset () const
 Alias for GDALAlgorithmArgDecl::AutoOpenDataset()
 
bool IsUserProvided () const
 Alias for GDALAlgorithmArgDecl::IsUserProvided()
 
GDALArgDatasetType GetDatasetType () const
 Alias for GDALAlgorithmArgDecl::GetDatasetType()
 
int GetDatasetInputFlags () const
 Alias for GDALAlgorithmArgDecl::GetDatasetInputFlags()
 
int GetDatasetOutputFlags () const
 Alias for GDALAlgorithmArgDecl::GetDatasetOutputFlags()
 
bool IsAvailableInPipelineStep () const
 Alias for GDALAlgorithmArgDecl::IsAvailableInPipelineStep()
 
template<class T >
T & Get ()
 Return the value of the argument, which is by decreasing order of priority:
 
template<class T >
const T & Get () const
 Return the value of the argument, which is by decreasing order of priority:
 
bool Set (bool value)
 Set the value for a GAAT_BOOLEAN argument.
 
bool Set (const std::string &value)
 Set the value for a GAAT_STRING argument.
 
bool Set (const char *value)
 Set the value for a GAAT_STRING argument.
 
bool Set (GDALDataType dt)
 Set the value for a GAAT_STRING argument from a GDALDataType It cannot be called several times for a given argument.
 
bool Set (const OGRSpatialReference &)
 Set the value for a GAAT_STRING argument (representing a CRS) from a OGRSpatialReference It cannot be called several times for a given argument.
 
bool Set (int value)
 Set the value for a GAAT_INTEGER (or GAAT_REAL) argument.
 
bool Set (double value)
 Set the value for a GAAT_REAL argument.
 
bool Set (GDALDataset *ds)
 Set the value for a GAAT_DATASET argument, increasing ds' reference counter if ds is not null.
 
bool Set (std::unique_ptr< GDALDataset > ds)
 Set the value for a GAAT_DATASET argument.
 
bool SetDatasetName (const std::string &name)
 Set the value for a GAAT_DATASET argument.
 
bool SetFrom (const GDALArgDatasetValue &other)
 Set the value for a GAAT_DATASET argument.
 
bool Set (const std::vector< std::string > &value)
 Set the value for a GAAT_STRING_LIST argument.
 
bool Set (const std::vector< int > &value)
 Set the value for a GAAT_INTEGER_LIST argument.
 
bool Set (const std::vector< double > &value)
 Set the value for a GAAT_REAL_LIST argument.
 
bool Set (std::vector< GDALArgDatasetValue > &&value)
 Set the value for a GAAT_DATASET_LIST argument.
 
GDALAlgorithmArgoperator= (bool value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (int value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (double value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (const std::string &value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (const char *value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (GDALDataType value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (const OGRSpatialReference &value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (const std::vector< int > &value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (const std::vector< double > &value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (const std::vector< std::string > &value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (GDALDataset *value)
 Set the value of the argument.
 
GDALAlgorithmArgoperator= (std::unique_ptr< GDALDataset > value)
 Set the value of the argument.
 
bool SetFrom (const GDALAlgorithmArg &other)
 Set the value for another argument.
 
void SetSkipIfAlreadySet (bool skip=true)
 Advanced method used to make "gdal info" and "gdal raster|vector info" to avoid re-opening an already opened dataset.
 
bool SkipIfAlreadySet () const
 Advanced method used to make "gdal info" and "gdal raster|vector info" to avoid re-opening an already opened dataset.
 
bool Serialize (std::string &serializedArg, bool absolutePath=false) const
 Serialize this argument and its value.
 

Static Public Member Functions

static std::string GetEscapedString (const std::string &s)
 Return an escaped string for argument serialization.
 

Protected Attributes

GDALAlgorithmArgDecl m_decl
 Argument declaration.
 
std::variant< bool *, std::string *, int *, double *, GDALArgDatasetValue *, std::vector< std::string > *, std::vector< int > *, std::vector< double > *, std::vector< GDALArgDatasetValue > * > m_value {}
 Pointer to the value.
 
std::vector< std::function< void()> > m_actions {}
 Actions.
 
std::vector< std::function< bool()> > m_validationActions {}
 Validation actions.
 
std::function< std::vector< std::string >(const std::string &)> m_autoCompleteFunction {}
 Autocompletion function.
 
GDALAlgorithmm_owner = nullptr
 Algorithm that may own this argument.
 

Friends

class GDALAlgorithm
 

Detailed Description

Argument of an algorithm.

Member Function Documentation

◆ Get() [1/2]

template<class T >
T & GDALAlgorithmArg::Get ( )
inline

Return the value of the argument, which is by decreasing order of priority:

  • the value set through Set().
  • the default value set through SetDefault().
  • the initial value of the C++ variable to which this argument is bound to.

Must be called with T consistent of the type of the algorithm:

  • bool for GAAT_BOOLEAN
  • int for GAAT_INTEGER
  • double for GAAT_REAL
  • std::string for GAAT_STRING
  • GDALArgDatasetValue for GAAT_DATASET
  • std::vector<int> for GAAT_INTEGER_LIST
  • std::vector<double for GAAT_REAL_LIST
  • std::vector<std::string> for GAAT_STRING_LIST
  • std::vector<GDALArgDatasetValue> for GAAT_DATASET_LIST

◆ Get() [2/2]

template<class T >
const T & GDALAlgorithmArg::Get ( ) const
inline

Return the value of the argument, which is by decreasing order of priority:

  • the value set through Set().
  • the default value set through SetDefault().
  • the initial value of the C++ variable to which this argument is bound to.

Must be called with T consistent of the type of the algorithm:

  • bool for GAAT_BOOLEAN
  • int for GAAT_INTEGER
  • double for GAAT_REAL
  • std::string for GAAT_STRING
  • GDALArgDatasetValue for GAAT_DATASET
  • std::vector<int> for GAAT_INTEGER_LIST
  • std::vector<double for GAAT_REAL_LIST
  • std::vector<std::string> for GAAT_STRING_LIST
  • std::vector<GDALArgDatasetValue> for GAAT_DATASET_LIST

◆ Serialize()

bool GDALAlgorithmArg::Serialize ( std::string &  serializedArg,
bool  absolutePath = false 
) const

Serialize this argument and its value.

May return false if the argument is not explicitly set or if a dataset is passed by value.

◆ Set() [1/12]

bool GDALAlgorithmArg::Set ( bool  value)

Set the value for a GAAT_BOOLEAN argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [2/12]

bool GDALAlgorithmArg::Set ( const char *  value)
inline

Set the value for a GAAT_STRING argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [3/12]

bool GDALAlgorithmArg::Set ( const OGRSpatialReference value)

Set the value for a GAAT_STRING argument (representing a CRS) from a OGRSpatialReference It cannot be called several times for a given argument.

Validation checks and other actions are run. Return true if success.

◆ Set() [4/12]

bool GDALAlgorithmArg::Set ( const std::string &  value)

Set the value for a GAAT_STRING argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [5/12]

bool GDALAlgorithmArg::Set ( const std::vector< double > &  value)

Set the value for a GAAT_REAL_LIST argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [6/12]

bool GDALAlgorithmArg::Set ( const std::vector< int > &  value)

Set the value for a GAAT_INTEGER_LIST argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [7/12]

bool GDALAlgorithmArg::Set ( const std::vector< std::string > &  value)

Set the value for a GAAT_STRING_LIST argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [8/12]

bool GDALAlgorithmArg::Set ( GDALDataset ds)

Set the value for a GAAT_DATASET argument, increasing ds' reference counter if ds is not null.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [9/12]

bool GDALAlgorithmArg::Set ( GDALDataType  dt)
inline

Set the value for a GAAT_STRING argument from a GDALDataType It cannot be called several times for a given argument.

Validation checks and other actions are run. Return true if success.

◆ Set() [10/12]

bool GDALAlgorithmArg::Set ( int  value)

Set the value for a GAAT_INTEGER (or GAAT_REAL) argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [11/12]

bool GDALAlgorithmArg::Set ( std::unique_ptr< GDALDataset ds)

Set the value for a GAAT_DATASET argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ Set() [12/12]

bool GDALAlgorithmArg::Set ( std::vector< GDALArgDatasetValue > &&  value)

Set the value for a GAAT_DATASET_LIST argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ SetDatasetName()

bool GDALAlgorithmArg::SetDatasetName ( const std::string &  name)

Set the value for a GAAT_DATASET argument.

It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ SetFrom() [1/2]

bool GDALAlgorithmArg::SetFrom ( const GDALAlgorithmArg other)

Set the value for another argument.

For GAAT_DATASET, it will reference the dataset pointed by other.m_poDS. It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.

◆ SetFrom() [2/2]

bool GDALAlgorithmArg::SetFrom ( const GDALArgDatasetValue other)

Set the value for a GAAT_DATASET argument.

It references the dataset pointed by other.m_poDS. It cannot be called several times for a given argument. Validation checks and other actions are run. Return true if success.


The documentation for this class was generated from the following files: