##// END OF EJS Templates
Enables the registration of a data source in the controller
Alexandre Leroux -
r36:cc066d743ead
parent child
Show More
@@ -3,18 +3,18
3
3
4 #include <QLoggingCategory>
4 #include <QLoggingCategory>
5 #include <QObject>
5 #include <QObject>
6 #include <QUuid>
6
7
7 #include <Common/spimpl.h>
8 #include <Common/spimpl.h>
8
9
9 Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController)
10 Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController)
10
11
11 /**
12 /**
12 * @brief The DataSourceController class aims to make the link between SciQlop
13 * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This
13 * and its plugins. This is the intermediate class that SciQlop have to use
14 * is the intermediate class that SciQlop has to use in the way to connect a data source. Please
14 * in the way to connect a data source. Please first use load method to intialize
15 * first use register method to initialize a plugin specified by its metadata name (JSON plugin
15 * a plugin specified by its metadata name (JSON plugin source) then others specifics
16 * source) then others specifics method will be able to access it. You can load a data source driver
16 * method will ba able to access it.
17 * plugin then create a data source.
17 * You can load a data source driver plugin then create a data source.
18 */
18 */
19 class DataSourceController : public QObject {
19 class DataSourceController : public QObject {
20 Q_OBJECT
20 Q_OBJECT
@@ -22,6 +22,14 public:
22 explicit DataSourceController(QObject *parent = 0);
22 explicit DataSourceController(QObject *parent = 0);
23 virtual ~DataSourceController();
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 public slots:
33 public slots:
26 /// Manage init/end of the controller
34 /// Manage init/end of the controller
27 void initialize();
35 void initialize();
@@ -11,6 +11,7 Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController")
11 class DataSourceController::DataSourceControllerPrivate {
11 class DataSourceController::DataSourceControllerPrivate {
12 public:
12 public:
13 QMutex m_WorkingMutex;
13 QMutex m_WorkingMutex;
14 QHash<QUuid, QString> m_DataSources;
14 };
15 };
15
16
16 DataSourceController::DataSourceController(QObject *parent)
17 DataSourceController::DataSourceController(QObject *parent)
@@ -27,6 +28,14 DataSourceController::~DataSourceController()
27 this->waitForFinish();
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 void DataSourceController::initialize()
39 void DataSourceController::initialize()
31 {
40 {
32 qCDebug(LOG_DataSourceController())
41 qCDebug(LOG_DataSourceController())
General Comments 0
You need to be logged in to leave comments. Login now