/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/processing/qgsprocessingmodelalgorithm.h                    *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 ************************************************************************/





class QgsProcessingModelAlgorithm : QgsProcessingAlgorithm
{
%Docstring
 Model based algorithm with processing.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
  public:

    class ChildParameterSource
{
%Docstring
 Source for the value of a parameter for a child algorithm within a model.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
      public:

        enum Source
        {
          ModelParameter,
          ChildOutput,
          StaticValue,
        };

        ChildParameterSource();
%Docstring
 Constructor for ChildParameterSource. It is recommended that the static methods
 fromStaticValue(), fromModelParameter() and fromChildOutput() are used instead.
%End

        bool operator==( const QgsProcessingModelAlgorithm::ChildParameterSource &other ) const;
        bool operator!=( const QgsProcessingModelAlgorithm::ChildParameterSource &other ) const;
%Docstring
 :rtype: bool
%End

        static QgsProcessingModelAlgorithm::ChildParameterSource fromStaticValue( const QVariant &value );
%Docstring
 Returns a new ChildParameterSource which takes its value from a static ``value``.
.. seealso:: fromModelParameter()
.. seealso:: fromChildOutput()
 :rtype: QgsProcessingModelAlgorithm.ChildParameterSource
%End

        static QgsProcessingModelAlgorithm::ChildParameterSource fromModelParameter( const QString &parameterName );
%Docstring
 Returns a new ChildParameterSource which takes its value from a parent model parameter.
.. seealso:: fromStaticValue()
.. seealso:: fromChildOutput()
 :rtype: QgsProcessingModelAlgorithm.ChildParameterSource
%End

        static QgsProcessingModelAlgorithm::ChildParameterSource fromChildOutput( const QString &childId, const QString &outputName );
%Docstring
 Returns a new ChildParameterSource which takes its value from an output generated by a child algorithm.
.. seealso:: fromStaticValue()
.. seealso:: fromModelParameter()
 :rtype: QgsProcessingModelAlgorithm.ChildParameterSource
%End

        Source source() const;
%Docstring
 Returns the parameter value's source.
 :rtype: Source
%End

        QVariant staticValue() const;
%Docstring
 Returns the source's static value. This is only used when the source() is StaticValue.
.. seealso:: setStaticValue()
 :rtype: QVariant
%End

        void setStaticValue( const QVariant &value );
%Docstring
 Sets the source's static value. Calling this will also change the source() to StaticValue.
.. seealso:: staticValue()
%End

        QString parameterName() const;
%Docstring
 Returns the source's model parameter name. This is only used when the source() is ModelParameter.
.. seealso:: setParameterName()
 :rtype: str
%End

        void setParameterName( const QString &name );
%Docstring
 Sets the source's model parameter ``name``. Calling this will also change the source() to ModelParameter.
.. seealso:: parameterName()
%End

        QString outputChildId() const;
%Docstring
 Returns the source's child algorithm ID from which the output value will be taken. This is only used when the source() is ChildOutput.
.. seealso:: setOutputChildId()
.. seealso:: outputName()
 :rtype: str
%End

        void setOutputChildId( const QString &id );
%Docstring
 Sets the source's child algorithm ``id`` from which the output value will be taken. Calling this will also change the source() to ChildOutput.
.. seealso:: parameterName()
.. seealso:: setOutputName()
%End

        QString outputName() const;
%Docstring
 Returns the source's child algorithm output name from which the output value will be taken. This is only used when the source() is ChildOutput.
.. seealso:: setOutputName()
.. seealso:: outputChildId()
 :rtype: str
%End

        void setOutputName( const QString &name );
%Docstring
 Sets the source's child algorithm output ``name`` from which the output value will be taken. Calling this will also change the source() to ChildOutput.
.. seealso:: outputName()
.. seealso:: setOutputChildId()
%End

