@@ -3,18 +3,18 | |||
|
3 | 3 | |
|
4 | 4 | #include <QLoggingCategory> |
|
5 | 5 | #include <QObject> |
|
6 | #include <QUuid> | |
|
6 | 7 | |
|
7 | 8 | #include <Common/spimpl.h> |
|
8 | 9 | |
|
9 | 10 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) |
|
10 | 11 | |
|
11 | 12 | /** |
|
12 | * @brief The DataSourceController class aims to make the link between SciQlop | |
|
13 | * and its plugins. This is the intermediate class that SciQlop have to use | |
|
14 | * in the way to connect a data source. Please first use load method to intialize | |
|
15 | * a plugin specified by its metadata name (JSON plugin source) then others specifics | |
|
16 | * method will ba able to access it. | |
|
17 | * You can load a data source driver plugin then create a data source. | |
|
13 | * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This | |
|
14 | * is the intermediate class that SciQlop has to use in the way to connect a data source. Please | |
|
15 | * first use register method to initialize a plugin specified by its metadata name (JSON plugin | |
|
16 | * source) then others specifics method will be able to access it. You can load a data source driver | |
|
17 | * plugin then create a data source. | |
|
18 | 18 | */ |
|
19 | 19 | class DataSourceController : public QObject { |
|
20 | 20 | Q_OBJECT |
@@ -22,6 +22,14 public: | |||
|
22 | 22 | explicit DataSourceController(QObject *parent = 0); |
|
23 | 23 | virtual ~DataSourceController(); |
|
24 | 24 | |
|
25 | /** | |
|
26 | * Registers a data source. The method delivers a unique id that can be used afterwards to | |
|
27 | * access to the data source properties (structure, connection parameters, data provider, etc.) | |
|
28 | * @param dataSourceName the name of the data source | |
|
29 | * @return the unique id with which the data source has been registered | |
|
30 | */ | |
|
31 | QUuid registerDataSource(const QString &dataSourceName) noexcept; | |
|
32 | ||
|
25 | 33 | public slots: |
|
26 | 34 | /// Manage init/end of the controller |
|
27 | 35 | void initialize(); |
@@ -11,6 +11,7 Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController") | |||
|
11 | 11 | class DataSourceController::DataSourceControllerPrivate { |
|
12 | 12 | public: |
|
13 | 13 | QMutex m_WorkingMutex; |
|
14 | QHash<QUuid, QString> m_DataSources; | |
|
14 | 15 | }; |
|
15 | 16 | |
|
16 | 17 | DataSourceController::DataSourceController(QObject *parent) |
@@ -27,6 +28,14 DataSourceController::~DataSourceController() | |||
|
27 | 28 | this->waitForFinish(); |
|
28 | 29 | } |
|
29 | 30 | |
|
31 | QUuid DataSourceController::registerDataSource(const QString &dataSourceName) noexcept | |
|
32 | { | |
|
33 | auto dataSourceUid = QUuid::createUuid(); | |
|
34 | impl->m_DataSources.insert(dataSourceUid, dataSourceName); | |
|
35 | ||
|
36 | return dataSourceUid; | |
|
37 | } | |
|
38 | ||
|
30 | 39 | void DataSourceController::initialize() |
|
31 | 40 | { |
|
32 | 41 | qCDebug(LOG_DataSourceController()) |
General Comments 0
You need to be logged in to leave comments.
Login now