diff --git a/core/include/Variable/VariableController.h b/core/include/Variable/VariableController.h index 02bc847..a821b05 100644 --- a/core/include/Variable/VariableController.h +++ b/core/include/Variable/VariableController.h @@ -30,6 +30,20 @@ public: void setTimeController(TimeController *timeController) noexcept; + /** + * Deletes from the controller the variable passed in parameter. + * + * + * @param variable the variable to delete from the controller. + */ + void deleteVariable(std::shared_ptr variable) noexcept; + + /** + * Deletes from the controller the variables passed in parameter. + * @param variables the variables to delete from the controller. + * @sa deleteVariable() + */ + void deleteVariables(const QVector > &variables) noexcept; signals: /// Signal emitted when a variable has been created diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index 0ac0a8b..4c6b3dc 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -82,6 +82,24 @@ void VariableController::setTimeController(TimeController *timeController) noexc impl->m_TimeController = timeController; } +void VariableController::deleteVariable(std::shared_ptr variable) noexcept +{ + if (!variable) { + qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null"; + return; + } + + /// @todo ALX + + +void VariableController::deleteVariables( + const QVector > &variables) noexcept +{ + for (auto variable : qAsConst(variables)) { + deleteVariable(variable); + } +} + void VariableController::createVariable(const QString &name, std::shared_ptr provider) noexcept {