        QVariant toVariant() const;
%Docstring
 Saves this source to a QVariant.
.. seealso:: loadVariant()
 :rtype: QVariant
%End

        bool loadVariant( const QVariantMap &map );
%Docstring
 Loads this source from a QVariantMap.
.. seealso:: toVariant()
 :rtype: bool
%End

    };

    class Component
{
%Docstring
 Represents a component of a model algorithm.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
      public:

        QString description() const;
%Docstring
 Returns the friendly description text for the component.
.. seealso:: setDescription()
 :rtype: str
%End

        void setDescription( const QString &description );
%Docstring
 Sets the friendly ``description`` text for the component.
.. seealso:: description()
%End

        QPointF position() const;
%Docstring
 Returns the position of the model component within the graphical modeler.
.. seealso:: setPosition()
 :rtype: QPointF
%End

        void setPosition( const QPointF &position );
%Docstring
 Sets the ``position`` of the model component within the graphical modeler.
.. seealso:: position()
%End

      protected:

        Component( const QString &description = QString() );
%Docstring
Only subclasses can be created
%End

        Component( const QgsProcessingModelAlgorithm::Component &other );
%Docstring
Copies are protected to avoid slicing
%End


        void saveCommonProperties( QVariantMap &map ) const;
%Docstring
 Saves the component properties to a QVariantMap.
.. seealso:: restoreCommonProperties()
%End

        void restoreCommonProperties( const QVariantMap &map );
%Docstring
 Restores the component properties from a QVariantMap.
.. seealso:: saveCommonProperties()
%End

    };

    class ModelParameter : QgsProcessingModelAlgorithm::Component
{
%Docstring
 Represents an input parameter used by the model.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
      public:

        ModelParameter( const QString &parameterName = QString() );
%Docstring
 Constructor for ModelParameter. The parameter name should match one of the
 parameters from the parent model.
%End

        QString parameterName() const;
%Docstring
 Returns the associated parameter name. The parameter name should match one of the
 parameters from the parent model.
.. seealso:: parameterName()
 :rtype: str
%End

        void setParameterName( const QString &name );
%Docstring
 Sets the associated parameter name. The parameter name should match one of the
 parameters from the parent model.
.. seealso:: parameterName()
%End

        QVariant toVariant() const;
%Docstring
 Saves this parameter to a QVariant.
.. seealso:: loadVariant()
 :rtype: QVariant
%End

        bool loadVariant( const QVariantMap &map );
%Docstring
 Loads this parameter from a QVariantMap.
.. seealso:: toVariant()
 :rtype: bool
%End

    };


    class ModelOutput : QgsProcessingModelAlgorithm::Component
{
%Docstring
 Represents a final output created by the model.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
      public:

        ModelOutput( const QString &name = QString(), const QString &description = QString() );
%Docstring
 Constructor for ModelOutput with the specified ``name`` and ``description``.
%End

        QString name() const;
%Docstring
 Returns the model output name.
.. seealso:: setName()
 :rtype: str
%End

        void setName( const QString &name );
%Docstring
 Sets the model output ``name``.
.. seealso:: name()
%End

        QString childId() const;
%Docstring
 Returns the child algorithm ID from which this output is generated.
.. seealso:: setChildId()
 :rtype: str
%End

        void setChildId( const QString &id );
%Docstring
 Sets the child algorithm ``id`` from which this output is generated.
.. seealso:: childId()
%End

        QString childOutputName() const;
%Docstring
 Returns the child algorithm output name from which this output is generated.
.. seealso:: setOutputName()
 :rtype: str
%End

        void setChildOutputName( const QString &name );
%Docstring
 Sets the child algorithm output ``name`` from which this output is generated.
.. seealso:: outputName()
%End

        QVariant toVariant() const;
%Docstring
 Saves this output to a QVariant.
.. seealso:: loadVariant()
 :rtype: QVariant
%End

        bool loadVariant( const QVariantMap &map );
%Docstring
 Loads this output from a QVariantMap.
.. seealso:: toVariant()
 :rtype: bool
%End

    };

