@@ -0,0 +1,12 | |||||
|
1 | #ifndef SCIQLOP_COREGLOBAL_H | |||
|
2 | #define SCIQLOP_COREGLOBAL_H | |||
|
3 | ||||
|
4 | #include <QtCore/QtGlobal> | |||
|
5 | ||||
|
6 | #ifdef CORE_LIB | |||
|
7 | #define SCIQLOP_CORE_EXPORT Q_DECL_EXPORT | |||
|
8 | #else | |||
|
9 | #define SCIQLOP_CORE_EXPORT Q_DECL_IMPORT | |||
|
10 | #endif | |||
|
11 | ||||
|
12 | #endif // SCIQLOP_COREGLOBAL_H |
@@ -1,153 +1,156 | |||||
1 |
|
1 | |||
2 | ## core - CMakeLists.txt |
|
2 | ## core - CMakeLists.txt | |
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) | |
4 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") |
|
4 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") | |
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") |
|
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") | |
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") |
|
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") | |
7 |
|
7 | |||
8 | # Include core directory |
|
8 | # Include core directory | |
9 | include_directories("${INCLUDES_DIR}") |
|
9 | include_directories("${INCLUDES_DIR}") | |
10 |
|
10 | |||
11 | # Set a variable to display a warning in the version files. |
|
11 | # Set a variable to display a warning in the version files. | |
12 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
12 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") | |
13 | # Generate the version file from the cmake version variables. The version |
|
13 | # Generate the version file from the cmake version variables. The version | |
14 | # variables are defined in the cmake/sciqlop_version.cmake file. |
|
14 | # variables are defined in the cmake/sciqlop_version.cmake file. | |
15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" |
|
15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" | |
16 | "${INCLUDES_DIR}/Version.h") |
|
16 | "${INCLUDES_DIR}/Version.h") | |
17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" |
|
17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" | |
18 | "${SOURCES_DIR}/Version.cpp") |
|
18 | "${SOURCES_DIR}/Version.cpp") | |
19 |
|
19 | |||
20 | # Find dependent modules |
|
20 | # Find dependent modules | |
21 | find_package(sciqlop-plugin) |
|
21 | find_package(sciqlop-plugin) | |
22 | INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR}) |
|
22 | INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR}) | |
23 |
|
23 | |||
24 | # |
|
24 | # | |
25 | # Find Qt modules |
|
25 | # Find Qt modules | |
26 | # |
|
26 | # | |
27 | SCIQLOP_FIND_QT(Core Network) |
|
27 | SCIQLOP_FIND_QT(Core Network) | |
28 |
|
28 | |||
29 | # |
|
29 | # | |
30 | # Compile the library library |
|
30 | # Compile the library library | |
31 | # |
|
31 | # | |
|
32 | ||||
|
33 | ADD_DEFINITIONS(-DCORE_LIB) | |||
|
34 | ||||
32 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
35 | FILE (GLOB_RECURSE MODULE_SOURCES | |
33 | ${INCLUDES_DIR}/*.h |
|
36 | ${INCLUDES_DIR}/*.h | |
34 | ${SOURCES_DIR}/*.c |
|
37 | ${SOURCES_DIR}/*.c | |
35 | ${SOURCES_DIR}/*.cpp |
|
38 | ${SOURCES_DIR}/*.cpp | |
36 | ${SOURCES_DIR}/*.h) |
|
39 | ${SOURCES_DIR}/*.h) | |
37 |
|
40 | |||
38 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) |
|
41 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) | |
39 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
42 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) | |
40 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
43 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) | |
41 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) |
|
44 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) | |
42 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network) |
|
45 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network) | |
43 |
|
46 | |||
44 | INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME} |
|
47 | INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME} | |
45 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
48 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} | |
46 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
|
49 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | |
47 | ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} |
|
50 | ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} | |
48 | ) |
|
51 | ) | |
49 |
|
52 | |||
50 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
53 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html | |
51 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
54 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. | |
52 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
55 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets | |
53 | IF(BUILD_SHARED_LIBS) |
|
56 | IF(BUILD_SHARED_LIBS) | |
54 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
57 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") | |
55 | ELSE() |
|
58 | ELSE() | |
56 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
59 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") | |
57 | ENDIF() |
|
60 | ENDIF() | |
58 |
|
61 | |||
59 | # Set the variable to parent scope so that the other projects can copy the |
|
62 | # Set the variable to parent scope so that the other projects can copy the | |
60 | # dependent shared libraries |
|
63 | # dependent shared libraries | |
61 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) |
|
64 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) | |
62 |
|
65 | |||
63 | # Copy extern shared libraries to the lib folder |
|
66 | # Copy extern shared libraries to the lib folder | |
64 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) |
|
67 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) | |
65 |
|
68 | |||
66 | # Add the files to the list of files to be analyzed |
|
69 | # Add the files to the list of files to be analyzed | |
67 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
70 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) | |
68 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
71 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) | |
69 | # Vera++ exclusion files |
|
72 | # Vera++ exclusion files | |
70 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
73 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) | |
71 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
74 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) | |
72 |
|
75 | |||
73 | # |
|
76 | # | |
74 | # Compile the tests |
|
77 | # Compile the tests | |
75 | # |
|
78 | # | |
76 | IF(BUILD_TESTS) |
|
79 | IF(BUILD_TESTS) | |
77 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
80 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) | |
78 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
81 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) | |
79 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
82 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) | |
80 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
83 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) | |
81 |
|
84 | |||
82 | SET(TARGETS_COV) |
|
85 | SET(TARGETS_COV) | |
83 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
86 | FOREACH( testFile ${TESTS_SOURCES} ) | |
84 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
87 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) | |
85 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
88 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) | |
86 |
|
89 | |||
87 | # Add to the list of sources files all the sources in the same |
|
90 | # Add to the list of sources files all the sources in the same | |
88 | # directory that aren't another test |
|
91 | # directory that aren't another test | |
89 | FILE (GLOB currentTestSources |
|
92 | FILE (GLOB currentTestSources | |
90 | ${testDirectory}/*.c |
|
93 | ${testDirectory}/*.c | |
91 | ${testDirectory}/*.cpp |
|
94 | ${testDirectory}/*.cpp | |
92 | ${testDirectory}/*.h) |
|
95 | ${testDirectory}/*.h) | |
93 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
96 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) | |
94 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
97 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) | |
95 |
|
98 | |||
96 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
99 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) | |
97 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
100 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) | |
98 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
101 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) | |
99 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) |
|
102 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) | |
100 | qt5_use_modules(${testName} Test) |
|
103 | qt5_use_modules(${testName} Test) | |
101 |
|
104 | |||
102 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
105 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) | |
103 |
|
106 | |||
104 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
107 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) | |
105 | set(Coverage_NAME ${testName}) |
|
108 | set(Coverage_NAME ${testName}) | |
106 | if(UNIX) |
|
109 | if(UNIX) | |
107 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) |
|
110 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) | |
108 | LIST( APPEND TARGETS_COV ${testName}_coverage) |
|
111 | LIST( APPEND TARGETS_COV ${testName}_coverage) | |
109 | endif(UNIX) |
|
112 | endif(UNIX) | |
110 |
|
113 | |||
111 | ENDFOREACH( testFile ) |
|
114 | ENDFOREACH( testFile ) | |
112 |
|
115 | |||
113 | add_custom_target(coverage) |
|
116 | add_custom_target(coverage) | |
114 |
|
117 | |||
115 | FOREACH( target_cov ${TARGETS_COV} ) |
|
118 | FOREACH( target_cov ${TARGETS_COV} ) | |
116 | add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov}) |
|
119 | add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov}) | |
117 | ENDFOREACH( target_cov ) |
|
120 | ENDFOREACH( target_cov ) | |
118 |
|
121 | |||
119 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
122 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) | |
120 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
123 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) | |
121 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
124 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) | |
122 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
125 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
123 | ENDIF(BUILD_TESTS) |
|
126 | ENDIF(BUILD_TESTS) | |
124 |
|
127 | |||
125 | # |
|
128 | # | |
126 | # Set the files that must be formatted by clang-format. |
|
129 | # Set the files that must be formatted by clang-format. | |
127 | # |
|
130 | # | |
128 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
131 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) | |
129 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
132 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
130 |
|
133 | |||
131 | # |
|
134 | # | |
132 | # Set the directories that doxygen must browse to generate the |
|
135 | # Set the directories that doxygen must browse to generate the | |
133 | # documentation. |
|
136 | # documentation. | |
134 | # |
|
137 | # | |
135 | # Source directories: |
|
138 | # Source directories: | |
136 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
139 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") | |
137 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
140 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
138 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
141 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) | |
139 | # Source directories to exclude from the documentation generation |
|
142 | # Source directories to exclude from the documentation generation | |
140 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
143 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") | |
141 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
144 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) | |
142 |
|
145 | |||
143 | # |
|
146 | # | |
144 | # Set the directories with the sources to analyze and propagate the |
|
147 | # Set the directories with the sources to analyze and propagate the | |
145 | # modification to the parent scope |
|
148 | # modification to the parent scope | |
146 | # |
|
149 | # | |
147 | # Source directories to analyze: |
|
150 | # Source directories to analyze: | |
148 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
151 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
149 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
152 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") | |
150 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
153 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) | |
151 | # Source directories to exclude from the analysis |
|
154 | # Source directories to exclude from the analysis | |
152 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
155 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") | |
153 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
156 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
@@ -1,72 +1,74 | |||||
1 | #ifndef SCIQLOP_IDATAPROVIDER_H |
|
1 | #ifndef SCIQLOP_IDATAPROVIDER_H | |
2 | #define SCIQLOP_IDATAPROVIDER_H |
|
2 | #define SCIQLOP_IDATAPROVIDER_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <memory> |
|
6 | #include <memory> | |
5 |
|
7 | |||
6 | #include <QObject> |
|
8 | #include <QObject> | |
7 | #include <QUuid> |
|
9 | #include <QUuid> | |
8 |
|
10 | |||
9 | #include <Common/MetaTypes.h> |
|
11 | #include <Common/MetaTypes.h> | |
10 |
|
12 | |||
11 | #include <Data/SqpDateTime.h> |
|
13 | #include <Data/SqpDateTime.h> | |
12 |
|
14 | |||
13 | #include <functional> |
|
15 | #include <functional> | |
14 |
|
16 | |||
15 | class DataProviderParameters; |
|
17 | class DataProviderParameters; | |
16 | class IDataSeries; |
|
18 | class IDataSeries; | |
17 | class QNetworkReply; |
|
19 | class QNetworkReply; | |
18 | class QNetworkRequest; |
|
20 | class QNetworkRequest; | |
19 |
|
21 | |||
20 | /** |
|
22 | /** | |
21 | * @brief The IDataProvider interface aims to declare a data provider. |
|
23 | * @brief The IDataProvider interface aims to declare a data provider. | |
22 | * |
|
24 | * | |
23 | * A data provider is an entity that generates data and returns it according to various parameters |
|
25 | * A data provider is an entity that generates data and returns it according to various parameters | |
24 | * (time interval, product to retrieve the data, etc.) |
|
26 | * (time interval, product to retrieve the data, etc.) | |
25 | * |
|
27 | * | |
26 | * @sa IDataSeries |
|
28 | * @sa IDataSeries | |
27 | */ |
|
29 | */ | |
28 | class IDataProvider : public QObject { |
|
30 | class SCIQLOP_CORE_EXPORT IDataProvider : public QObject { | |
29 |
|
31 | |||
30 | Q_OBJECT |
|
32 | Q_OBJECT | |
31 | public: |
|
33 | public: | |
32 | virtual ~IDataProvider() noexcept = default; |
|
34 | virtual ~IDataProvider() noexcept = default; | |
33 |
|
35 | |||
34 | /** |
|
36 | /** | |
35 | * @brief requestDataLoading provide datas for the data identified by identifier and parameters |
|
37 | * @brief requestDataLoading provide datas for the data identified by identifier and parameters | |
36 | */ |
|
38 | */ | |
37 | virtual void requestDataLoading(QUuid identifier, const DataProviderParameters ¶meters) = 0; |
|
39 | virtual void requestDataLoading(QUuid identifier, const DataProviderParameters ¶meters) = 0; | |
38 |
|
40 | |||
39 | /** |
|
41 | /** | |
40 | * @brief requestDataAborting stop data loading of the data identified by identifier |
|
42 | * @brief requestDataAborting stop data loading of the data identified by identifier | |
41 | */ |
|
43 | */ | |
42 | virtual void requestDataAborting(QUuid identifier) = 0; |
|
44 | virtual void requestDataAborting(QUuid identifier) = 0; | |
43 |
|
45 | |||
44 | signals: |
|
46 | signals: | |
45 | /** |
|
47 | /** | |
46 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data |
|
48 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data | |
47 | * identified by identifier |
|
49 | * identified by identifier | |
48 | */ |
|
50 | */ | |
49 | void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie, |
|
51 | void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie, | |
50 | const SqpDateTime &dateTime); |
|
52 | const SqpDateTime &dateTime); | |
51 |
|
53 | |||
52 | /** |
|
54 | /** | |
53 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data |
|
55 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data | |
54 | * identified by identifier |
|
56 | * identified by identifier | |
55 | */ |
|
57 | */ | |
56 | void dataProvidedProgress(QUuid identifier, double progress); |
|
58 | void dataProvidedProgress(QUuid identifier, double progress); | |
57 |
|
59 | |||
58 |
|
60 | |||
59 | /** |
|
61 | /** | |
60 | * @brief requestConstructed send a request for the data identified by identifier |
|
62 | * @brief requestConstructed send a request for the data identified by identifier | |
61 | * @callback is the methode call by the reply of the request when it is finished. |
|
63 | * @callback is the methode call by the reply of the request when it is finished. | |
62 | */ |
|
64 | */ | |
63 | void requestConstructed(const QNetworkRequest &request, QUuid identifier, |
|
65 | void requestConstructed(const QNetworkRequest &request, QUuid identifier, | |
64 | std::function<void(QNetworkReply *, QUuid)> callback); |
|
66 | std::function<void(QNetworkReply *, QUuid)> callback); | |
65 | }; |
|
67 | }; | |
66 |
|
68 | |||
67 | // Required for using shared_ptr in signals/slots |
|
69 | // Required for using shared_ptr in signals/slots | |
68 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>) |
|
70 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>) | |
69 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY, |
|
71 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY, | |
70 | std::function<void(QNetworkReply *, QUuid)>) |
|
72 | std::function<void(QNetworkReply *, QUuid)>) | |
71 |
|
73 | |||
72 | #endif // SCIQLOP_IDATAPROVIDER_H |
|
74 | #endif // SCIQLOP_IDATAPROVIDER_H |
@@ -1,23 +1,25 | |||||
1 | #ifndef SCIQLOP_SCALARSERIES_H |
|
1 | #ifndef SCIQLOP_SCALARSERIES_H | |
2 | #define SCIQLOP_SCALARSERIES_H |
|
2 | #define SCIQLOP_SCALARSERIES_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <Data/DataSeries.h> |
|
6 | #include <Data/DataSeries.h> | |
5 |
|
7 | |||
6 | /** |
|
8 | /** | |
7 | * @brief The ScalarSeries class is the implementation for a data series representing a scalar. |
|
9 | * @brief The ScalarSeries class is the implementation for a data series representing a scalar. | |
8 | */ |
|
10 | */ | |
9 | class ScalarSeries : public DataSeries<1> { |
|
11 | class SCIQLOP_CORE_EXPORT ScalarSeries : public DataSeries<1> { | |
10 | public: |
|
12 | public: | |
11 | /** |
|
13 | /** | |
12 | * Ctor with two vectors. The vectors must have the same size, otherwise a ScalarSeries with no |
|
14 | * Ctor with two vectors. The vectors must have the same size, otherwise a ScalarSeries with no | |
13 | * values will be created. |
|
15 | * values will be created. | |
14 | * @param xAxisData x-axis data |
|
16 | * @param xAxisData x-axis data | |
15 | * @param valuesData values data |
|
17 | * @param valuesData values data | |
16 | */ |
|
18 | */ | |
17 | explicit ScalarSeries(QVector<double> xAxisData, QVector<double> valuesData, |
|
19 | explicit ScalarSeries(QVector<double> xAxisData, QVector<double> valuesData, | |
18 | const Unit &xAxisUnit, const Unit &valuesUnit); |
|
20 | const Unit &xAxisUnit, const Unit &valuesUnit); | |
19 |
|
21 | |||
20 | std::unique_ptr<IDataSeries> clone() const; |
|
22 | std::unique_ptr<IDataSeries> clone() const; | |
21 | }; |
|
23 | }; | |
22 |
|
24 | |||
23 | #endif // SCIQLOP_SCALARSERIES_H |
|
25 | #endif // SCIQLOP_SCALARSERIES_H |
@@ -1,92 +1,94 | |||||
1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H |
|
1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H | |
2 | #define SCIQLOP_DATASOURCECONTROLLER_H |
|
2 | #define SCIQLOP_DATASOURCECONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
5 | #include <QObject> |
|
7 | #include <QObject> | |
6 | #include <QUuid> |
|
8 | #include <QUuid> | |
7 |
|
9 | |||
8 | #include <Common/spimpl.h> |
|
10 | #include <Common/spimpl.h> | |
9 |
|
11 | |||
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) |
|
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) | |
11 |
|
13 | |||
12 | class DataSourceItem; |
|
14 | class DataSourceItem; | |
13 | class IDataProvider; |
|
15 | class IDataProvider; | |
14 |
|
16 | |||
15 | /** |
|
17 | /** | |
16 | * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This |
|
18 | * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This | |
17 | * is the intermediate class that SciQlop has to use in the way to connect a data source. Please |
|
19 | * is the intermediate class that SciQlop has to use in the way to connect a data source. Please | |
18 | * first use register method to initialize a plugin specified by its metadata name (JSON plugin |
|
20 | * first use register method to initialize a plugin specified by its metadata name (JSON plugin | |
19 | * source) then others specifics method will be able to access it. You can load a data source driver |
|
21 | * source) then others specifics method will be able to access it. You can load a data source driver | |
20 | * plugin then create a data source. |
|
22 | * plugin then create a data source. | |
21 | */ |
|
23 | */ | |
22 | class DataSourceController : public QObject { |
|
24 | class SCIQLOP_CORE_EXPORT DataSourceController : public QObject { | |
23 | Q_OBJECT |
|
25 | Q_OBJECT | |
24 | public: |
|
26 | public: | |
25 | explicit DataSourceController(QObject *parent = 0); |
|
27 | explicit DataSourceController(QObject *parent = 0); | |
26 | virtual ~DataSourceController(); |
|
28 | virtual ~DataSourceController(); | |
27 |
|
29 | |||
28 | /** |
|
30 | /** | |
29 | * Registers a data source. The method delivers a unique id that can be used afterwards to |
|
31 | * Registers a data source. The method delivers a unique id that can be used afterwards to | |
30 | * access to the data source properties (structure, connection parameters, data provider, etc.) |
|
32 | * access to the data source properties (structure, connection parameters, data provider, etc.) | |
31 | * @param dataSourceName the name of the data source |
|
33 | * @param dataSourceName the name of the data source | |
32 | * @return the unique id with which the data source has been registered |
|
34 | * @return the unique id with which the data source has been registered | |
33 | */ |
|
35 | */ | |
34 | QUuid registerDataSource(const QString &dataSourceName) noexcept; |
|
36 | QUuid registerDataSource(const QString &dataSourceName) noexcept; | |
35 |
|
37 | |||
36 | /** |
|
38 | /** | |
37 | * Sets the structure of a data source. The controller takes ownership of the structure. |
|
39 | * Sets the structure of a data source. The controller takes ownership of the structure. | |
38 | * @param dataSourceUid the unique id with which the data source has been registered into the |
|
40 | * @param dataSourceUid the unique id with which the data source has been registered into the | |
39 | * controller. If it is invalid, the method has no effect. |
|
41 | * controller. If it is invalid, the method has no effect. | |
40 | * @param dataSourceItem the structure of the data source. It must be not null to be registered |
|
42 | * @param dataSourceItem the structure of the data source. It must be not null to be registered | |
41 | * @sa registerDataSource() |
|
43 | * @sa registerDataSource() | |
42 | */ |
|
44 | */ | |
43 | void setDataSourceItem(const QUuid &dataSourceUid, |
|
45 | void setDataSourceItem(const QUuid &dataSourceUid, | |
44 | std::unique_ptr<DataSourceItem> dataSourceItem) noexcept; |
|
46 | std::unique_ptr<DataSourceItem> dataSourceItem) noexcept; | |
45 |
|
47 | |||
46 | /** |
|
48 | /** | |
47 | * Sets the data provider used to retrieve data from of a data source. The controller takes |
|
49 | * Sets the data provider used to retrieve data from of a data source. The controller takes | |
48 | * ownership of the provider. |
|
50 | * ownership of the provider. | |
49 | * @param dataSourceUid the unique id with which the data source has been registered into the |
|
51 | * @param dataSourceUid the unique id with which the data source has been registered into the | |
50 | * controller. If it is invalid, the method has no effect. |
|
52 | * controller. If it is invalid, the method has no effect. | |
51 | * @param dataProvider the provider of the data source |
|
53 | * @param dataProvider the provider of the data source | |
52 | * @sa registerDataSource() |
|
54 | * @sa registerDataSource() | |
53 | */ |
|
55 | */ | |
54 | void setDataProvider(const QUuid &dataSourceUid, |
|
56 | void setDataProvider(const QUuid &dataSourceUid, | |
55 | std::unique_ptr<IDataProvider> dataProvider) noexcept; |
|
57 | std::unique_ptr<IDataProvider> dataProvider) noexcept; | |
56 |
|
58 | |||
57 | /** |
|
59 | /** | |
58 | * Loads an item (product) as a variable in SciQlop |
|
60 | * Loads an item (product) as a variable in SciQlop | |
59 | * @param dataSourceUid the unique id of the data source containing the item. It is used to get |
|
61 | * @param dataSourceUid the unique id of the data source containing the item. It is used to get | |
60 | * the data provider associated to the data source, and pass it to for the variable creation |
|
62 | * the data provider associated to the data source, and pass it to for the variable creation | |
61 | * @param productItem the item to load |
|
63 | * @param productItem the item to load | |
62 | */ |
|
64 | */ | |
63 | void loadProductItem(const QUuid &dataSourceUid, const DataSourceItem &productItem) noexcept; |
|
65 | void loadProductItem(const QUuid &dataSourceUid, const DataSourceItem &productItem) noexcept; | |
64 |
|
66 | |||
65 | public slots: |
|
67 | public slots: | |
66 | /// Manage init/end of the controller |
|
68 | /// Manage init/end of the controller | |
67 | void initialize(); |
|
69 | void initialize(); | |
68 | void finalize(); |
|
70 | void finalize(); | |
69 |
|
71 | |||
70 | signals: |
|
72 | signals: | |
71 | /// Signal emitted when a structure has been set for a data source |
|
73 | /// Signal emitted when a structure has been set for a data source | |
72 | void dataSourceItemSet(DataSourceItem *dataSourceItem); |
|
74 | void dataSourceItemSet(DataSourceItem *dataSourceItem); | |
73 |
|
75 | |||
74 | /** |
|
76 | /** | |
75 | * Signal emitted when a variable creation is asked for a product |
|
77 | * Signal emitted when a variable creation is asked for a product | |
76 | * @param variableName the name of the variable |
|
78 | * @param variableName the name of the variable | |
77 | * @param variableMetadata the metadata of the variable |
|
79 | * @param variableMetadata the metadata of the variable | |
78 | * @param variableProvider the provider that will be used to retrieve the data of the variable |
|
80 | * @param variableProvider the provider that will be used to retrieve the data of the variable | |
79 | * (can be null) |
|
81 | * (can be null) | |
80 | */ |
|
82 | */ | |
81 | void variableCreationRequested(const QString &variableName, |
|
83 | void variableCreationRequested(const QString &variableName, | |
82 | const QVariantHash &variableMetadata, |
|
84 | const QVariantHash &variableMetadata, | |
83 | std::shared_ptr<IDataProvider> variableProvider); |
|
85 | std::shared_ptr<IDataProvider> variableProvider); | |
84 |
|
86 | |||
85 | private: |
|
87 | private: | |
86 | void waitForFinish(); |
|
88 | void waitForFinish(); | |
87 |
|
89 | |||
88 | class DataSourceControllerPrivate; |
|
90 | class DataSourceControllerPrivate; | |
89 | spimpl::unique_impl_ptr<DataSourceControllerPrivate> impl; |
|
91 | spimpl::unique_impl_ptr<DataSourceControllerPrivate> impl; | |
90 | }; |
|
92 | }; | |
91 |
|
93 | |||
92 | #endif // SCIQLOP_DATASOURCECONTROLLER_H |
|
94 | #endif // SCIQLOP_DATASOURCECONTROLLER_H |
@@ -1,94 +1,96 | |||||
1 | #ifndef SCIQLOP_DATASOURCEITEM_H |
|
1 | #ifndef SCIQLOP_DATASOURCEITEM_H | |
2 | #define SCIQLOP_DATASOURCEITEM_H |
|
2 | #define SCIQLOP_DATASOURCEITEM_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <Common/spimpl.h> |
|
6 | #include <Common/spimpl.h> | |
5 |
|
7 | |||
6 | #include <QVariant> |
|
8 | #include <QVariant> | |
7 | #include <QVector> |
|
9 | #include <QVector> | |
8 |
|
10 | |||
9 | class DataSourceItemAction; |
|
11 | class DataSourceItemAction; | |
10 |
|
12 | |||
11 | /** |
|
13 | /** | |
12 | * Possible types of an item |
|
14 | * Possible types of an item | |
13 | */ |
|
15 | */ | |
14 | enum class DataSourceItemType { NODE, PRODUCT, COMPONENT }; |
|
16 | enum class DataSourceItemType { NODE, PRODUCT, COMPONENT }; | |
15 |
|
17 | |||
16 | /** |
|
18 | /** | |
17 | * @brief The DataSourceItem class aims to represent a structure element of a data source. |
|
19 | * @brief The DataSourceItem class aims to represent a structure element of a data source. | |
18 | * A data source has a tree structure that is made up of a main DataSourceItem object (root) |
|
20 | * A data source has a tree structure that is made up of a main DataSourceItem object (root) | |
19 | * containing other DataSourceItem objects (children). |
|
21 | * containing other DataSourceItem objects (children). | |
20 | * For each DataSourceItem can be associated a set of data representing it. |
|
22 | * For each DataSourceItem can be associated a set of data representing it. | |
21 | */ |
|
23 | */ | |
22 | class DataSourceItem { |
|
24 | class SCIQLOP_CORE_EXPORT DataSourceItem { | |
23 | public: |
|
25 | public: | |
24 | /// Key associated with the name of the item |
|
26 | /// Key associated with the name of the item | |
25 | static const QString NAME_DATA_KEY; |
|
27 | static const QString NAME_DATA_KEY; | |
26 |
|
28 | |||
27 | explicit DataSourceItem(DataSourceItemType type, const QString &name); |
|
29 | explicit DataSourceItem(DataSourceItemType type, const QString &name); | |
28 | explicit DataSourceItem(DataSourceItemType type, QVariantHash data = {}); |
|
30 | explicit DataSourceItem(DataSourceItemType type, QVariantHash data = {}); | |
29 |
|
31 | |||
30 | /// @return the actions of the item as a vector |
|
32 | /// @return the actions of the item as a vector | |
31 | QVector<DataSourceItemAction *> actions() const noexcept; |
|
33 | QVector<DataSourceItemAction *> actions() const noexcept; | |
32 |
|
34 | |||
33 | /** |
|
35 | /** | |
34 | * Adds an action to the item. The item takes ownership of the action, and the action is |
|
36 | * Adds an action to the item. The item takes ownership of the action, and the action is | |
35 | * automatically associated to the item |
|
37 | * automatically associated to the item | |
36 | * @param action the action to add |
|
38 | * @param action the action to add | |
37 | */ |
|
39 | */ | |
38 | void addAction(std::unique_ptr<DataSourceItemAction> action) noexcept; |
|
40 | void addAction(std::unique_ptr<DataSourceItemAction> action) noexcept; | |
39 |
|
41 | |||
40 | /** |
|
42 | /** | |
41 | * Adds a child to the item. The item takes ownership of the child. |
|
43 | * Adds a child to the item. The item takes ownership of the child. | |
42 | * @param child the child to add |
|
44 | * @param child the child to add | |
43 | */ |
|
45 | */ | |
44 | void appendChild(std::unique_ptr<DataSourceItem> child) noexcept; |
|
46 | void appendChild(std::unique_ptr<DataSourceItem> child) noexcept; | |
45 |
|
47 | |||
46 | /** |
|
48 | /** | |
47 | * Returns the item's child associated to an index |
|
49 | * Returns the item's child associated to an index | |
48 | * @param childIndex the index to search |
|
50 | * @param childIndex the index to search | |
49 | * @return a pointer to the child if index is valid, nullptr otherwise |
|
51 | * @return a pointer to the child if index is valid, nullptr otherwise | |
50 | */ |
|
52 | */ | |
51 | DataSourceItem *child(int childIndex) const noexcept; |
|
53 | DataSourceItem *child(int childIndex) const noexcept; | |
52 |
|
54 | |||
53 | int childCount() const noexcept; |
|
55 | int childCount() const noexcept; | |
54 |
|
56 | |||
55 | /** |
|
57 | /** | |
56 | * Get the data associated to a key |
|
58 | * Get the data associated to a key | |
57 | * @param key the key to search |
|
59 | * @param key the key to search | |
58 | * @return the data found if key is valid, default QVariant otherwise |
|
60 | * @return the data found if key is valid, default QVariant otherwise | |
59 | */ |
|
61 | */ | |
60 | QVariant data(const QString &key) const noexcept; |
|
62 | QVariant data(const QString &key) const noexcept; | |
61 |
|
63 | |||
62 | /// Gets all data |
|
64 | /// Gets all data | |
63 | QVariantHash data() const noexcept; |
|
65 | QVariantHash data() const noexcept; | |
64 |
|
66 | |||
65 | bool isRoot() const noexcept; |
|
67 | bool isRoot() const noexcept; | |
66 |
|
68 | |||
67 | QString name() const noexcept; |
|
69 | QString name() const noexcept; | |
68 |
|
70 | |||
69 | /** |
|
71 | /** | |
70 | * Get the item's parent |
|
72 | * Get the item's parent | |
71 | * @return a pointer to the parent if it exists, nullptr if the item is a root |
|
73 | * @return a pointer to the parent if it exists, nullptr if the item is a root | |
72 | */ |
|
74 | */ | |
73 | DataSourceItem *parentItem() const noexcept; |
|
75 | DataSourceItem *parentItem() const noexcept; | |
74 |
|
76 | |||
75 | /** |
|
77 | /** | |
76 | * Sets or appends a value to a key |
|
78 | * Sets or appends a value to a key | |
77 | * @param key the key |
|
79 | * @param key the key | |
78 | * @param value the value |
|
80 | * @param value the value | |
79 | * @param append if true, the value is added to the values already existing for the key, |
|
81 | * @param append if true, the value is added to the values already existing for the key, | |
80 | * otherwise it replaces the existing values |
|
82 | * otherwise it replaces the existing values | |
81 | */ |
|
83 | */ | |
82 | void setData(const QString &key, const QVariant &value, bool append = false) noexcept; |
|
84 | void setData(const QString &key, const QVariant &value, bool append = false) noexcept; | |
83 |
|
85 | |||
84 | DataSourceItemType type() const noexcept; |
|
86 | DataSourceItemType type() const noexcept; | |
85 |
|
87 | |||
86 | bool operator==(const DataSourceItem &other); |
|
88 | bool operator==(const DataSourceItem &other); | |
87 | bool operator!=(const DataSourceItem &other); |
|
89 | bool operator!=(const DataSourceItem &other); | |
88 |
|
90 | |||
89 | private: |
|
91 | private: | |
90 | class DataSourceItemPrivate; |
|
92 | class DataSourceItemPrivate; | |
91 | spimpl::unique_impl_ptr<DataSourceItemPrivate> impl; |
|
93 | spimpl::unique_impl_ptr<DataSourceItemPrivate> impl; | |
92 | }; |
|
94 | }; | |
93 |
|
95 | |||
94 | #endif // SCIQLOP_DATASOURCEITEMMODEL_H |
|
96 | #endif // SCIQLOP_DATASOURCEITEMMODEL_H |
@@ -1,50 +1,52 | |||||
1 | #ifndef SCIQLOP_DATASOURCEITEMACTION_H |
|
1 | #ifndef SCIQLOP_DATASOURCEITEMACTION_H | |
2 | #define SCIQLOP_DATASOURCEITEMACTION_H |
|
2 | #define SCIQLOP_DATASOURCEITEMACTION_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <Common/spimpl.h> |
|
6 | #include <Common/spimpl.h> | |
5 |
|
7 | |||
6 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
9 | #include <QObject> | |
8 |
|
10 | |||
9 | #include <functional> |
|
11 | #include <functional> | |
10 |
|
12 | |||
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceItemAction) |
|
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceItemAction) | |
12 |
|
14 | |||
13 | class DataSourceItem; |
|
15 | class DataSourceItem; | |
14 |
|
16 | |||
15 | /** |
|
17 | /** | |
16 | * @brief The DataSourceItemAction class represents an action on a data source item. |
|
18 | * @brief The DataSourceItemAction class represents an action on a data source item. | |
17 | * |
|
19 | * | |
18 | * An action is a function that will be executed when the slot execute() is called. |
|
20 | * An action is a function that will be executed when the slot execute() is called. | |
19 | */ |
|
21 | */ | |
20 | class DataSourceItemAction : public QObject { |
|
22 | class SCIQLOP_CORE_EXPORT DataSourceItemAction : public QObject { | |
21 |
|
23 | |||
22 | Q_OBJECT |
|
24 | Q_OBJECT | |
23 |
|
25 | |||
24 | public: |
|
26 | public: | |
25 | /// Signature of the function associated to the action |
|
27 | /// Signature of the function associated to the action | |
26 | using ExecuteFunction = std::function<void(DataSourceItem &dataSourceItem)>; |
|
28 | using ExecuteFunction = std::function<void(DataSourceItem &dataSourceItem)>; | |
27 |
|
29 | |||
28 | /** |
|
30 | /** | |
29 | * Ctor |
|
31 | * Ctor | |
30 | * @param name the name of the action |
|
32 | * @param name the name of the action | |
31 | * @param fun the function that will be called when the action is executed |
|
33 | * @param fun the function that will be called when the action is executed | |
32 | * @sa execute() |
|
34 | * @sa execute() | |
33 | */ |
|
35 | */ | |
34 | explicit DataSourceItemAction(const QString &name, ExecuteFunction fun); |
|
36 | explicit DataSourceItemAction(const QString &name, ExecuteFunction fun); | |
35 |
|
37 | |||
36 | QString name() const noexcept; |
|
38 | QString name() const noexcept; | |
37 |
|
39 | |||
38 | /// Sets the data source item concerned by the action |
|
40 | /// Sets the data source item concerned by the action | |
39 | void setDataSourceItem(DataSourceItem *dataSourceItem) noexcept; |
|
41 | void setDataSourceItem(DataSourceItem *dataSourceItem) noexcept; | |
40 |
|
42 | |||
41 | public slots: |
|
43 | public slots: | |
42 | /// Executes the action |
|
44 | /// Executes the action | |
43 | void execute(); |
|
45 | void execute(); | |
44 |
|
46 | |||
45 | private: |
|
47 | private: | |
46 | class DataSourceItemActionPrivate; |
|
48 | class DataSourceItemActionPrivate; | |
47 | spimpl::unique_impl_ptr<DataSourceItemActionPrivate> impl; |
|
49 | spimpl::unique_impl_ptr<DataSourceItemActionPrivate> impl; | |
48 | }; |
|
50 | }; | |
49 |
|
51 | |||
50 | #endif // SCIQLOP_DATASOURCEITEMACTION_H |
|
52 | #endif // SCIQLOP_DATASOURCEITEMACTION_H |
@@ -1,46 +1,48 | |||||
1 | #ifndef SCIQLOP_NETWORKCONTROLLER_H |
|
1 | #ifndef SCIQLOP_NETWORKCONTROLLER_H | |
2 | #define SCIQLOP_NETWORKCONTROLLER_H |
|
2 | #define SCIQLOP_NETWORKCONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
5 | #include <QObject> |
|
7 | #include <QObject> | |
6 | #include <QUuid> |
|
8 | #include <QUuid> | |
7 |
|
9 | |||
8 | #include <Common/spimpl.h> |
|
10 | #include <Common/spimpl.h> | |
9 | #include <functional> |
|
11 | #include <functional> | |
10 |
|
12 | |||
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_NetworkController) |
|
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_NetworkController) | |
12 |
|
14 | |||
13 | class QNetworkReply; |
|
15 | class QNetworkReply; | |
14 | class QNetworkRequest; |
|
16 | class QNetworkRequest; | |
15 |
|
17 | |||
16 | /** |
|
18 | /** | |
17 | * @brief The NetworkController class aims to handle all network connection of SciQlop. |
|
19 | * @brief The NetworkController class aims to handle all network connection of SciQlop. | |
18 | */ |
|
20 | */ | |
19 | class NetworkController : public QObject { |
|
21 | class SCIQLOP_CORE_EXPORT NetworkController : public QObject { | |
20 | Q_OBJECT |
|
22 | Q_OBJECT | |
21 | public: |
|
23 | public: | |
22 | explicit NetworkController(QObject *parent = 0); |
|
24 | explicit NetworkController(QObject *parent = 0); | |
23 |
|
25 | |||
24 | void initialize(); |
|
26 | void initialize(); | |
25 | void finalize(); |
|
27 | void finalize(); | |
26 |
|
28 | |||
27 | public slots: |
|
29 | public slots: | |
28 | /// Execute request and call callback when the reply is finished. Identifier is attached to the |
|
30 | /// Execute request and call callback when the reply is finished. Identifier is attached to the | |
29 | /// callback |
|
31 | /// callback | |
30 | void onProcessRequested(const QNetworkRequest &request, QUuid identifier, |
|
32 | void onProcessRequested(const QNetworkRequest &request, QUuid identifier, | |
31 | std::function<void(QNetworkReply *, QUuid)> callback); |
|
33 | std::function<void(QNetworkReply *, QUuid)> callback); | |
32 | /// Cancel the request of identifier |
|
34 | /// Cancel the request of identifier | |
33 | void onReplyCanceled(QUuid identifier); |
|
35 | void onReplyCanceled(QUuid identifier); | |
34 |
|
36 | |||
35 | signals: |
|
37 | signals: | |
36 | void replyFinished(QNetworkReply *reply, QUuid identifier); |
|
38 | void replyFinished(QNetworkReply *reply, QUuid identifier); | |
37 | void replyDownloadProgress(QUuid identifier, double progress); |
|
39 | void replyDownloadProgress(QUuid identifier, double progress); | |
38 |
|
40 | |||
39 | private: |
|
41 | private: | |
40 | void waitForFinish(); |
|
42 | void waitForFinish(); | |
41 |
|
43 | |||
42 | class NetworkControllerPrivate; |
|
44 | class NetworkControllerPrivate; | |
43 | spimpl::unique_impl_ptr<NetworkControllerPrivate> impl; |
|
45 | spimpl::unique_impl_ptr<NetworkControllerPrivate> impl; | |
44 | }; |
|
46 | }; | |
45 |
|
47 | |||
46 | #endif // SCIQLOP_NETWORKCONTROLLER_H |
|
48 | #endif // SCIQLOP_NETWORKCONTROLLER_H |
@@ -1,34 +1,36 | |||||
1 | #ifndef SCIQLOP_PLUGINMANAGER_H |
|
1 | #ifndef SCIQLOP_PLUGINMANAGER_H | |
2 | #define SCIQLOP_PLUGINMANAGER_H |
|
2 | #define SCIQLOP_PLUGINMANAGER_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <Common/spimpl.h> |
|
6 | #include <Common/spimpl.h> | |
5 |
|
7 | |||
6 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
7 |
|
9 | |||
8 | class QDir; |
|
10 | class QDir; | |
9 |
|
11 | |||
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_PluginManager) |
|
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_PluginManager) | |
11 |
|
13 | |||
12 | /** |
|
14 | /** | |
13 | * @brief The PluginManager class aims to handle the plugins loaded dynamically into SciQLop. |
|
15 | * @brief The PluginManager class aims to handle the plugins loaded dynamically into SciQLop. | |
14 | */ |
|
16 | */ | |
15 | class PluginManager { |
|
17 | class SCIQLOP_CORE_EXPORT PluginManager { | |
16 | public: |
|
18 | public: | |
17 | explicit PluginManager(); |
|
19 | explicit PluginManager(); | |
18 |
|
20 | |||
19 | /** |
|
21 | /** | |
20 | * Loads plugins into SciQlop. The loaded plugins are those located in the directory passed in |
|
22 | * Loads plugins into SciQlop. The loaded plugins are those located in the directory passed in | |
21 | * parameter |
|
23 | * parameter | |
22 | * @param pluginDir the directory containing the plugins |
|
24 | * @param pluginDir the directory containing the plugins | |
23 | */ |
|
25 | */ | |
24 | void loadPlugins(const QDir &pluginDir); |
|
26 | void loadPlugins(const QDir &pluginDir); | |
25 |
|
27 | |||
26 | /// @returns the number of plugins loaded |
|
28 | /// @returns the number of plugins loaded | |
27 | int nbPluginsLoaded() const noexcept; |
|
29 | int nbPluginsLoaded() const noexcept; | |
28 |
|
30 | |||
29 | private: |
|
31 | private: | |
30 | class PluginManagerPrivate; |
|
32 | class PluginManagerPrivate; | |
31 | spimpl::unique_impl_ptr<PluginManagerPrivate> impl; |
|
33 | spimpl::unique_impl_ptr<PluginManagerPrivate> impl; | |
32 | }; |
|
34 | }; | |
33 |
|
35 | |||
34 | #endif // SCIQLOP_PLUGINMANAGER_H |
|
36 | #endif // SCIQLOP_PLUGINMANAGER_H |
@@ -1,40 +1,42 | |||||
1 | #ifndef SCIQLOP_TIMECONTROLLER_H |
|
1 | #ifndef SCIQLOP_TIMECONTROLLER_H | |
2 | #define SCIQLOP_TIMECONTROLLER_H |
|
2 | #define SCIQLOP_TIMECONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <Data/SqpDateTime.h> |
|
6 | #include <Data/SqpDateTime.h> | |
5 |
|
7 | |||
6 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
9 | #include <QObject> | |
8 |
|
10 | |||
9 | #include <Common/spimpl.h> |
|
11 | #include <Common/spimpl.h> | |
10 |
|
12 | |||
11 |
|
13 | |||
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_TimeController) |
|
14 | Q_DECLARE_LOGGING_CATEGORY(LOG_TimeController) | |
13 |
|
15 | |||
14 | /** |
|
16 | /** | |
15 | * @brief The TimeController class aims to handle the Time parameters notification in SciQlop. |
|
17 | * @brief The TimeController class aims to handle the Time parameters notification in SciQlop. | |
16 | */ |
|
18 | */ | |
17 | class TimeController : public QObject { |
|
19 | class SCIQLOP_CORE_EXPORT TimeController : public QObject { | |
18 | Q_OBJECT |
|
20 | Q_OBJECT | |
19 | public: |
|
21 | public: | |
20 | explicit TimeController(QObject *parent = 0); |
|
22 | explicit TimeController(QObject *parent = 0); | |
21 |
|
23 | |||
22 | SqpDateTime dateTime() const noexcept; |
|
24 | SqpDateTime dateTime() const noexcept; | |
23 |
|
25 | |||
24 | signals: |
|
26 | signals: | |
25 | /// Signal emitted to notify that time parameters has beed updated |
|
27 | /// Signal emitted to notify that time parameters has beed updated | |
26 | void timeUpdated(SqpDateTime time); |
|
28 | void timeUpdated(SqpDateTime time); | |
27 |
|
29 | |||
28 | public slots: |
|
30 | public slots: | |
29 | /// Slot called when a new dateTime has been defined. |
|
31 | /// Slot called when a new dateTime has been defined. | |
30 | void onTimeToUpdate(SqpDateTime dateTime); |
|
32 | void onTimeToUpdate(SqpDateTime dateTime); | |
31 |
|
33 | |||
32 | /// Slot called when the dateTime has to be notified. Call timeUpdated signal |
|
34 | /// Slot called when the dateTime has to be notified. Call timeUpdated signal | |
33 | void onTimeNotify(); |
|
35 | void onTimeNotify(); | |
34 |
|
36 | |||
35 | private: |
|
37 | private: | |
36 | class TimeControllerPrivate; |
|
38 | class TimeControllerPrivate; | |
37 | spimpl::unique_impl_ptr<TimeControllerPrivate> impl; |
|
39 | spimpl::unique_impl_ptr<TimeControllerPrivate> impl; | |
38 | }; |
|
40 | }; | |
39 |
|
41 | |||
40 | #endif // SCIQLOP_TIMECONTROLLER_H |
|
42 | #endif // SCIQLOP_TIMECONTROLLER_H |
@@ -1,55 +1,57 | |||||
1 | #ifndef SCIQLOP_VARIABLE_H |
|
1 | #ifndef SCIQLOP_VARIABLE_H | |
2 | #define SCIQLOP_VARIABLE_H |
|
2 | #define SCIQLOP_VARIABLE_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <Data/SqpDateTime.h> |
|
6 | #include <Data/SqpDateTime.h> | |
5 |
|
7 | |||
6 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
9 | #include <QObject> | |
8 |
|
10 | |||
9 | #include <Common/MetaTypes.h> |
|
11 | #include <Common/MetaTypes.h> | |
10 | #include <Common/spimpl.h> |
|
12 | #include <Common/spimpl.h> | |
11 |
|
13 | |||
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_Variable) |
|
14 | Q_DECLARE_LOGGING_CATEGORY(LOG_Variable) | |
13 |
|
15 | |||
14 | class IDataSeries; |
|
16 | class IDataSeries; | |
15 | class QString; |
|
17 | class QString; | |
16 |
|
18 | |||
17 | /** |
|
19 | /** | |
18 | * @brief The Variable class represents a variable in SciQlop. |
|
20 | * @brief The Variable class represents a variable in SciQlop. | |
19 | */ |
|
21 | */ | |
20 | class Variable : public QObject { |
|
22 | class SCIQLOP_CORE_EXPORT Variable : public QObject { | |
21 |
|
23 | |||
22 | Q_OBJECT |
|
24 | Q_OBJECT | |
23 |
|
25 | |||
24 | public: |
|
26 | public: | |
25 | explicit Variable(const QString &name, const SqpDateTime &dateTime, |
|
27 | explicit Variable(const QString &name, const SqpDateTime &dateTime, | |
26 | const QVariantHash &metadata = {}); |
|
28 | const QVariantHash &metadata = {}); | |
27 |
|
29 | |||
28 | QString name() const noexcept; |
|
30 | QString name() const noexcept; | |
29 | SqpDateTime dateTime() const noexcept; |
|
31 | SqpDateTime dateTime() const noexcept; | |
30 | void setDateTime(const SqpDateTime &dateTime) noexcept; |
|
32 | void setDateTime(const SqpDateTime &dateTime) noexcept; | |
31 |
|
33 | |||
32 | /// @return the data of the variable, nullptr if there is no data |
|
34 | /// @return the data of the variable, nullptr if there is no data | |
33 | IDataSeries *dataSeries() const noexcept; |
|
35 | IDataSeries *dataSeries() const noexcept; | |
34 |
|
36 | |||
35 | QVariantHash metadata() const noexcept; |
|
37 | QVariantHash metadata() const noexcept; | |
36 |
|
38 | |||
37 | bool contains(const SqpDateTime &dateTime) const noexcept; |
|
39 | bool contains(const SqpDateTime &dateTime) const noexcept; | |
38 | bool intersect(const SqpDateTime &dateTime) const noexcept; |
|
40 | bool intersect(const SqpDateTime &dateTime) const noexcept; | |
39 | bool isInside(const SqpDateTime &dateTime) const noexcept; |
|
41 | bool isInside(const SqpDateTime &dateTime) const noexcept; | |
40 |
|
42 | |||
41 | public slots: |
|
43 | public slots: | |
42 | void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept; |
|
44 | void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept; | |
43 |
|
45 | |||
44 | signals: |
|
46 | signals: | |
45 | void updated(); |
|
47 | void updated(); | |
46 |
|
48 | |||
47 | private: |
|
49 | private: | |
48 | class VariablePrivate; |
|
50 | class VariablePrivate; | |
49 | spimpl::unique_impl_ptr<VariablePrivate> impl; |
|
51 | spimpl::unique_impl_ptr<VariablePrivate> impl; | |
50 | }; |
|
52 | }; | |
51 |
|
53 | |||
52 | // Required for using shared_ptr in signals/slots |
|
54 | // Required for using shared_ptr in signals/slots | |
53 | SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_REGISTRY, std::shared_ptr<Variable>) |
|
55 | SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_REGISTRY, std::shared_ptr<Variable>) | |
54 |
|
56 | |||
55 | #endif // SCIQLOP_VARIABLE_H |
|
57 | #endif // SCIQLOP_VARIABLE_H |
@@ -1,43 +1,45 | |||||
1 | #ifndef SCIQLOP_VARIABLECACHECONTROLLER_H |
|
1 | #ifndef SCIQLOP_VARIABLECACHECONTROLLER_H | |
2 | #define SCIQLOP_VARIABLECACHECONTROLLER_H |
|
2 | #define SCIQLOP_VARIABLECACHECONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
5 | #include <QObject> |
|
7 | #include <QObject> | |
6 |
|
8 | |||
7 | #include <Data/SqpDateTime.h> |
|
9 | #include <Data/SqpDateTime.h> | |
8 |
|
10 | |||
9 | #include <QLoggingCategory> |
|
11 | #include <QLoggingCategory> | |
10 |
|
12 | |||
11 | #include <Common/spimpl.h> |
|
13 | #include <Common/spimpl.h> | |
12 |
|
14 | |||
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController) |
|
15 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController) | |
14 |
|
16 | |||
15 | class Variable; |
|
17 | class Variable; | |
16 |
|
18 | |||
17 | /// This class aims to store in the cache all of the dateTime already requested to the variable. |
|
19 | /// This class aims to store in the cache all of the dateTime already requested to the variable. | |
18 | class VariableCacheController : public QObject { |
|
20 | class SCIQLOP_CORE_EXPORT VariableCacheController : public QObject { | |
19 | Q_OBJECT |
|
21 | Q_OBJECT | |
20 | public: |
|
22 | public: | |
21 | explicit VariableCacheController(QObject *parent = 0); |
|
23 | explicit VariableCacheController(QObject *parent = 0); | |
22 |
|
24 | |||
23 |
|
25 | |||
24 | void addDateTime(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); |
|
26 | void addDateTime(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | |
25 |
|
27 | |||
26 | /// Clears cache concerning a variable |
|
28 | /// Clears cache concerning a variable | |
27 | void clear(std::shared_ptr<Variable> variable) noexcept; |
|
29 | void clear(std::shared_ptr<Variable> variable) noexcept; | |
28 |
|
30 | |||
29 | /// Return all of the SqpDataTime part of the dateTime whose are not in the cache |
|
31 | /// Return all of the SqpDataTime part of the dateTime whose are not in the cache | |
30 | QVector<SqpDateTime> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, |
|
32 | QVector<SqpDateTime> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, | |
31 | const SqpDateTime &dateTime); |
|
33 | const SqpDateTime &dateTime); | |
32 |
|
34 | |||
33 |
|
35 | |||
34 | QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept; |
|
36 | QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept; | |
35 |
|
37 | |||
36 | void displayCache(std::shared_ptr<Variable> variable) const; |
|
38 | void displayCache(std::shared_ptr<Variable> variable) const; | |
37 |
|
39 | |||
38 | private: |
|
40 | private: | |
39 | class VariableCacheControllerPrivate; |
|
41 | class VariableCacheControllerPrivate; | |
40 | spimpl::unique_impl_ptr<VariableCacheControllerPrivate> impl; |
|
42 | spimpl::unique_impl_ptr<VariableCacheControllerPrivate> impl; | |
41 | }; |
|
43 | }; | |
42 |
|
44 | |||
43 | #endif // SCIQLOP_VARIABLECACHECONTROLLER_H |
|
45 | #endif // SCIQLOP_VARIABLECACHECONTROLLER_H |
@@ -1,95 +1,97 | |||||
1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H |
|
1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H | |
2 | #define SCIQLOP_VARIABLECONTROLLER_H |
|
2 | #define SCIQLOP_VARIABLECONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <Data/SqpDateTime.h> |
|
6 | #include <Data/SqpDateTime.h> | |
5 |
|
7 | |||
6 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
9 | #include <QObject> | |
8 |
|
10 | |||
9 | #include <Common/spimpl.h> |
|
11 | #include <Common/spimpl.h> | |
10 |
|
12 | |||
11 | class IDataProvider; |
|
13 | class IDataProvider; | |
12 | class QItemSelectionModel; |
|
14 | class QItemSelectionModel; | |
13 | class TimeController; |
|
15 | class TimeController; | |
14 | class Variable; |
|
16 | class Variable; | |
15 | class VariableModel; |
|
17 | class VariableModel; | |
16 |
|
18 | |||
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) |
|
19 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) | |
18 |
|
20 | |||
19 | /** |
|
21 | /** | |
20 | * @brief The VariableController class aims to handle the variables in SciQlop. |
|
22 | * @brief The VariableController class aims to handle the variables in SciQlop. | |
21 | */ |
|
23 | */ | |
22 | class VariableController : public QObject { |
|
24 | class SCIQLOP_CORE_EXPORT VariableController : public QObject { | |
23 | Q_OBJECT |
|
25 | Q_OBJECT | |
24 | public: |
|
26 | public: | |
25 | explicit VariableController(QObject *parent = 0); |
|
27 | explicit VariableController(QObject *parent = 0); | |
26 | virtual ~VariableController(); |
|
28 | virtual ~VariableController(); | |
27 |
|
29 | |||
28 | VariableModel *variableModel() noexcept; |
|
30 | VariableModel *variableModel() noexcept; | |
29 | QItemSelectionModel *variableSelectionModel() noexcept; |
|
31 | QItemSelectionModel *variableSelectionModel() noexcept; | |
30 |
|
32 | |||
31 | void setTimeController(TimeController *timeController) noexcept; |
|
33 | void setTimeController(TimeController *timeController) noexcept; | |
32 |
|
34 | |||
33 | /** |
|
35 | /** | |
34 | * Deletes from the controller the variable passed in parameter. |
|
36 | * Deletes from the controller the variable passed in parameter. | |
35 | * |
|
37 | * | |
36 | * Delete a variable includes: |
|
38 | * Delete a variable includes: | |
37 | * - the deletion of the various references to the variable in SciQlop |
|
39 | * - the deletion of the various references to the variable in SciQlop | |
38 | * - the deletion of the model variable |
|
40 | * - the deletion of the model variable | |
39 | * - the deletion of the provider associated with the variable |
|
41 | * - the deletion of the provider associated with the variable | |
40 | * - removing the cache associated with the variable |
|
42 | * - removing the cache associated with the variable | |
41 | * |
|
43 | * | |
42 | * @param variable the variable to delete from the controller. |
|
44 | * @param variable the variable to delete from the controller. | |
43 | */ |
|
45 | */ | |
44 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; |
|
46 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; | |
45 |
|
47 | |||
46 | /** |
|
48 | /** | |
47 | * Deletes from the controller the variables passed in parameter. |
|
49 | * Deletes from the controller the variables passed in parameter. | |
48 | * @param variables the variables to delete from the controller. |
|
50 | * @param variables the variables to delete from the controller. | |
49 | * @sa deleteVariable() |
|
51 | * @sa deleteVariable() | |
50 | */ |
|
52 | */ | |
51 | void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; |
|
53 | void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; | |
52 |
|
54 | |||
53 | /** |
|
55 | /** | |
54 | * @brief abort the variable retrieve data progression |
|
56 | * @brief abort the variable retrieve data progression | |
55 | */ |
|
57 | */ | |
56 | void abortProgress(std::shared_ptr<Variable> variable); |
|
58 | void abortProgress(std::shared_ptr<Variable> variable); | |
57 |
|
59 | |||
58 | signals: |
|
60 | signals: | |
59 | /// Signal emitted when a variable is about to be deleted from the controller |
|
61 | /// Signal emitted when a variable is about to be deleted from the controller | |
60 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); |
|
62 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | |
61 |
|
63 | |||
62 | /// Signal emitted when a data acquisition is requested on a range for a variable |
|
64 | /// Signal emitted when a data acquisition is requested on a range for a variable | |
63 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range); |
|
65 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |
64 |
|
66 | |||
65 | public slots: |
|
67 | public slots: | |
66 | /// Request the data loading of the variable whithin dateTime |
|
68 | /// Request the data loading of the variable whithin dateTime | |
67 | void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); |
|
69 | void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | |
68 | /** |
|
70 | /** | |
69 | * Creates a new variable and adds it to the model |
|
71 | * Creates a new variable and adds it to the model | |
70 | * @param name the name of the new variable |
|
72 | * @param name the name of the new variable | |
71 | * @param metadata the metadata of the new variable |
|
73 | * @param metadata the metadata of the new variable | |
72 | * @param provider the data provider for the new variable |
|
74 | * @param provider the data provider for the new variable | |
73 | */ |
|
75 | */ | |
74 | void createVariable(const QString &name, const QVariantHash &metadata, |
|
76 | void createVariable(const QString &name, const QVariantHash &metadata, | |
75 | std::shared_ptr<IDataProvider> provider) noexcept; |
|
77 | std::shared_ptr<IDataProvider> provider) noexcept; | |
76 |
|
78 | |||
77 | /// Update the temporal parameters of every selected variable to dateTime |
|
79 | /// Update the temporal parameters of every selected variable to dateTime | |
78 | void onDateTimeOnSelection(const SqpDateTime &dateTime); |
|
80 | void onDateTimeOnSelection(const SqpDateTime &dateTime); | |
79 |
|
81 | |||
80 |
|
82 | |||
81 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); |
|
83 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); | |
82 |
|
84 | |||
83 | void onAbortProgressRequested(std::shared_ptr<Variable> variable); |
|
85 | void onAbortProgressRequested(std::shared_ptr<Variable> variable); | |
84 |
|
86 | |||
85 | void initialize(); |
|
87 | void initialize(); | |
86 | void finalize(); |
|
88 | void finalize(); | |
87 |
|
89 | |||
88 | private: |
|
90 | private: | |
89 | void waitForFinish(); |
|
91 | void waitForFinish(); | |
90 |
|
92 | |||
91 | class VariableControllerPrivate; |
|
93 | class VariableControllerPrivate; | |
92 | spimpl::unique_impl_ptr<VariableControllerPrivate> impl; |
|
94 | spimpl::unique_impl_ptr<VariableControllerPrivate> impl; | |
93 | }; |
|
95 | }; | |
94 |
|
96 | |||
95 | #endif // SCIQLOP_VARIABLECONTROLLER_H |
|
97 | #endif // SCIQLOP_VARIABLECONTROLLER_H |
@@ -1,79 +1,80 | |||||
1 | #ifndef SCIQLOP_VARIABLEMODEL_H |
|
1 | #ifndef SCIQLOP_VARIABLEMODEL_H | |
2 | #define SCIQLOP_VARIABLEMODEL_H |
|
2 | #define SCIQLOP_VARIABLEMODEL_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
4 |
|
5 | |||
5 | #include <Data/SqpDateTime.h> |
|
6 | #include <Data/SqpDateTime.h> | |
6 |
|
7 | |||
7 | #include <QAbstractTableModel> |
|
8 | #include <QAbstractTableModel> | |
8 | #include <QLoggingCategory> |
|
9 | #include <QLoggingCategory> | |
9 |
|
10 | |||
10 | #include <Common/MetaTypes.h> |
|
11 | #include <Common/MetaTypes.h> | |
11 | #include <Common/spimpl.h> |
|
12 | #include <Common/spimpl.h> | |
12 |
|
13 | |||
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableModel) |
|
14 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableModel) | |
14 |
|
15 | |||
15 | enum VariableRoles { ProgressRole = Qt::UserRole }; |
|
16 | enum VariableRoles { ProgressRole = Qt::UserRole }; | |
16 |
|
17 | |||
17 |
|
18 | |||
18 | class IDataSeries; |
|
19 | class IDataSeries; | |
19 | class Variable; |
|
20 | class Variable; | |
20 |
|
21 | |||
21 | /** |
|
22 | /** | |
22 | * @brief The VariableModel class aims to hold the variables that have been created in SciQlop |
|
23 | * @brief The VariableModel class aims to hold the variables that have been created in SciQlop | |
23 | */ |
|
24 | */ | |
24 | class VariableModel : public QAbstractTableModel { |
|
25 | class SCIQLOP_CORE_EXPORT VariableModel : public QAbstractTableModel { | |
25 | Q_OBJECT |
|
26 | Q_OBJECT | |
26 | public: |
|
27 | public: | |
27 | explicit VariableModel(QObject *parent = nullptr); |
|
28 | explicit VariableModel(QObject *parent = nullptr); | |
28 |
|
29 | |||
29 | /** |
|
30 | /** | |
30 | * Creates a new variable in the model |
|
31 | * Creates a new variable in the model | |
31 | * @param name the name of the new variable |
|
32 | * @param name the name of the new variable | |
32 | * @param dateTime the dateTime of the new variable |
|
33 | * @param dateTime the dateTime of the new variable | |
33 | * @param metadata the metadata associated to the new variable |
|
34 | * @param metadata the metadata associated to the new variable | |
34 | * @return the pointer to the new variable |
|
35 | * @return the pointer to the new variable | |
35 | */ |
|
36 | */ | |
36 | std::shared_ptr<Variable> createVariable(const QString &name, const SqpDateTime &dateTime, |
|
37 | std::shared_ptr<Variable> createVariable(const QString &name, const SqpDateTime &dateTime, | |
37 | const QVariantHash &metadata) noexcept; |
|
38 | const QVariantHash &metadata) noexcept; | |
38 |
|
39 | |||
39 | /** |
|
40 | /** | |
40 | * Deletes a variable from the model, if it exists |
|
41 | * Deletes a variable from the model, if it exists | |
41 | * @param variable the variable to delete |
|
42 | * @param variable the variable to delete | |
42 | */ |
|
43 | */ | |
43 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; |
|
44 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; | |
44 |
|
45 | |||
45 |
|
46 | |||
46 | std::shared_ptr<Variable> variable(int index) const; |
|
47 | std::shared_ptr<Variable> variable(int index) const; | |
47 |
|
48 | |||
48 | void setDataProgress(std::shared_ptr<Variable> variable, double progress); |
|
49 | void setDataProgress(std::shared_ptr<Variable> variable, double progress); | |
49 |
|
50 | |||
50 |
|
51 | |||
51 | // /////////////////////////// // |
|
52 | // /////////////////////////// // | |
52 | // QAbstractTableModel methods // |
|
53 | // QAbstractTableModel methods // | |
53 | // /////////////////////////// // |
|
54 | // /////////////////////////// // | |
54 |
|
55 | |||
55 | virtual int columnCount(const QModelIndex &parent = QModelIndex{}) const override; |
|
56 | virtual int columnCount(const QModelIndex &parent = QModelIndex{}) const override; | |
56 | virtual int rowCount(const QModelIndex &parent = QModelIndex{}) const override; |
|
57 | virtual int rowCount(const QModelIndex &parent = QModelIndex{}) const override; | |
57 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; |
|
58 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | |
58 | virtual QVariant headerData(int section, Qt::Orientation orientation, |
|
59 | virtual QVariant headerData(int section, Qt::Orientation orientation, | |
59 | int role = Qt::DisplayRole) const override; |
|
60 | int role = Qt::DisplayRole) const override; | |
60 |
|
61 | |||
61 |
|
62 | |||
62 | void abortProgress(const QModelIndex &index); |
|
63 | void abortProgress(const QModelIndex &index); | |
63 |
|
64 | |||
64 | signals: |
|
65 | signals: | |
65 | void abortProgessRequested(std::shared_ptr<Variable> variable); |
|
66 | void abortProgessRequested(std::shared_ptr<Variable> variable); | |
66 |
|
67 | |||
67 | private: |
|
68 | private: | |
68 | class VariableModelPrivate; |
|
69 | class VariableModelPrivate; | |
69 | spimpl::unique_impl_ptr<VariableModelPrivate> impl; |
|
70 | spimpl::unique_impl_ptr<VariableModelPrivate> impl; | |
70 |
|
71 | |||
71 | private slots: |
|
72 | private slots: | |
72 | /// Slot called when data of a variable has been updated |
|
73 | /// Slot called when data of a variable has been updated | |
73 | void onVariableUpdated() noexcept; |
|
74 | void onVariableUpdated() noexcept; | |
74 | }; |
|
75 | }; | |
75 |
|
76 | |||
76 | // Registers QVector<int> metatype so it can be used in VariableModel::dataChanged() signal |
|
77 | // Registers QVector<int> metatype so it can be used in VariableModel::dataChanged() signal | |
77 | SCIQLOP_REGISTER_META_TYPE(QVECTOR_INT_REGISTRY, QVector<int>) |
|
78 | SCIQLOP_REGISTER_META_TYPE(QVECTOR_INT_REGISTRY, QVector<int>) | |
78 |
|
79 | |||
79 | #endif // SCIQLOP_VARIABLEMODEL_H |
|
80 | #endif // SCIQLOP_VARIABLEMODEL_H |
@@ -1,49 +1,51 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H | |
2 | #define SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
2 | #define SCIQLOP_VISUALIZATIONCONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
4 | #include <Data/SqpDateTime.h> |
|
6 | #include <Data/SqpDateTime.h> | |
5 |
|
7 | |||
6 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
9 | #include <QObject> | |
8 | #include <QUuid> |
|
10 | #include <QUuid> | |
9 |
|
11 | |||
10 | #include <Common/spimpl.h> |
|
12 | #include <Common/spimpl.h> | |
11 |
|
13 | |||
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationController) |
|
14 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationController) | |
13 |
|
15 | |||
14 | class DataSourceItem; |
|
16 | class DataSourceItem; | |
15 | class Variable; |
|
17 | class Variable; | |
16 |
|
18 | |||
17 | /** |
|
19 | /** | |
18 | * @brief The VisualizationController class aims to make the link between SciQlop and its plugins. |
|
20 | * @brief The VisualizationController class aims to make the link between SciQlop and its plugins. | |
19 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. |
|
21 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. | |
20 | * Please first use register method to initialize a plugin specified by its metadata name (JSON |
|
22 | * Please first use register method to initialize a plugin specified by its metadata name (JSON | |
21 | * plugin source) then others specifics method will be able to access it. You can load a data source |
|
23 | * plugin source) then others specifics method will be able to access it. You can load a data source | |
22 | * driver plugin then create a data source. |
|
24 | * driver plugin then create a data source. | |
23 | */ |
|
25 | */ | |
24 | class VisualizationController : public QObject { |
|
26 | class SCIQLOP_CORE_EXPORT VisualizationController : public QObject { | |
25 | Q_OBJECT |
|
27 | Q_OBJECT | |
26 | public: |
|
28 | public: | |
27 | explicit VisualizationController(QObject *parent = 0); |
|
29 | explicit VisualizationController(QObject *parent = 0); | |
28 | virtual ~VisualizationController(); |
|
30 | virtual ~VisualizationController(); | |
29 |
|
31 | |||
30 | signals: |
|
32 | signals: | |
31 | /// Signal emitted when a variable is about to be deleted from SciQlop |
|
33 | /// Signal emitted when a variable is about to be deleted from SciQlop | |
32 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); |
|
34 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | |
33 |
|
35 | |||
34 | /// Signal emitted when a data acquisition is requested on a range for a variable |
|
36 | /// Signal emitted when a data acquisition is requested on a range for a variable | |
35 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range); |
|
37 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |
36 |
|
38 | |||
37 | public slots: |
|
39 | public slots: | |
38 | /// Manage init/end of the controller |
|
40 | /// Manage init/end of the controller | |
39 | void initialize(); |
|
41 | void initialize(); | |
40 | void finalize(); |
|
42 | void finalize(); | |
41 |
|
43 | |||
42 | private: |
|
44 | private: | |
43 | void waitForFinish(); |
|
45 | void waitForFinish(); | |
44 |
|
46 | |||
45 | class VisualizationControllerPrivate; |
|
47 | class VisualizationControllerPrivate; | |
46 | spimpl::unique_impl_ptr<VisualizationControllerPrivate> impl; |
|
48 | spimpl::unique_impl_ptr<VisualizationControllerPrivate> impl; | |
47 | }; |
|
49 | }; | |
48 |
|
50 | |||
49 | #endif // SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
51 | #endif // SCIQLOP_VISUALIZATIONCONTROLLER_H |
General Comments 0
You need to be logged in to leave comments.
Login now