@@ -1,3 +1,5 | |||||
1 | build/ |
|
1 | build/ | |
2 | CMakeLists.txt.user |
|
2 | CMakeLists.txt.user | |
3 | /.project |
|
3 | /.project | |
|
4 | core/src/Version.cpp | |||
|
5 | core/include/Version.h |
@@ -27,8 +27,7 | |||||
27 |
|
27 | |||
28 | int main(int argc, char *argv[]) |
|
28 | int main(int argc, char *argv[]) | |
29 | { |
|
29 | { | |
30 | int ad; |
|
30 | SqpApplication a{argc, argv}; | |
31 | SqpApplication a(argc, argv); |
|
|||
32 | SqpApplication::setOrganizationName("LPP"); |
|
31 | SqpApplication::setOrganizationName("LPP"); | |
33 | SqpApplication::setOrganizationDomain("lpp.fr"); |
|
32 | SqpApplication::setOrganizationDomain("lpp.fr"); | |
34 | SqpApplication::setApplicationName("SciQLop"); |
|
33 | SqpApplication::setApplicationName("SciQLop"); |
@@ -89,8 +89,9 using default_copier_t = typename default_copier<T>::type; | |||||
89 |
|
89 | |||
90 | template <class T, class D, class C> |
|
90 | template <class T, class D, class C> | |
91 | struct is_default_manageable |
|
91 | struct is_default_manageable | |
92 |
: public std::integral_constant<bool, |
|
92 | : public std::integral_constant<bool, | |
93 |
|
|
93 | std::is_same<D, default_deleter_t<T> >::value | |
|
94 | && std::is_same<C, default_copier_t<T> >::value> { | |||
94 | }; |
|
95 | }; | |
95 | } |
|
96 | } | |
96 |
|
97 | |||
@@ -131,10 +132,11 public: | |||||
131 | } |
|
132 | } | |
132 |
|
133 | |||
133 | template <class U> |
|
134 | template <class U> | |
134 | impl_ptr(U *u, typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
135 | impl_ptr(U *u, | |
135 | && is_default_manageable::value, |
|
136 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |
136 |
|
|
137 | && is_default_manageable::value, | |
137 | = dummy_t_()) SPIMPL_NOEXCEPT |
|
138 | dummy_t_>::type | |
|
139 | = dummy_t_()) SPIMPL_NOEXCEPT | |||
138 | : impl_ptr(u, &details::default_delete<T>, &details::default_copy<T>) |
|
140 | : impl_ptr(u, &details::default_delete<T>, &details::default_copy<T>) | |
139 | { |
|
141 | { | |
140 | } |
|
142 | } | |
@@ -151,12 +153,12 public: | |||||
151 |
|
153 | |||
152 | #ifdef SPIMPL_HAS_AUTO_PTR |
|
154 | #ifdef SPIMPL_HAS_AUTO_PTR | |
153 | template <class U> |
|
155 | template <class U> | |
154 | impl_ptr(std::auto_ptr<U> &&u, typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
156 | impl_ptr(std::auto_ptr<U> &&u, | |
155 | && is_default_manageable::value, |
|
157 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |
156 |
|
|
158 | && is_default_manageable::value, | |
157 |
|
|
159 | dummy_t_>::type | |
158 | : ptr_(u.release(), &details::default_delete<T>), |
|
160 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(u.release(), &details::default_delete<T>), | |
159 | copier_(&details::default_copy<T>) |
|
161 | copier_(&details::default_copy<T>) | |
160 | { |
|
162 | { | |
161 | } |
|
163 | } | |
162 | #endif |
|
164 | #endif |
@@ -1,8 +1,6 | |||||
1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H |
|
1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H | |
2 | #define SCIQLOP_DATASOURCECONTROLLER_H |
|
2 | #define SCIQLOP_DATASOURCECONTROLLER_H | |
3 |
|
3 | |||
4 | #include "DataSourceController.h" |
|
|||
5 |
|
||||
6 | #include <QLoggingCategory> |
|
4 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
5 | #include <QObject> | |
8 |
|
6 |
@@ -1,4 +1,4 | |||||
1 |
#include |
|
1 | #include <DataSource/DataSourceController.h> | |
2 |
|
2 | |||
3 | #include <QMutex> |
|
3 | #include <QMutex> | |
4 | #include <QThread> |
|
4 | #include <QThread> | |
@@ -10,31 +10,29 Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController") | |||||
10 |
|
10 | |||
11 | class DataSourceController::DataSourceControllerPrivate { |
|
11 | class DataSourceController::DataSourceControllerPrivate { | |
12 | public: |
|
12 | public: | |
13 | DataSourceControllerPrivate() {} |
|
|||
14 |
|
||||
15 | QMutex m_WorkingMutex; |
|
13 | QMutex m_WorkingMutex; | |
16 | }; |
|
14 | }; | |
17 |
|
15 | |||
18 | DataSourceController::DataSourceController(QObject *parent) |
|
16 | DataSourceController::DataSourceController(QObject *parent) | |
19 | : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()} |
|
17 | : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()} | |
20 | { |
|
18 | { | |
21 |
qCDebug(LOG_DataSourceController()) |
|
19 | qCDebug(LOG_DataSourceController()) | |
22 | << QThread::currentThread(); |
|
20 | << tr("DataSourceController construction") << QThread::currentThread(); | |
23 | } |
|
21 | } | |
24 |
|
22 | |||
25 | DataSourceController::~DataSourceController() |
|
23 | DataSourceController::~DataSourceController() | |
26 | { |
|
24 | { | |
27 |
qCDebug(LOG_DataSourceController()) |
|
25 | qCDebug(LOG_DataSourceController()) | |
28 | << QThread::currentThread(); |
|
26 | << tr("DataSourceController destruction") << QThread::currentThread(); | |
29 | this->waitForFinish(); |
|
27 | this->waitForFinish(); | |
30 | } |
|
28 | } | |
31 |
|
29 | |||
32 | void DataSourceController::initialize() |
|
30 | void DataSourceController::initialize() | |
33 | { |
|
31 | { | |
34 |
qCDebug(LOG_DataSourceController()) |
|
32 | qCDebug(LOG_DataSourceController()) | |
35 | << QThread::currentThread(); |
|
33 | << tr("DataSourceController init") << QThread::currentThread(); | |
36 | impl->m_WorkingMutex.lock(); |
|
34 | impl->m_WorkingMutex.lock(); | |
37 |
qCDebug(LOG_DataSourceController()) << tr(" |
|
35 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController init END"); | |
38 | } |
|
36 | } | |
39 |
|
37 | |||
40 | void DataSourceController::finalize() |
|
38 | void DataSourceController::finalize() | |
@@ -44,5 +42,5 void DataSourceController::finalize() | |||||
44 |
|
42 | |||
45 | void DataSourceController::waitForFinish() |
|
43 | void DataSourceController::waitForFinish() | |
46 | { |
|
44 | { | |
47 |
QMutexLocker locker |
|
45 | QMutexLocker locker{&impl->m_WorkingMutex}; | |
48 | } |
|
46 | } |
@@ -12,10 +12,10 Q_DECLARE_LOGGING_CATEGORY(LOG_SqpApplication) | |||||
12 |
|
12 | |||
13 | /** |
|
13 | /** | |
14 | * @brief The SqpApplication class aims to make the link between SciQlop |
|
14 | * @brief The SqpApplication class aims to make the link between SciQlop | |
15 |
* and its plugins. This is the intermediate class that SciQlop ha |
|
15 | * and its plugins. This is the intermediate class that SciQlop has to use | |
16 | * in the way to connect a data source. Please first use load method to intialize |
|
16 | * in the way to connect a data source. Please first use load method to initialize | |
17 | * a plugin specified by its metadata name (JSON plugin source) then others specifics |
|
17 | * a plugin specified by its metadata name (JSON plugin source) then others specifics | |
18 |
* method will b |
|
18 | * method will be able to access it. | |
19 | * You can load a data source driver plugin then create a data source. |
|
19 | * You can load a data source driver plugin then create a data source. | |
20 | */ |
|
20 | */ | |
21 |
|
21 |
@@ -7,10 +7,14 Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |||||
7 |
|
7 | |||
8 | class SqpApplication::SqpApplicationPrivate { |
|
8 | class SqpApplication::SqpApplicationPrivate { | |
9 | public: |
|
9 | public: | |
10 | SqpApplicationPrivate() {} |
|
10 | SqpApplicationPrivate() : m_DataSourceController{std::make_unique<DataSourceController>()} | |
|
11 | { | |||
|
12 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |||
|
13 | } | |||
|
14 | ||||
11 | virtual ~SqpApplicationPrivate() |
|
15 | virtual ~SqpApplicationPrivate() | |
12 | { |
|
16 | { | |
13 |
qCInfo(LOG_SqpApplication()) << tr(" |
|
17 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); | |
14 | m_DataSourceControllerThread.quit(); |
|
18 | m_DataSourceControllerThread.quit(); | |
15 | m_DataSourceControllerThread.wait(); |
|
19 | m_DataSourceControllerThread.wait(); | |
16 | } |
|
20 | } | |
@@ -21,12 +25,9 public: | |||||
21 |
|
25 | |||
22 |
|
26 | |||
23 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
27 | SqpApplication::SqpApplication(int &argc, char **argv) | |
24 |
: QApplication |
|
28 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |
25 | { |
|
29 | { | |
26 |
qCInfo(LOG_SqpApplication()) << tr(" |
|
30 | qCInfo(LOG_SqpApplication()) << tr("SqpApplication construction"); | |
27 |
|
||||
28 | impl->m_DataSourceController = std::make_unique<DataSourceController>(); |
|
|||
29 | impl->m_DataSourceController->moveToThread(&impl->m_DataSourceControllerThread); |
|
|||
30 |
|
31 | |||
31 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
32 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |
32 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
33 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
General Comments 0
You need to be logged in to leave comments.
Login now