    class ChildAlgorithm : QgsProcessingModelAlgorithm::Component
{
%Docstring
 Child algorithm representing a single component of a QgsProcessingModelAlgorithm.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
      public:

        ChildAlgorithm( const QString &algorithmId = QString() );
%Docstring
 Constructor for ChildAlgorithm. The ``algorithmId`` parameter
 should be set to a QgsProcessingAlgorithm algorithm ID.
%End

        QString childId() const;
%Docstring
 Returns the child algorithm's unique ID string, used the identify
 this child algorithm within its parent model.
.. seealso:: setChildId()
.. seealso:: generateChildId()
 :rtype: str
%End

        void setChildId( const QString &id );
%Docstring
 Sets the child algorithm's unique ``id`` string, used the identify
 this child algorithm within its parent model.
.. seealso:: childId()
.. seealso:: generateChildId()
%End

        void generateChildId( const QgsProcessingModelAlgorithm &model );
%Docstring
 Automatically generates a unique childId() for the algorithm,
 avoiding child IDs which are already present in ``model``.
.. seealso:: childId()
.. seealso:: setChildId()
%End

        QString algorithmId() const;
%Docstring
 Returns the underlying child algorithm's ID.
.. seealso:: algorithm()
.. seealso:: setAlgorithmId()
 :rtype: str
%End

        void setAlgorithmId( const QString &algorithmId );
%Docstring
 Sets the underlying child algorithm's ID. This
 should be set to an existing QgsProcessingAlgorithm algorithm ID.
.. seealso:: algorithm()
.. seealso:: algorithmId()
%End

        const QgsProcessingAlgorithm *algorithm() const;
%Docstring
 Returns the underlying child algorithm, or a None
 if a matching algorithm is not available.
.. seealso:: algorithmId()
 :rtype: QgsProcessingAlgorithm
%End

        QMap< QString, QgsProcessingModelAlgorithm::ChildParameterSource > parameterSources() const;
%Docstring
 Returns a map of parameter sources. The keys are the child algorithm
 parameter names, the values are the source for that parameter.
.. seealso:: setParameterSources()
.. seealso:: addParameterSource()
 :rtype: QMap< str, QgsProcessingModelAlgorithm.ChildParameterSource >
%End

        void setParameterSources( const QMap< QString, QgsProcessingModelAlgorithm::ChildParameterSource > &sources );
%Docstring
 Sets the map of parameter ``sources``. The keys are the child algorithm
 parameter names, the values are the source for that parameter.
.. seealso:: parameterSources()
.. seealso:: addParameterSource()
%End

        void addParameterSource( const QString &name, const QgsProcessingModelAlgorithm::ChildParameterSource &source );
%Docstring
 Adds a parameter source. The ``name`` argument should match
 one of the child algorithm's parameter names, and the ``source``
 argument is used to set the source for that parameter.

 Any existing parameter source with matching name will be replaced.
.. seealso:: parameterSources()
.. seealso:: setParameterSources()
%End

        bool isActive() const;
%Docstring
 Returns true if the child algorithm is active.
.. seealso:: setActive()
 :rtype: bool
%End

        void setActive( bool active );
%Docstring
 Sets whether the child algorithm is active.
.. seealso:: isActive()
%End

        QStringList dependencies() const;
%Docstring
 Returns the list of child algorithms from the parent model on which this
 algorithm is dependent. The returned list contains the id() of the
 dependent algorithms.
.. seealso:: setDependencies()
 :rtype: list of str
%End

        void setDependencies( const QStringList &dependencies );
%Docstring
 Sets the list of child algorithms from the parent model on which this
 algorithm is dependent. The list should contain the id() of the
 dependent algorithms.
.. seealso:: dependencies()
%End

        bool parametersCollapsed() const;
%Docstring
 Returns true if the list of parameters for this algorithm should be collapsed
 in the graphical modeller.
.. seealso:: setParametersCollapsed()
.. seealso:: outputsCollapsed()
 :rtype: bool
%End

        void setParametersCollapsed( bool collapsed );
%Docstring
 Sets whether the list of parameters for this algorithm should be collapsed
 in the graphical modeller.
.. seealso:: parametersCollapsed()
.. seealso:: setOutputsCollapsed()
%End

        bool outputsCollapsed() const;
%Docstring
 Returns true if the list of outputs for this algorithm should be collapsed
 in the graphical modeller.
.. seealso:: setParametersCollapsed()
.. seealso:: parametersCollapsed()
 :rtype: bool
%End

        void setOutputsCollapsed( bool collapsed );
%Docstring
 Sets whether the list of outputs for this algorithm should be collapsed
 in the graphical modeller.
.. seealso:: outputsCollapsed()
.. seealso:: setParametersCollapsed()
%End

        QMap<QString, QgsProcessingModelAlgorithm::ModelOutput> modelOutputs() const;
%Docstring
 Returns the map of final model outputs which are generated by this child algorithm.
 The keys are the output names from this child algorithm. Only outputs which are
 part of the final outputs from the model are included in this map.
.. seealso:: setModelOutputs()
.. seealso:: modelOutput()
 :rtype: QMap<str, QgsProcessingModelAlgorithm.ModelOutput>
%End

        QgsProcessingModelAlgorithm::ModelOutput &modelOutput( const QString &name );
%Docstring
 Returns the final model output with matching ``name``. If no output
 exists with the name, a new one will be created and returned.

 If child model outputs are altered by this method, QgsProcessingModelAlgorithm.updateDestinationParameters()
 must be called on the parent model.

.. seealso:: modelOutputs()
.. seealso:: setModelOutputs()
 :rtype: QgsProcessingModelAlgorithm.ModelOutput
%End

        void setModelOutputs( const QMap<QString, QgsProcessingModelAlgorithm::ModelOutput> &outputs );
%Docstring
 Sets the map of final model ``outputs`` which are generated by this child algorithm.
 Only outputs which are part of the final outputs from the model should be included in this map.

 If child model outputs are altered by this method, QgsProcessingModelAlgorithm.updateDestinationParameters()
 must be called on the parent model.

.. seealso:: modelOutputs()
%End

        QVariant toVariant() const;
%Docstring
 Saves this child to a QVariant.
.. seealso:: loadVariant()
 :rtype: QVariant
%End

        bool loadVariant( const QVariant &child );
%Docstring
 Loads this child from a QVariant.
.. seealso:: toVariant()
 :rtype: bool
%End

    };

    QgsProcessingModelAlgorithm( const QString &name = QString(), const QString &group = QString() );
%Docstring
 Constructor for QgsProcessingModelAlgorithm.
%End

    virtual QString name() const;

    virtual QString displayName() const;

    virtual QString group() const;

    virtual QIcon icon() const;

    virtual QString svgIconPath() const;

    virtual QString shortHelpString() const;

    virtual QString helpUrl() const;


    virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const;

    virtual QString asPythonCommand( const QVariantMap &parameters, QgsProcessingContext &context ) const;


    void setName( const QString &name );
%Docstring
 Sets the model ``name``.
.. seealso:: name()
%End

    void setGroup( const QString &group );
%Docstring
 Sets the model ``group``.
.. seealso:: group()
%End

    QMap<QString, QgsProcessingModelAlgorithm::ChildAlgorithm> childAlgorithms() const;
%Docstring
 Returns the map of child algorithms contained in the model. The keys
 are the child algorithm ids (see QgsProcessingModelAlgorithm.ChildAlgorithm.childId()).
.. seealso:: childAlgorithm()
.. seealso:: setChildAlgorithms()
.. seealso:: addChildAlgorithm()
 :rtype: QMap<str, QgsProcessingModelAlgorithm.ChildAlgorithm>
%End

