diff --git a/core/include/Variable/VariableController.h b/core/include/Variable/VariableController.h index 5c51817..0ec574b 100644 --- a/core/include/Variable/VariableController.h +++ b/core/include/Variable/VariableController.h @@ -6,6 +6,7 @@ #include +class Variable; Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) /** @@ -17,6 +18,13 @@ public: explicit VariableController(QObject *parent = 0); virtual ~VariableController(); + /** + * Creates a new variable + * @param name the name of the new variable + * @return the variable if it was created successfully, nullptr otherwise + */ + Variable *createVariable(const QString &name) noexcept; + public slots: void initialize(); void finalize(); diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index 734de3c..bfeefc6 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -7,11 +8,12 @@ Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") struct VariableController::VariableControllerPrivate { explicit VariableControllerPrivate() - : m_WorkingMutex{} + : m_WorkingMutex{}, m_VariableModel{std::make_unique()} { } QMutex m_WorkingMutex; + std::unique_ptr m_VariableModel; }; VariableController::VariableController(QObject *parent) @@ -28,6 +30,11 @@ VariableController::~VariableController() this->waitForFinish(); } +Variable *VariableController::createVariable(const QString &name) noexcept +{ + return impl->m_VariableModel->createVariable(name); +} + void VariableController::initialize() { qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread();