diff --git a/core/include/DataSource/DataSourceController.h b/core/include/DataSource/DataSourceController.h index b889390..4393814 100644 --- a/core/include/DataSource/DataSourceController.h +++ b/core/include/DataSource/DataSourceController.h @@ -3,18 +3,18 @@ #include #include +#include #include Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) /** - * @brief The DataSourceController class aims to make the link between SciQlop - * and its plugins. This is the intermediate class that SciQlop have to use - * in the way to connect a data source. Please first use load method to intialize - * a plugin specified by its metadata name (JSON plugin source) then others specifics - * method will ba able to access it. - * You can load a data source driver plugin then create a data source. + * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This + * is the intermediate class that SciQlop has to use in the way to connect a data source. Please + * first use register method to initialize a plugin specified by its metadata name (JSON plugin + * source) then others specifics method will be able to access it. You can load a data source driver + * plugin then create a data source. */ class DataSourceController : public QObject { Q_OBJECT @@ -22,6 +22,14 @@ public: explicit DataSourceController(QObject *parent = 0); virtual ~DataSourceController(); + /** + * Registers a data source. The method delivers a unique id that can be used afterwards to + * access to the data source properties (structure, connection parameters, data provider, etc.) + * @param dataSourceName the name of the data source + * @return the unique id with which the data source has been registered + */ + QUuid registerDataSource(const QString &dataSourceName) noexcept; + public slots: /// Manage init/end of the controller void initialize(); diff --git a/core/src/DataSource/DataSourceController.cpp b/core/src/DataSource/DataSourceController.cpp index cdb58a1..b4af453 100644 --- a/core/src/DataSource/DataSourceController.cpp +++ b/core/src/DataSource/DataSourceController.cpp @@ -11,6 +11,7 @@ Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController") class DataSourceController::DataSourceControllerPrivate { public: QMutex m_WorkingMutex; + QHash m_DataSources; }; DataSourceController::DataSourceController(QObject *parent) @@ -27,6 +28,14 @@ DataSourceController::~DataSourceController() this->waitForFinish(); } +QUuid DataSourceController::registerDataSource(const QString &dataSourceName) noexcept +{ + auto dataSourceUid = QUuid::createUuid(); + impl->m_DataSources.insert(dataSourceUid, dataSourceName); + + return dataSourceUid; +} + void DataSourceController::initialize() { qCDebug(LOG_DataSourceController())