    void setChildAlgorithms( const QMap<QString, QgsProcessingModelAlgorithm::ChildAlgorithm> &childAlgorithms );
%Docstring
 Sets the map of child algorithms contained in the model. The keys
 are the child algorithm ids (see QgsProcessingModelAlgorithm.ChildAlgorithm.childId()).
 All existing child algorithms will be replaced.
.. seealso:: childAlgorithms()
.. seealso:: childAlgorithm()
.. seealso:: setChildAlgorithm()
.. seealso:: addChildAlgorithm()
%End

    void setChildAlgorithm( const QgsProcessingModelAlgorithm::ChildAlgorithm &algorithm );
%Docstring
 Sets the child ``algorithm`` within the model. If a child algorithm already
 exists in the model with the same child ID then that algorithm will be replaced.
.. seealso:: addChildAlgorithm()
.. seealso:: setChildAlgorithms()
%End

    QString addChildAlgorithm( QgsProcessingModelAlgorithm::ChildAlgorithm &algorithm );
%Docstring
 Adds a new child ``algorithm`` to the model. If a child algorithm already exists
 in the model with the same child ID then ``algorithm`` will be assigned a new
 autogenerated unique ID.
 The assigned child ID will be returned.
.. seealso:: childAlgorithms()
.. seealso:: childAlgorithm()
.. seealso:: setChildAlgorithm()
.. seealso:: setChildAlgorithms()
 :rtype: str
%End

    QgsProcessingModelAlgorithm::ChildAlgorithm &childAlgorithm( const QString &id );
%Docstring
 Returns the child algorithm with matching ``id``. If no child algorithm exists with
 this ID a new algorithm will be added to the model and returned.
.. seealso:: addChildAlgorithm()
.. seealso:: childAlgorithms()
 :rtype: QgsProcessingModelAlgorithm.ChildAlgorithm
%End

    bool removeChildAlgorithm( const QString &id );
%Docstring
 Attempts to remove the child algorithm with matching ``id``.
 Returns true if the algorithm could be removed, or false
 if the algorithm could not be removed (e.g. due to other
 child algorithms depending on it).
.. seealso:: deactivateChildAlgorithm()
 :rtype: bool
%End

    void deactivateChildAlgorithm( const QString &id );
%Docstring
 Deactivates the child algorithm with matching ``id``.
 All other child algorithms which depend on the child
 algorithm will also be deactivated.
.. seealso:: removeChildAlgorithm()
.. seealso:: activateChildAlgorithm()
%End

    bool activateChildAlgorithm( const QString &id );
%Docstring
 Attempts to activate the child algorithm with matching ``id``.
 If any child algorithms on which the child depends are not active,
 then the child will not be activated and false will be returned.
.. seealso:: deactivateChildAlgorithm()
 :rtype: bool
%End

    QSet< QString > dependentChildAlgorithms( const QString &childId ) const;
%Docstring
 Returns a list of the child algorithm IDs depending on the child
 algorithm with the specified ``childId``.
.. seealso:: dependsOnChildAlgorithms()
 :rtype: set of str
%End

    QSet< QString > dependsOnChildAlgorithms( const QString &childId ) const;
%Docstring
 Returns a list of the child algorithm IDs on which the child
 algorithm with the specified ``childId`` depends upon.
.. seealso:: dependentChildAlgorithms()
 :rtype: set of str
%End

    void addModelParameter( QgsProcessingParameterDefinition *definition /Transfer/, const QgsProcessingModelAlgorithm::ModelParameter &component );
%Docstring
 Adds a new parameter to the model, with the specified ``definition`` and graphical ``component``.
 Ownership of ``definition`` is transferred to the model.
.. seealso:: updateModelParameter()
.. seealso:: removeModelParameter()
%End

