QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsprocessingregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingregistry.h
3  ------------------------
4  begin : December 2016
5  copyright : (C) 2016 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSPROCESSINGREGISTRY_H
19 #define QGSPROCESSINGREGISTRY_H
20 
21 #include "qgis_core.h"
22 #include "qgis.h"
23 #include "qgsprocessingprovider.h"
24 #include <QMap>
25 
28 
39 class CORE_EXPORT QgsProcessingRegistry : public QObject
40 {
41  Q_OBJECT
42 
43  public:
44 
48  QgsProcessingRegistry( QObject *parent SIP_TRANSFERTHIS = nullptr );
49 
50  ~QgsProcessingRegistry() override;
51 
53  QgsProcessingRegistry( const QgsProcessingRegistry &other ) = delete;
56 
60  QList<QgsProcessingProvider *> providers() const { return mProviders.values(); }
61 
71  bool addProvider( QgsProcessingProvider *provider SIP_TRANSFER );
72 
78  bool removeProvider( QgsProcessingProvider *provider );
79 
85  bool removeProvider( const QString &providerId );
86 
90  QgsProcessingProvider *providerById( const QString &id );
91 
96  QList< const QgsProcessingAlgorithm *> algorithms() const;
97 
104  const QgsProcessingAlgorithm *algorithmById( const QString &id ) const;
105 
106  /*
107  * IMPORTANT: While it seems like /Factory/ would be the correct annotation here, that's not
108  * the case.
109  * As per Phil Thomson's advice on https://www.riverbankcomputing.com/pipermail/pyqt/2017-July/039450.html:
110  *
111  * "
112  * /Factory/ is used when the instance returned is guaranteed to be new to Python.
113  * In this case it isn't because it has already been seen when being returned by QgsProcessingAlgorithm::createInstance()
114  * (However for a different sub-class implemented in C++ then it would be the first time it was seen
115  * by Python so the /Factory/ on create() would be correct.)
116  *
117  * You might try using /TransferBack/ on create() instead - that might be the best compromise.
118  * "
119  */
120 
134  QgsProcessingAlgorithm *createAlgorithmById( const QString &id, const QVariantMap &configuration = QVariantMap() ) const SIP_TRANSFERBACK;
135 
147  void addAlgorithmAlias( const QString &aliasId, const QString &actualId );
148 
158  bool addParameterType( QgsProcessingParameterType *type SIP_TRANSFER );
159 
169  void removeParameterType( QgsProcessingParameterType *type );
170 
176  QgsProcessingParameterType *parameterType( const QString &id ) const;
177 
183  QList<QgsProcessingParameterType *> parameterTypes() const;
184 
185  signals:
186 
188  void providerAdded( const QString &id );
189 
191  void providerRemoved( const QString &id );
192 
198  void parameterTypeAdded( QgsProcessingParameterType *type );
199 
206  void parameterTypeRemoved( QgsProcessingParameterType *type );
207 
208  private:
209 
211  QMap<QString, QgsProcessingProvider *> mProviders;
212 
214  QMap<QString, QgsProcessingParameterType *> mParameterTypes;
215 
216  QMap< QString, QString > mAlgorithmAliases;
217 
218 #ifdef SIP_RUN
220 #endif
221 };
222 
223 #endif // QGSPROCESSINGREGISTRY_H
224 
225 
QgsProcessingProvider
Abstract base class for processing providers.
Definition: qgsprocessingprovider.h:35
qgis.h
QgsProcessingRegistry::operator=
QgsProcessingRegistry & operator=(const QgsProcessingRegistry &other)=delete
Registry cannot be copied.
SIP_TRANSFERBACK
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
QgsProcessingParameterType
Makes metadata of processing parameters available.
Definition: qgsprocessingparametertype.h:34
QgsProcessingAlgorithmConfigurationWidgetFactory
Interface base class for factories for algorithm configuration widgets.
Definition: qgsprocessingalgorithmconfigurationwidget.h:125
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsProcessingRegistry::QgsProcessingRegistry
QgsProcessingRegistry(const QgsProcessingRegistry &other)=delete
Registry cannot be copied.
QgsProcessingAlgorithm
Abstract base class for processing algorithms.
Definition: qgsprocessingalgorithm.h:52
QgsProcessingRegistry
Registry for various processing components, including providers, algorithms and various parameters an...
Definition: qgsprocessingregistry.h:40
QgsProcessingRegistry::providers
QList< QgsProcessingProvider * > providers() const
Gets list of available providers.
Definition: qgsprocessingregistry.h:60
qgsprocessingprovider.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53