GDAL
GDALGlobalAlgorithmRegistry Class Reference

Global registry of GDAL algorithms. More...

#include <gdalalgorithm_cpp.h>

Inheritance diagram for GDALGlobalAlgorithmRegistry:
GDALAlgorithmRegistry

Public Types

using InstantiateFunc = std::function<std::unique_ptr<GDALAlgorithm>()>
 Instantiation function.

Public Member Functions

void DeclareAlgorithm (const std::vector< std::string > &path, InstantiateFunc instantiateFunc)
 Declare the algorithm designed by its path (omitting leading path) and provide its instantiation method.
std::vector< std::string > GetDeclaredSubAlgorithmNames (const std::vector< std::string > &path) const
 Return the direct declared (as per DeclareAlgorithm()) subalgorithms of the given path.
bool HasDeclaredSubAlgorithm (const std::vector< std::string > &path) const
 Return whether a subalgorithm is declared at the given path.
std::unique_ptr< GDALAlgorithmInstantiateDeclaredSubAlgorithm (const std::vector< std::string > &path) const
 Instantiate a declared (as per DeclareAlgorithm()) subalgorithm.
template<class MyAlgorithm>
bool Register ()
 Register the algorithm of type MyAlgorithm.
bool Register (const AlgInfo &info)
 Register an algorithm by its AlgInfo structure.
std::vector< std::string > GetNames () const
 Get the names of registered algorithms.
std::unique_ptr< GDALAlgorithmInstantiate (const std::string &name) const
 Instantiate an algorithm by its name or one of its alias.
std::unique_ptr< GDALAlgorithmInstantiate (const std::vector< std::string > &path) const
 Instantiate an algorithm by its path.
template<typename... V>
std::unique_ptr< GDALAlgorithmInstantiate (const std::string &first, V &&...rest)
 Instantiate an algorithm by its path.
const AlgInfoGetInfo (const std::string &name) const
 Get an algorithm by its name.
bool empty () const
 Returns true if there are no algorithms registered.

Static Public Member Functions

static GDALGlobalAlgorithmRegistryGetSingleton ()
 Get the singleton.

Static Public Attributes

static constexpr const char * ROOT_ALG_NAME = "gdal"
 Name of the root "gdal" algorithm.
static constexpr const char * HIDDEN_ALIAS_SEPARATOR = "==hide=="
 Special value to put in m_aliases to separate public alias from hidden aliases.

Protected Member Functions

std::unique_ptr< GDALAlgorithmInstantiateTopLevel (const std::string &name) const override
 Instantiate an algorithm by its name or one of its alias.

Detailed Description

Global registry of GDAL algorithms.

Member Function Documentation

◆ DeclareAlgorithm()

void GDALGlobalAlgorithmRegistry::DeclareAlgorithm ( const std::vector< std::string > & path,
InstantiateFunc instantiateFunc )

Declare the algorithm designed by its path (omitting leading path) and provide its instantiation method.

For example {"driver", "pdf", "list-layers"}

This is typically used by plugins to register extra algorithms.

◆ GetNames()

std::vector< std::string > GDALAlgorithmRegistry::GetNames ( ) const
inherited

Get the names of registered algorithms.

This only returns the main name of each algorithm, not its potential alternate names.

◆ Instantiate() [1/3]

template<typename... V>
std::unique_ptr< GDALAlgorithm > GDALAlgorithmRegistry::Instantiate ( const std::string & first,
V &&... rest )
inlineinherited

Instantiate an algorithm by its path.

Returns
algorithm, or nullptr
Since
3.12

◆ Instantiate() [2/3]

std::unique_ptr< GDALAlgorithm > GDALAlgorithmRegistry::Instantiate ( const std::string & name) const
inherited

Instantiate an algorithm by its name or one of its alias.

Returns
algorithm, or nullptr

◆ Instantiate() [3/3]

std::unique_ptr< GDALAlgorithm > GDALAlgorithmRegistry::Instantiate ( const std::vector< std::string > & path) const
inherited

Instantiate an algorithm by its path.

Returns
algorithm, or nullptr
Since
3.12

◆ InstantiateTopLevel()

std::unique_ptr< GDALAlgorithm > GDALGlobalAlgorithmRegistry::InstantiateTopLevel ( const std::string & name) const
overrideprotectedvirtual

Instantiate an algorithm by its name or one of its alias.

Reimplemented from GDALAlgorithmRegistry.


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