    void updateModelParameter( QgsProcessingParameterDefinition *definition /Transfer/ );
%Docstring
 Replaces the definition of an existing parameter (by parameter name) with a new ``definition``. Ownership of
 ``definition`` is transferred to the model, and any existing parameter is deleted.
.. seealso:: addModelParameter()
.. seealso:: removeModelParameter()
%End

    void removeModelParameter( const QString &name );
%Docstring
 Removes an existing model parameter by ``name``. The definition of the matching parameter
 is deleted.
.. seealso:: addModelParameter()
.. seealso:: updateModelParameter()
%End

    bool childAlgorithmsDependOnParameter( const QString &name ) const;
%Docstring
 Returns true if any child algorithms depend on the model parameter
 with the specified ``name``.
 :rtype: bool
%End

    QMap<QString, QgsProcessingModelAlgorithm::ModelParameter> parameterComponents() const;
%Docstring
 Returns the map of parameter components used by the model. The keys
 should match the algorithm's parameter names (see parameterDefinitions() ).
.. seealso:: setParameterComponent()
.. seealso:: parameterComponent()
 :rtype: QMap<str, QgsProcessingModelAlgorithm.ModelParameter>
%End

    void setParameterComponents( const QMap<QString, QgsProcessingModelAlgorithm::ModelParameter> &parameterComponents );
%Docstring
 Sets the map of parameter components used by the model. The keys
 should match the algorithm's parameter names (see parameterDefinitions() ).
 All existing parameter components will be replaced.
.. seealso:: parameterComponents()
.. seealso:: setParameterComponent()
.. seealso:: parameterComponent()
%End

    void setParameterComponent( const QgsProcessingModelAlgorithm::ModelParameter &component );
%Docstring
 Sets a parameter ``component`` for the model. If a parameter component already
 exists in the model with the same parameter name then that component will be replaced.
.. seealso:: parameterComponents()
.. seealso:: setParameterComponents()
.. seealso:: parameterComponent()
%End

    QgsProcessingModelAlgorithm::ModelParameter &parameterComponent( const QString &name );
%Docstring
 Returns the parameter component with matching ``name``. If no parameter component exists with
 this name a new component will be added to the model and returned.
.. seealso:: parameterComponents()
.. seealso:: setParameterComponents()
.. seealso:: setParameterComponent()
 :rtype: QgsProcessingModelAlgorithm.ModelParameter
%End

    void updateDestinationParameters();
%Docstring
 Updates the model's parameter definitions to include all relevant destination
 parameters as required by child algorithm ModelOutputs.
 Must be called whenever child algorithm ModelOutputs are altered.
%End

    bool toFile( const QString &path ) const;
%Docstring
 Writes the model to a file, at the specified ``path``.
.. seealso:: fromFile()
 :rtype: bool
%End

    bool fromFile( const QString &path );
%Docstring
 Reads the model from a file, at the specified ``path``.
.. seealso:: toFile()
 :rtype: bool
%End

    QVariantMap &helpContent();
%Docstring
 Returns the model's help contents (a free-form map of values describing the algorithm's
 use and metadata).
.. seealso:: setHelpContent()
 :rtype: QVariantMap
%End


    void setHelpContent( const QVariantMap &contents );
%Docstring
 Sets the model's help ``contents`` (a free-form map of values describing the algorithm's
 use and metadata).
.. seealso:: helpContent()
%End

    QString sourceFilePath() const;
%Docstring
 Returns the source file path for the model, if available.
.. seealso:: setSourceFilePath()
 :rtype: str
%End

    void setSourceFilePath( const QString &path );
%Docstring
 Sets the source file ``path`` for the model, if available.
.. seealso:: sourceFilePath()
%End

  protected:

     virtual QVariantMap processAlgorithm( const QVariantMap &parameters,
                                  QgsProcessingContext &context, QgsProcessingFeedback *feedback ) const;

};



/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/processing/qgsprocessingmodelalgorithm.h                    *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 ************************************************************************/