@@ -0,0 +1,29 | |||||
|
1 | # - Try to find CatalogueAPI Module | |||
|
2 | # Once done this will define | |||
|
3 | # CATALOGUEAPI_FOUND - System has CatalogueAPI | |||
|
4 | # CATALOGUEAPI_INCLUDE_DIRS - The CatalogueAPI include directories | |||
|
5 | # CATALOGUEAPI_LIBRARIES - The libraries needed to use CatalogueAPI | |||
|
6 | # CATALOGUEAPI_SHARED_LIBRARIES - The shared libraries for CatalogueAPI | |||
|
7 | ||||
|
8 | set(CATALOGUEAPI_ROOT_DIR "${CATALOGUEAPI_EXTERN_FOLDER}" | |||
|
9 | CACHE PATHS | |||
|
10 | "Path to the installation of CatalogueAPI" | |||
|
11 | ${libRootDirForceValue}) | |||
|
12 | ||||
|
13 | find_path(CATALOGUEAPI_INCLUDE_DIR CatalogueDao.h | |||
|
14 | HINTS ${CATALOGUEAPI_ROOT_DIR} ${CATALOGUEAPI_EXTERN_FOLDER} | |||
|
15 | PATH_SUFFIXES src ) | |||
|
16 | ||||
|
17 | find_library(CATALOGUEAPI_LIBRARY NAMES CatalogueAPI | |||
|
18 | HINTS ${CATALOGUEAPI_ROOT_DIR} ${CATALOGUEAPI_EXTERN_FOLDER} | |||
|
19 | PATH_SUFFIXES lib) | |||
|
20 | ||||
|
21 | set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_LIBRARY} ) | |||
|
22 | set(CATALOGUEAPI_INCLUDE_DIRS ${CATALOGUEAPI_INCLUDE_DIR} ) | |||
|
23 | ||||
|
24 | include(FindPackageHandleStandardArgs) | |||
|
25 | # handle the QUIETLY and REQUIRED arguments and set CATALOGUEAPI_FOUND to TRUE | |||
|
26 | # if all listed variables are TRUE | |||
|
27 | find_package_handle_standard_args(CatalogueAPI FOUND_VAR CATALOGUEAPI_FOUND | |||
|
28 | REQUIRED_VARS CATALOGUEAPI_LIBRARY CATALOGUEAPI_INCLUDE_DIR) | |||
|
29 | mark_as_advanced(CATALOGUEAPI_INCLUDE_DIR CATALOGUEAPI_LIBRARY ) |
@@ -0,0 +1,51 | |||||
|
1 | #ifndef SCIQLOP_CATALOGUECONTROLLER_H | |||
|
2 | #define SCIQLOP_CATALOGUECONTROLLER_H | |||
|
3 | ||||
|
4 | #include "CoreGlobal.h" | |||
|
5 | ||||
|
6 | #include <Data/SqpRange.h> | |||
|
7 | ||||
|
8 | #include <QLoggingCategory> | |||
|
9 | #include <QObject> | |||
|
10 | #include <QUuid> | |||
|
11 | ||||
|
12 | #include <Common/spimpl.h> | |||
|
13 | ||||
|
14 | Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController) | |||
|
15 | ||||
|
16 | class DataSourceItem; | |||
|
17 | class Variable; | |||
|
18 | ||||
|
19 | /** | |||
|
20 | * @brief The CatalogueController class aims to make the link between SciQlop and its plugins. | |||
|
21 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. | |||
|
22 | * Please first use register method to initialize a plugin specified by its metadata name (JSON | |||
|
23 | * plugin source) then others specifics method will be able to access it. You can load a data source | |||
|
24 | * driver plugin then create a data source. | |||
|
25 | */ | |||
|
26 | class SCIQLOP_CORE_EXPORT CatalogueController : public QObject { | |||
|
27 | Q_OBJECT | |||
|
28 | public: | |||
|
29 | explicit CatalogueController(QObject *parent = 0); | |||
|
30 | virtual ~CatalogueController(); | |||
|
31 | ||||
|
32 | signals: | |||
|
33 | /// Signal emitted when a variable is about to be deleted from SciQlop | |||
|
34 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | |||
|
35 | ||||
|
36 | /// Signal emitted when a data acquisition is requested on a range for a variable | |||
|
37 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpRange &range); | |||
|
38 | ||||
|
39 | public slots: | |||
|
40 | /// Manage init/end of the controller | |||
|
41 | void initialize(); | |||
|
42 | void finalize(); | |||
|
43 | ||||
|
44 | private: | |||
|
45 | void waitForFinish(); | |||
|
46 | ||||
|
47 | class CatalogueControllerPrivate; | |||
|
48 | spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl; | |||
|
49 | }; | |||
|
50 | ||||
|
51 | #endif // SCIQLOP_CATALOGUECONTROLLER_H |
@@ -0,0 +1,52 | |||||
|
1 | #include <Catalogue/CatalogueController.h> | |||
|
2 | ||||
|
3 | #include <Variable/Variable.h> | |||
|
4 | ||||
|
5 | #include <CatalogueDao.h> | |||
|
6 | ||||
|
7 | #include <QMutex> | |||
|
8 | #include <QThread> | |||
|
9 | ||||
|
10 | #include <QDir> | |||
|
11 | #include <QStandardPaths> | |||
|
12 | ||||
|
13 | Q_LOGGING_CATEGORY(LOG_CatalogueController, "CatalogueController") | |||
|
14 | ||||
|
15 | class CatalogueController::CatalogueControllerPrivate { | |||
|
16 | public: | |||
|
17 | QMutex m_WorkingMutex; | |||
|
18 | CatalogueDao m_CatalogueDao; | |||
|
19 | }; | |||
|
20 | ||||
|
21 | CatalogueController::CatalogueController(QObject *parent) | |||
|
22 | : impl{spimpl::make_unique_impl<CatalogueControllerPrivate>()} | |||
|
23 | { | |||
|
24 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController construction") | |||
|
25 | << QThread::currentThread(); | |||
|
26 | } | |||
|
27 | ||||
|
28 | CatalogueController::~CatalogueController() | |||
|
29 | { | |||
|
30 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController destruction") | |||
|
31 | << QThread::currentThread(); | |||
|
32 | this->waitForFinish(); | |||
|
33 | } | |||
|
34 | ||||
|
35 | void CatalogueController::initialize() | |||
|
36 | { | |||
|
37 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController init") | |||
|
38 | << QThread::currentThread(); | |||
|
39 | impl->m_WorkingMutex.lock(); | |||
|
40 | impl->m_CatalogueDao.initialize(); | |||
|
41 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END"); | |||
|
42 | } | |||
|
43 | ||||
|
44 | void CatalogueController::finalize() | |||
|
45 | { | |||
|
46 | impl->m_WorkingMutex.unlock(); | |||
|
47 | } | |||
|
48 | ||||
|
49 | void CatalogueController::waitForFinish() | |||
|
50 | { | |||
|
51 | QMutexLocker locker{&impl->m_WorkingMutex}; | |||
|
52 | } |
@@ -0,0 +1,73 | |||||
|
1 | # - Clone and build CatalogueAPI Module | |||
|
2 | include(ExternalProject) | |||
|
3 | ||||
|
4 | find_package(Git REQUIRED) | |||
|
5 | ||||
|
6 | if(WIN32) | |||
|
7 | find_program(MesonExec meson PATHS C:/Appli/Meson) | |||
|
8 | if(NOT MesonExec) | |||
|
9 | Message("Error: Meson not found") | |||
|
10 | else() | |||
|
11 | message("Meson found: ${MesonExec}" ) | |||
|
12 | endif() | |||
|
13 | find_program(NinjaExec ninja PATHS C:/Appli/Meson) | |||
|
14 | if(NOT NinjaExec) | |||
|
15 | Message("Error: Ninja not found") | |||
|
16 | else() | |||
|
17 | message("Ninja found: ${NinjaExec}" ) | |||
|
18 | endif() | |||
|
19 | endif() | |||
|
20 | if(NOT MesonExec) | |||
|
21 | set (MesonExec meson) | |||
|
22 | endif() | |||
|
23 | if(NOT NinjaExec) | |||
|
24 | set (NinjaExec ninja) | |||
|
25 | endif() | |||
|
26 | ||||
|
27 | SET(CATALOGUEAPI_SOURCES_PATH ${CMAKE_SOURCE_DIR}/3rdparty/CatalogueAPI) | |||
|
28 | SET(CATALOGUEAPI_BUILD_PATH ${CATALOGUEAPI_SOURCES_PATH}/build) | |||
|
29 | SET(CATALOGUEAPI_QXORM_LIB_PATH ${CATALOGUEAPI_BUILD_PATH}/subprojects/QxOrm) | |||
|
30 | SET(CatalogueAPI_build_type plain) | |||
|
31 | ||||
|
32 | if(CMAKE_BUILD_TYPE STREQUAL "") | |||
|
33 | set(CMAKE_BUILD_TYPE Release) | |||
|
34 | endif() | |||
|
35 | string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) | |||
|
36 | ||||
|
37 | ExternalProject_Add( | |||
|
38 | CatalogueAPI | |||
|
39 | ||||
|
40 | GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI | |||
|
41 | GIT_TAG develop | |||
|
42 | ||||
|
43 | UPDATE_COMMAND ${GIT_EXECUTABLE} pull | |||
|
44 | PATCH_COMMAND "" | |||
|
45 | ||||
|
46 | SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}" | |||
|
47 | CONFIGURE_COMMAND ${MesonExec} --prefix=${CATALOGUEAPI_SOURCES_PATH} --buildtype=${CMAKE_BUILD_TYPE_TOLOWER} "${CATALOGUEAPI_SOURCES_PATH}" "${CATALOGUEAPI_BUILD_PATH}" | |||
|
48 | ||||
|
49 | BUILD_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" | |||
|
50 | INSTALL_COMMAND ${NinjaExec} -C "${CATALOGUEAPI_BUILD_PATH}" install | |||
|
51 | LOG_DOWNLOAD 1 | |||
|
52 | LOG_UPDATE 1 | |||
|
53 | ) | |||
|
54 | ||||
|
55 | set(CATALOG_LIB_PATH lib) | |||
|
56 | if(WIN32) | |||
|
57 | set(CATALOG_LIB_PATH bin) | |||
|
58 | endif() | |||
|
59 | ||||
|
60 | ExternalProject_Add_Step( | |||
|
61 | CatalogueAPI CopyToBin | |||
|
62 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_SOURCES_PATH}/lib64 ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH} | |||
|
63 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_QXORM_LIB_PATH} ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH} | |||
|
64 | DEPENDEES install | |||
|
65 | ) | |||
|
66 | ||||
|
67 | ||||
|
68 | set(CATALOGUEAPI_INCLUDE ${CATALOGUEAPI_SOURCES_PATH}/src) | |||
|
69 | set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}CatalogueAPI${CMAKE_SHARED_LIBRARY_SUFFIX}) | |||
|
70 | list(APPEND CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/${CATALOG_LIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}QxOrm${CMAKE_SHARED_LIBRARY_SUFFIX}) | |||
|
71 | ||||
|
72 | mark_as_advanced(CATALOGUEAPI_INCLUDE) | |||
|
73 | mark_as_advanced(CATALOGUEAPI_LIBRARIES) |
@@ -0,0 +1,4 | |||||
|
1 | [wrap-git] | |||
|
2 | directory=CatalogueAPI | |||
|
3 | url=https://hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI.git | |||
|
4 | revision=head |
@@ -0,0 +1,5 | |||||
|
1 | [wrap-git] | |||
|
2 | directory=QxOrm | |||
|
3 | url=https://github.com/jeandet/qxorm.git | |||
|
4 | revision=head | |||
|
5 |
@@ -1,5 +1,6 | |||||
1 | build/ |
|
1 | build/ | |
2 | CMakeLists.txt.user |
|
2 | CMakeLists.txt.user | |
3 | /.project |
|
3 | /.project | |
4 | core/src/Version.cpp |
|
4 | core/src/Version.cpp | |
5 | core/include/Version.h |
|
5 | core/include/Version.h | |
|
6 | 3rdparty/ |
@@ -1,12 +1,18 | |||||
1 | ο»Ώ |
|
1 | ο»Ώ | |
2 |
|
2 | |||
3 | ## Main CMakeLists for SCIQLOP |
|
3 | ## Main CMakeLists for SCIQLOP | |
4 | CMAKE_MINIMUM_REQUIRED (VERSION 3.6.1) |
|
4 | CMAKE_MINIMUM_REQUIRED (VERSION 3.6.1) | |
5 | cmake_policy(VERSION 3.6) |
|
5 | cmake_policy(VERSION 3.6) | |
6 |
|
6 | |||
7 | PROJECT(SCIQLOP) |
|
7 | PROJECT(SCIQLOP) | |
8 |
|
8 | |||
|
9 | ||||
|
10 | # | |||
|
11 | # build the CatalogueAPI dependencu | |||
|
12 | # | |||
|
13 | INCLUDE("extern/CatalogueAPI.cmake") | |||
|
14 | ||||
9 | # |
|
15 | # | |
10 | # build the project |
|
16 | # build the project | |
11 | # |
|
17 | # | |
12 | INCLUDE("cmake/sciqlop.cmake") No newline at end of file |
|
18 | INCLUDE("cmake/sciqlop.cmake") |
@@ -1,36 +1,36 | |||||
1 | STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TO_LOWER) |
|
1 | STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TO_LOWER) | |
2 | SET(WINDEPLOYQT_ARGS --${CMAKE_BUILD_TYPE_TO_LOWER} --list mapping --no-system-d3d-compiler --compiler-runtime --dry-run) |
|
2 | SET(WINDEPLOYQT_ARGS --${CMAKE_BUILD_TYPE_TO_LOWER} --list mapping -network -sql --no-system-d3d-compiler --compiler-runtime --dry-run) | |
3 |
|
3 | |||
4 | #FOREACH(qtModule @_qt5_modules@) |
|
4 | #FOREACH(qtModule @_qt5_modules@) | |
5 | # STRING(TOLOWER ${qtModule} qtLowerModule) |
|
5 | # STRING(TOLOWER ${qtModule} qtLowerModule) | |
6 | # SET(WINDEPLOYQT_ARGS ${WINDEPLOYQT_ARGS} -${qtLowerModule}) |
|
6 | # SET(WINDEPLOYQT_ARGS ${WINDEPLOYQT_ARGS} -${qtLowerModule}) | |
7 | #ENDFOREACH() |
|
7 | #ENDFOREACH() | |
8 |
|
8 | |||
9 | EXECUTE_PROCESS( |
|
9 | EXECUTE_PROCESS( | |
10 | COMMAND windeployqt ${WINDEPLOYQT_ARGS} -printsupport ${SCIQLOP_EXE_LOCATION} |
|
10 | COMMAND windeployqt ${WINDEPLOYQT_ARGS} -printsupport ${SCIQLOP_EXE_LOCATION} | |
11 | OUTPUT_VARIABLE QT_FILES |
|
11 | OUTPUT_VARIABLE QT_FILES | |
12 | ) |
|
12 | ) | |
13 |
|
13 | |||
14 | IF( QT_FILES ) |
|
14 | IF( QT_FILES ) | |
15 |
|
15 | |||
16 | STRING(REPLACE "\n" ";" QT_FILES ${QT_FILES}) |
|
16 | STRING(REPLACE "\n" ";" QT_FILES ${QT_FILES}) | |
17 | LIST(APPEND QT_FILES_LIST ${QT_FILES}) |
|
17 | LIST(APPEND QT_FILES_LIST ${QT_FILES}) | |
18 | FOREACH(QtFile ${QT_FILES_LIST}) |
|
18 | FOREACH(QtFile ${QT_FILES_LIST}) | |
19 | STRING(REPLACE "\"" "" QtFile ${QtFile}) |
|
19 | STRING(REPLACE "\"" "" QtFile ${QtFile}) | |
20 | STRING(REPLACE "\\" "/" QtFile ${QtFile}) |
|
20 | STRING(REPLACE "\\" "/" QtFile ${QtFile}) | |
21 | STRING(REGEX MATCH "^(.*) " QtFileSource ${QtFile}) |
|
21 | STRING(REGEX MATCH "^(.*) " QtFileSource ${QtFile}) | |
22 | STRING(REGEX MATCH " (.*)$" QtFileTarget ${QtFile}) |
|
22 | STRING(REGEX MATCH " (.*)$" QtFileTarget ${QtFile}) | |
23 |
|
23 | |||
24 | STRING(STRIP ${QtFileSource} QtFileSource) |
|
24 | STRING(STRIP ${QtFileSource} QtFileSource) | |
25 | STRING(STRIP ${QtFileTarget} QtFileTarget) |
|
25 | STRING(STRIP ${QtFileTarget} QtFileTarget) | |
26 | GET_FILENAME_COMPONENT(QtFileTargetDir ${QtFileTarget} DIRECTORY) |
|
26 | GET_FILENAME_COMPONENT(QtFileTargetDir ${QtFileTarget} DIRECTORY) | |
27 |
|
27 | |||
28 | IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/${EXECUTABLE_OUTPUT_PATH}/${QtFileTarget}") |
|
28 | IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/${EXECUTABLE_OUTPUT_PATH}/${QtFileTarget}") | |
29 | GET_FILENAME_COMPONENT(QtFileTargetDir ${QtFileTarget} DIRECTORY) |
|
29 | GET_FILENAME_COMPONENT(QtFileTargetDir ${QtFileTarget} DIRECTORY) | |
30 | FILE(INSTALL DESTINATION "${EXECUTABLE_OUTPUT_PATH}/${QtFileTargetDir}" FILES "${QtFileSource}") |
|
30 | FILE(INSTALL DESTINATION "${EXECUTABLE_OUTPUT_PATH}/${QtFileTargetDir}" FILES "${QtFileSource}") | |
31 | ENDIF() |
|
31 | ENDIF() | |
32 | ENDFOREACH() |
|
32 | ENDFOREACH() | |
33 |
|
33 | |||
34 | ENDIF() |
|
34 | ENDIF() | |
35 |
|
35 | |||
36 | MESSAGE( "Exec windeployqt done" ) |
|
36 | MESSAGE( "Exec windeployqt done" ) |
@@ -1,159 +1,173 | |||||
1 |
|
||||
2 | ## core - CMakeLists.txt |
|
1 | ## core - CMakeLists.txt | |
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
2 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) | |
4 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") |
|
3 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") | |
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") |
|
4 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") | |
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") |
|
5 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") | |
7 | SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources") |
|
6 | SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources") | |
8 |
|
7 | |||
9 | # Include core directory |
|
8 | # Include core directory | |
10 | include_directories("${INCLUDES_DIR}") |
|
9 | include_directories("${INCLUDES_DIR}") | |
11 |
|
10 | |||
12 | # Set a variable to display a warning in the version files. |
|
11 | # Set a variable to display a warning in the version files. | |
13 | 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.") | |
14 | # Generate the version file from the cmake version variables. The version |
|
13 | # Generate the version file from the cmake version variables. The version | |
15 | # variables are defined in the cmake/sciqlop_version.cmake file. |
|
14 | # variables are defined in the cmake/sciqlop_version.cmake file. | |
16 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" |
|
15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" | |
17 | "${INCLUDES_DIR}/Version.h") |
|
16 | "${INCLUDES_DIR}/Version.h") | |
18 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" |
|
17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" | |
19 | "${SOURCES_DIR}/Version.cpp") |
|
18 | "${SOURCES_DIR}/Version.cpp") | |
20 |
|
19 | |||
21 | # Find dependent modules |
|
20 | # Find dependent modules | |
22 | find_package(sciqlop-plugin) |
|
21 | find_package(sciqlop-plugin) | |
23 | INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR}) |
|
22 | INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR}) | |
24 |
|
23 | |||
25 | # |
|
24 | # | |
26 | # Find Qt modules |
|
25 | # Find Qt modules | |
27 | # |
|
26 | # | |
28 | SCIQLOP_FIND_QT(Core Network) |
|
27 | SCIQLOP_FIND_QT(Core Network) | |
29 |
|
28 | |||
30 | # |
|
29 | # | |
31 | # Compile the library library |
|
30 | # Compile the library library | |
32 | # |
|
31 | # | |
33 |
|
32 | |||
34 | ADD_DEFINITIONS(-DCORE_LIB) |
|
33 | ADD_DEFINITIONS(-DCORE_LIB) | |
35 |
|
34 | |||
36 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
35 | FILE (GLOB_RECURSE MODULE_SOURCES | |
37 | ${INCLUDES_DIR}/*.h |
|
36 | ${INCLUDES_DIR}/*.h | |
38 | ${SOURCES_DIR}/*.c |
|
37 | ${SOURCES_DIR}/*.c | |
39 | ${SOURCES_DIR}/*.cpp |
|
38 | ${SOURCES_DIR}/*.cpp | |
40 | ${SOURCES_DIR}/*.h) |
|
39 | ${SOURCES_DIR}/*.h) | |
41 |
|
40 | |||
42 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) |
|
41 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) | |
43 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
42 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) | |
44 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
43 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) | |
45 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) |
|
44 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) | |
46 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network) |
|
45 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network) | |
47 |
|
46 | |||
|
47 | # Find CATALOGUE_API | |||
|
48 | include_directories("${CATALOGUEAPI_INCLUDE}") | |||
|
49 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) | |||
48 | INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME} |
|
50 | INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME} | |
49 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
51 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} | |
50 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
|
52 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | |
51 | ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} |
|
53 | ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} | |
52 | ) |
|
54 | ) | |
53 |
|
55 | |||
|
56 | add_dependencies(${SQPCORE_LIBRARY_NAME} CatalogueAPI) | |||
|
57 | ||||
54 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
58 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html | |
55 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
59 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. | |
56 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
60 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets | |
57 | IF(BUILD_SHARED_LIBS) |
|
61 | IF(BUILD_SHARED_LIBS) | |
58 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
62 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") | |
59 | ELSE() |
|
63 | ELSE() | |
60 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
64 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") | |
61 | ENDIF() |
|
65 | ENDIF() | |
62 |
|
66 | |||
63 | # Set the variable to parent scope so that the other projects can copy the |
|
67 | # Set the variable to parent scope so that the other projects can copy the | |
64 | # dependent shared libraries |
|
68 | # dependent shared libraries | |
65 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) |
|
69 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) | |
66 |
|
70 | |||
67 | # Copy extern shared libraries to the lib folder |
|
71 | ## Copy extern shared libraries to the lib folder | |
68 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) |
|
72 | LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES}) | |
69 |
|
73 | |||
|
74 | ||||
|
75 | SET (COPY_LIBS_DESTINATION LIBRARY) | |||
|
76 | if(APPLE) | |||
|
77 | SET (COPY_LIBS_DESTINATION RUNTIME) | |||
|
78 | endif() | |||
|
79 | ||||
|
80 | add_custom_command(TARGET ${SQPCORE_LIBRARY_NAME} POST_BUILD | |||
|
81 | COMMAND ${CMAKE_COMMAND} -E copy ${CATALOGUEAPI_LIBRARIES} ${EXECUTABLE_OUTPUT_PATH} | |||
|
82 | ) | |||
|
83 | ||||
70 | # Add the files to the list of files to be analyzed |
|
84 | # Add the files to the list of files to be analyzed | |
71 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
85 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) | |
72 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
86 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) | |
73 | # Vera++ exclusion files |
|
87 | # Vera++ exclusion files | |
74 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
88 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) | |
75 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
89 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) | |
76 |
|
90 | |||
77 | # |
|
91 | # | |
78 | # Compile the tests |
|
92 | # Compile the tests | |
79 | # |
|
93 | # | |
80 | IF(BUILD_TESTS) |
|
94 | IF(BUILD_TESTS) | |
81 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
95 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) | |
82 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
96 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) | |
83 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
97 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) | |
84 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
98 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) | |
|
99 | list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES}) | |||
85 |
|
100 | |||
86 | SET(TARGETS_COV) |
|
101 | SET(TARGETS_COV) | |
87 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
102 | FOREACH( testFile ${TESTS_SOURCES} ) | |
88 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
103 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) | |
89 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
104 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) | |
90 |
|
105 | |||
91 | # Add to the list of sources files all the sources in the same |
|
106 | # Add to the list of sources files all the sources in the same | |
92 | # directory that aren't another test |
|
107 | # directory that aren't another test | |
93 | FILE (GLOB currentTestSources |
|
108 | FILE (GLOB currentTestSources | |
94 | ${testDirectory}/*.c |
|
109 | ${testDirectory}/*.c | |
95 | ${testDirectory}/*.cpp |
|
110 | ${testDirectory}/*.cpp | |
96 | ${testDirectory}/*.h) |
|
111 | ${testDirectory}/*.h) | |
97 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
112 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) | |
98 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
113 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) | |
99 |
|
114 | |||
100 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
115 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) | |
101 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
116 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) | |
102 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
117 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) | |
103 |
TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} |
|
118 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES}) | |
104 | qt5_use_modules(${testName} Test) |
|
119 | qt5_use_modules(${testName} Test) | |
105 |
|
120 | |||
106 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
121 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) | |
107 |
|
122 | |||
108 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
|||
109 | set(Coverage_NAME ${testName}) |
|
123 | set(Coverage_NAME ${testName}) | |
110 | if(UNIX) |
|
124 | if(UNIX) | |
111 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) |
|
125 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) | |
112 | LIST( APPEND TARGETS_COV ${testName}_coverage) |
|
126 | LIST( APPEND TARGETS_COV ${testName}_coverage) | |
113 | endif(UNIX) |
|
127 | endif(UNIX) | |
114 |
|
128 | |||
115 | ENDFOREACH( testFile ) |
|
129 | ENDFOREACH( testFile ) | |
116 |
|
130 | |||
117 | add_custom_target(coverage) |
|
131 | add_custom_target(coverage) | |
118 |
|
132 | |||
119 | FOREACH( target_cov ${TARGETS_COV} ) |
|
133 | FOREACH( target_cov ${TARGETS_COV} ) | |
120 | add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov}) |
|
134 | add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov}) | |
121 | ENDFOREACH( target_cov ) |
|
135 | ENDFOREACH( target_cov ) | |
122 |
|
136 | |||
123 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
137 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) | |
124 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
138 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) | |
125 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
139 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) | |
126 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
140 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
127 |
|
141 | |||
128 | ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}") |
|
142 | ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}") | |
129 | ENDIF(BUILD_TESTS) |
|
143 | ENDIF(BUILD_TESTS) | |
130 |
|
144 | |||
131 | # |
|
145 | # | |
132 | # Set the files that must be formatted by clang-format. |
|
146 | # Set the files that must be formatted by clang-format. | |
133 | # |
|
147 | # | |
134 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
148 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) | |
135 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
149 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
136 |
|
150 | |||
137 | # |
|
151 | # | |
138 | # Set the directories that doxygen must browse to generate the |
|
152 | # Set the directories that doxygen must browse to generate the | |
139 | # documentation. |
|
153 | # documentation. | |
140 | # |
|
154 | # | |
141 | # Source directories: |
|
155 | # Source directories: | |
142 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
156 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") | |
143 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
157 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
144 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
158 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) | |
145 | # Source directories to exclude from the documentation generation |
|
159 | # Source directories to exclude from the documentation generation | |
146 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
160 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") | |
147 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
161 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) | |
148 |
|
162 | |||
149 | # |
|
163 | # | |
150 | # Set the directories with the sources to analyze and propagate the |
|
164 | # Set the directories with the sources to analyze and propagate the | |
151 | # modification to the parent scope |
|
165 | # modification to the parent scope | |
152 | # |
|
166 | # | |
153 | # Source directories to analyze: |
|
167 | # Source directories to analyze: | |
154 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
168 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
155 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
169 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") | |
156 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
170 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) | |
157 | # Source directories to exclude from the analysis |
|
171 | # Source directories to exclude from the analysis | |
158 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
172 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") | |
159 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
173 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
@@ -1,66 +1,73 | |||||
1 |
|
1 | |||
|
2 | qxorm_dep = dependency('QxOrm', required : true, fallback:['QxOrm','qxorm_dep']) | |||
|
3 | catalogueapi_dep = dependency('CatalogueAPI', required : true, fallback:['CatalogueAPI','CatalogueAPI_dep']) | |||
|
4 | ||||
|
5 | ||||
2 | core_moc_headers = [ |
|
6 | core_moc_headers = [ | |
|
7 | 'include/Catalogue/CatalogueController.h', | |||
3 | 'include/Data/IDataProvider.h', |
|
8 | 'include/Data/IDataProvider.h', | |
4 | 'include/DataSource/DataSourceController.h', |
|
9 | 'include/DataSource/DataSourceController.h', | |
5 | 'include/DataSource/DataSourceItemAction.h', |
|
10 | 'include/DataSource/DataSourceItemAction.h', | |
6 | 'include/Network/NetworkController.h', |
|
11 | 'include/Network/NetworkController.h', | |
7 | 'include/Time/TimeController.h', |
|
12 | 'include/Time/TimeController.h', | |
8 | 'include/Variable/Variable.h', |
|
13 | 'include/Variable/Variable.h', | |
9 | 'include/Variable/VariableCacheController.h', |
|
14 | 'include/Variable/VariableCacheController.h', | |
10 | 'include/Variable/VariableController.h', |
|
15 | 'include/Variable/VariableController.h', | |
11 | 'include/Variable/VariableAcquisitionWorker.h', |
|
16 | 'include/Variable/VariableAcquisitionWorker.h', | |
12 | 'include/Variable/VariableSynchronizationGroup.h', |
|
17 | 'include/Variable/VariableSynchronizationGroup.h', | |
13 | 'include/Variable/VariableModel.h', |
|
18 | 'include/Variable/VariableModel.h', | |
14 | 'include/Visualization/VisualizationController.h' |
|
19 | 'include/Visualization/VisualizationController.h' | |
15 | ] |
|
20 | ] | |
16 |
|
21 | |||
17 |
|
22 | |||
18 | core_moc_files = qt5.preprocess(moc_headers : core_moc_headers) |
|
23 | core_moc_files = qt5.preprocess(moc_headers : core_moc_headers) | |
19 |
|
24 | |||
20 | core_sources = [ |
|
25 | core_sources = [ | |
21 | 'src/Common/DateUtils.cpp', |
|
26 | 'src/Common/DateUtils.cpp', | |
22 | 'src/Common/StringUtils.cpp', |
|
27 | 'src/Common/StringUtils.cpp', | |
23 | 'src/Common/MimeTypesDef.cpp', |
|
28 | 'src/Common/MimeTypesDef.cpp', | |
|
29 | 'src/Catalogue/CatalogueController.cpp', | |||
24 | 'src/Data/ScalarSeries.cpp', |
|
30 | 'src/Data/ScalarSeries.cpp', | |
25 | 'src/Data/SpectrogramSeries.cpp', |
|
31 | 'src/Data/SpectrogramSeries.cpp', | |
26 | 'src/Data/DataSeriesIterator.cpp', |
|
32 | 'src/Data/DataSeriesIterator.cpp', | |
27 | 'src/Data/ArrayDataIterator.cpp', |
|
33 | 'src/Data/ArrayDataIterator.cpp', | |
28 | 'src/Data/VectorSeries.cpp', |
|
34 | 'src/Data/VectorSeries.cpp', | |
29 | 'src/Data/OptionalAxis.cpp', |
|
35 | 'src/Data/OptionalAxis.cpp', | |
30 | 'src/Data/DataSeriesUtils.cpp', |
|
36 | 'src/Data/DataSeriesUtils.cpp', | |
31 | 'src/DataSource/DataSourceController.cpp', |
|
37 | 'src/DataSource/DataSourceController.cpp', | |
32 | 'src/DataSource/DataSourceItem.cpp', |
|
38 | 'src/DataSource/DataSourceItem.cpp', | |
33 | 'src/DataSource/DataSourceItemAction.cpp', |
|
39 | 'src/DataSource/DataSourceItemAction.cpp', | |
34 | 'src/DataSource/DataSourceItemMergeHelper.cpp', |
|
40 | 'src/DataSource/DataSourceItemMergeHelper.cpp', | |
35 | 'src/Network/NetworkController.cpp', |
|
41 | 'src/Network/NetworkController.cpp', | |
36 | 'src/Plugin/PluginManager.cpp', |
|
42 | 'src/Plugin/PluginManager.cpp', | |
37 | 'src/Settings/SqpSettingsDefs.cpp', |
|
43 | 'src/Settings/SqpSettingsDefs.cpp', | |
38 | 'src/Time/TimeController.cpp', |
|
44 | 'src/Time/TimeController.cpp', | |
39 | 'src/Variable/Variable.cpp', |
|
45 | 'src/Variable/Variable.cpp', | |
40 | 'src/Variable/VariableCacheController.cpp', |
|
46 | 'src/Variable/VariableCacheController.cpp', | |
41 | 'src/Variable/VariableController.cpp', |
|
47 | 'src/Variable/VariableController.cpp', | |
42 | 'src/Variable/VariableAcquisitionWorker.cpp', |
|
48 | 'src/Variable/VariableAcquisitionWorker.cpp', | |
43 | 'src/Variable/VariableSynchronizationGroup.cpp', |
|
49 | 'src/Variable/VariableSynchronizationGroup.cpp', | |
44 | 'src/Variable/VariableModel.cpp', |
|
50 | 'src/Variable/VariableModel.cpp', | |
45 | 'src/Visualization/VisualizationController.cpp' |
|
51 | 'src/Visualization/VisualizationController.cpp' | |
46 | ] |
|
52 | ] | |
47 |
|
53 | |||
48 | core_inc = include_directories(['include', '../plugin/include']) |
|
54 | core_inc = include_directories(['include', '../plugin/include']) | |
49 |
|
55 | |||
50 | sciqlop_core_lib = library('sciqlopcore', |
|
56 | sciqlop_core_lib = library('sciqlopcore', | |
51 | core_sources, |
|
57 | core_sources, | |
52 | core_moc_files, |
|
58 | core_moc_files, | |
53 | cpp_args : '-DCORE_LIB', |
|
59 | cpp_args : '-DCORE_LIB', | |
54 | include_directories : core_inc, |
|
60 | include_directories : core_inc, | |
55 | dependencies : [qt5core, qt5network], |
|
61 | dependencies : [qt5core, qt5network, catalogueapi_dep], | |
56 | install : true |
|
62 | install : true | |
57 | ) |
|
63 | ) | |
58 |
|
64 | |||
59 |
|
65 | |||
60 | sciqlop_core = declare_dependency(link_with : sciqlop_core_lib, |
|
66 | sciqlop_core = declare_dependency(link_with : sciqlop_core_lib, | |
61 | include_directories : core_inc, |
|
67 | include_directories : core_inc, | |
62 | dependencies : [qt5core, qt5network]) |
|
68 | dependencies : [qt5core, qt5network, catalogueapi_dep]) | |
|
69 | ||||
63 |
|
70 | |||
64 |
|
71 | |||
65 | subdir('tests') |
|
72 | subdir('tests') | |
66 |
|
73 |
@@ -1,188 +1,203 | |||||
1 | #include "SqpApplication.h" |
|
1 | #include "SqpApplication.h" | |
2 |
|
2 | |||
|
3 | #include <Catalogue/CatalogueController.h> | |||
3 | #include <Data/IDataProvider.h> |
|
4 | #include <Data/IDataProvider.h> | |
4 | #include <DataSource/DataSourceController.h> |
|
5 | #include <DataSource/DataSourceController.h> | |
5 | #include <DragAndDrop/DragDropHelper.h> |
|
6 | #include <DragAndDrop/DragDropHelper.h> | |
6 | #include <Network/NetworkController.h> |
|
7 | #include <Network/NetworkController.h> | |
7 | #include <QThread> |
|
8 | #include <QThread> | |
8 | #include <Time/TimeController.h> |
|
9 | #include <Time/TimeController.h> | |
9 | #include <Variable/Variable.h> |
|
10 | #include <Variable/Variable.h> | |
10 | #include <Variable/VariableController.h> |
|
11 | #include <Variable/VariableController.h> | |
11 | #include <Variable/VariableModel.h> |
|
12 | #include <Variable/VariableModel.h> | |
12 | #include <Visualization/VisualizationController.h> |
|
13 | #include <Visualization/VisualizationController.h> | |
13 |
|
14 | |||
14 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
15 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |
15 |
|
16 | |||
16 | class SqpApplication::SqpApplicationPrivate { |
|
17 | class SqpApplication::SqpApplicationPrivate { | |
17 | public: |
|
18 | public: | |
18 | SqpApplicationPrivate() |
|
19 | SqpApplicationPrivate() | |
19 | : m_DataSourceController{std::make_unique<DataSourceController>()}, |
|
20 | : m_DataSourceController{std::make_unique<DataSourceController>()}, | |
20 | m_VariableController{std::make_unique<VariableController>()}, |
|
21 | m_VariableController{std::make_unique<VariableController>()}, | |
21 | m_TimeController{std::make_unique<TimeController>()}, |
|
22 | m_TimeController{std::make_unique<TimeController>()}, | |
22 | m_NetworkController{std::make_unique<NetworkController>()}, |
|
23 | m_NetworkController{std::make_unique<NetworkController>()}, | |
23 | m_VisualizationController{std::make_unique<VisualizationController>()}, |
|
24 | m_VisualizationController{std::make_unique<VisualizationController>()}, | |
24 | m_DragDropHelper{std::make_unique<DragDropHelper>()}, |
|
25 | m_DragDropHelper{std::make_unique<DragDropHelper>()}, | |
|
26 | m_CatalogueController{std::make_unique<CatalogueController>()}, | |||
25 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), |
|
27 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), | |
26 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) |
|
28 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) | |
27 | { |
|
29 | { | |
28 | // /////////////////////////////// // |
|
30 | // /////////////////////////////// // | |
29 | // Connections between controllers // |
|
31 | // Connections between controllers // | |
30 | // /////////////////////////////// // |
|
32 | // /////////////////////////////// // | |
31 |
|
33 | |||
32 | // VariableController <-> DataSourceController |
|
34 | // VariableController <-> DataSourceController | |
33 | connect(m_DataSourceController.get(), |
|
35 | connect(m_DataSourceController.get(), | |
34 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, |
|
36 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, | |
35 | std::shared_ptr<IDataProvider>)), |
|
37 | std::shared_ptr<IDataProvider>)), | |
36 | m_VariableController.get(), |
|
38 | m_VariableController.get(), | |
37 | SLOT(createVariable(const QString &, const QVariantHash &, |
|
39 | SLOT(createVariable(const QString &, const QVariantHash &, | |
38 | std::shared_ptr<IDataProvider>))); |
|
40 | std::shared_ptr<IDataProvider>))); | |
39 |
|
41 | |||
40 | connect(m_VariableController->variableModel(), &VariableModel::requestVariable, |
|
42 | connect(m_VariableController->variableModel(), &VariableModel::requestVariable, | |
41 | m_DataSourceController.get(), &DataSourceController::requestVariable); |
|
43 | m_DataSourceController.get(), &DataSourceController::requestVariable); | |
42 |
|
44 | |||
43 | // VariableController <-> VisualizationController |
|
45 | // VariableController <-> VisualizationController | |
44 | connect(m_VariableController.get(), |
|
46 | connect(m_VariableController.get(), | |
45 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), |
|
47 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), | |
46 | m_VisualizationController.get(), |
|
48 | m_VisualizationController.get(), | |
47 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); |
|
49 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); | |
48 |
|
50 | |||
49 | connect(m_VariableController.get(), |
|
51 | connect(m_VariableController.get(), | |
50 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), |
|
52 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), | |
51 | m_VisualizationController.get(), |
|
53 | m_VisualizationController.get(), | |
52 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &))); |
|
54 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &))); | |
53 |
|
55 | |||
54 |
|
56 | |||
55 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
57 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
56 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); |
|
58 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); | |
57 | m_NetworkController->moveToThread(&m_NetworkControllerThread); |
|
59 | m_NetworkController->moveToThread(&m_NetworkControllerThread); | |
58 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); |
|
60 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); | |
59 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
61 | m_VariableController->moveToThread(&m_VariableControllerThread); | |
60 | m_VariableControllerThread.setObjectName("VariableControllerThread"); |
|
62 | m_VariableControllerThread.setObjectName("VariableControllerThread"); | |
61 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
63 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |
62 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
64 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); | |
|
65 | m_CatalogueController->moveToThread(&m_CatalogueControllerThread); | |||
|
66 | m_CatalogueControllerThread.setObjectName("CatalogueControllerThread"); | |||
63 |
|
67 | |||
64 |
|
68 | |||
65 | // Additionnal init |
|
69 | // Additionnal init | |
66 | m_VariableController->setTimeController(m_TimeController.get()); |
|
70 | m_VariableController->setTimeController(m_TimeController.get()); | |
67 | } |
|
71 | } | |
68 |
|
72 | |||
69 | virtual ~SqpApplicationPrivate() |
|
73 | virtual ~SqpApplicationPrivate() | |
70 | { |
|
74 | { | |
71 | m_DataSourceControllerThread.quit(); |
|
75 | m_DataSourceControllerThread.quit(); | |
72 | m_DataSourceControllerThread.wait(); |
|
76 | m_DataSourceControllerThread.wait(); | |
73 |
|
77 | |||
74 | m_NetworkControllerThread.quit(); |
|
78 | m_NetworkControllerThread.quit(); | |
75 | m_NetworkControllerThread.wait(); |
|
79 | m_NetworkControllerThread.wait(); | |
76 |
|
80 | |||
77 | m_VariableControllerThread.quit(); |
|
81 | m_VariableControllerThread.quit(); | |
78 | m_VariableControllerThread.wait(); |
|
82 | m_VariableControllerThread.wait(); | |
79 |
|
83 | |||
80 | m_VisualizationControllerThread.quit(); |
|
84 | m_VisualizationControllerThread.quit(); | |
81 | m_VisualizationControllerThread.wait(); |
|
85 | m_VisualizationControllerThread.wait(); | |
|
86 | ||||
|
87 | m_CatalogueControllerThread.quit(); | |||
|
88 | m_CatalogueControllerThread.wait(); | |||
82 | } |
|
89 | } | |
83 |
|
90 | |||
84 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
91 | std::unique_ptr<DataSourceController> m_DataSourceController; | |
85 | std::unique_ptr<VariableController> m_VariableController; |
|
92 | std::unique_ptr<VariableController> m_VariableController; | |
86 | std::unique_ptr<TimeController> m_TimeController; |
|
93 | std::unique_ptr<TimeController> m_TimeController; | |
87 | std::unique_ptr<NetworkController> m_NetworkController; |
|
94 | std::unique_ptr<NetworkController> m_NetworkController; | |
88 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
95 | std::unique_ptr<VisualizationController> m_VisualizationController; | |
|
96 | std::unique_ptr<CatalogueController> m_CatalogueController; | |||
89 | QThread m_DataSourceControllerThread; |
|
97 | QThread m_DataSourceControllerThread; | |
90 | QThread m_NetworkControllerThread; |
|
98 | QThread m_NetworkControllerThread; | |
91 | QThread m_VariableControllerThread; |
|
99 | QThread m_VariableControllerThread; | |
92 | QThread m_VisualizationControllerThread; |
|
100 | QThread m_VisualizationControllerThread; | |
|
101 | QThread m_CatalogueControllerThread; | |||
93 |
|
102 | |||
94 | std::unique_ptr<DragDropHelper> m_DragDropHelper; |
|
103 | std::unique_ptr<DragDropHelper> m_DragDropHelper; | |
95 |
|
104 | |||
96 | SqpApplication::PlotsInteractionMode m_PlotInterractionMode; |
|
105 | SqpApplication::PlotsInteractionMode m_PlotInterractionMode; | |
97 | SqpApplication::PlotsCursorMode m_PlotCursorMode; |
|
106 | SqpApplication::PlotsCursorMode m_PlotCursorMode; | |
98 | }; |
|
107 | }; | |
99 |
|
108 | |||
100 |
|
109 | |||
101 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
110 | SqpApplication::SqpApplication(int &argc, char **argv) | |
102 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
111 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |
103 | { |
|
112 | { | |
104 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); |
|
113 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); | |
105 |
|
114 | |||
106 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
115 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |
107 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
116 | impl->m_DataSourceController.get(), &DataSourceController::initialize); | |
108 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
117 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |
109 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
118 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |
110 |
|
119 | |||
111 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), |
|
120 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), | |
112 | &NetworkController::initialize); |
|
121 | &NetworkController::initialize); | |
113 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), |
|
122 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), | |
114 | &NetworkController::finalize); |
|
123 | &NetworkController::finalize); | |
115 |
|
124 | |||
116 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), |
|
125 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), | |
117 | &VariableController::initialize); |
|
126 | &VariableController::initialize); | |
118 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), |
|
127 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), | |
119 | &VariableController::finalize); |
|
128 | &VariableController::finalize); | |
120 |
|
129 | |||
121 | connect(&impl->m_VisualizationControllerThread, &QThread::started, |
|
130 | connect(&impl->m_VisualizationControllerThread, &QThread::started, | |
122 | impl->m_VisualizationController.get(), &VisualizationController::initialize); |
|
131 | impl->m_VisualizationController.get(), &VisualizationController::initialize); | |
123 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
132 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, | |
124 | impl->m_VisualizationController.get(), &VisualizationController::finalize); |
|
133 | impl->m_VisualizationController.get(), &VisualizationController::finalize); | |
125 |
|
134 | |||
|
135 | connect(&impl->m_CatalogueControllerThread, &QThread::started, | |||
|
136 | impl->m_CatalogueController.get(), &CatalogueController::initialize); | |||
|
137 | connect(&impl->m_CatalogueControllerThread, &QThread::finished, | |||
|
138 | impl->m_CatalogueController.get(), &CatalogueController::finalize); | |||
|
139 | ||||
126 | impl->m_DataSourceControllerThread.start(); |
|
140 | impl->m_DataSourceControllerThread.start(); | |
127 | impl->m_NetworkControllerThread.start(); |
|
141 | impl->m_NetworkControllerThread.start(); | |
128 | impl->m_VariableControllerThread.start(); |
|
142 | impl->m_VariableControllerThread.start(); | |
129 | impl->m_VisualizationControllerThread.start(); |
|
143 | impl->m_VisualizationControllerThread.start(); | |
|
144 | impl->m_CatalogueControllerThread.start(); | |||
130 | } |
|
145 | } | |
131 |
|
146 | |||
132 | SqpApplication::~SqpApplication() |
|
147 | SqpApplication::~SqpApplication() | |
133 | { |
|
148 | { | |
134 | } |
|
149 | } | |
135 |
|
150 | |||
136 | void SqpApplication::initialize() |
|
151 | void SqpApplication::initialize() | |
137 | { |
|
152 | { | |
138 | } |
|
153 | } | |
139 |
|
154 | |||
140 | DataSourceController &SqpApplication::dataSourceController() noexcept |
|
155 | DataSourceController &SqpApplication::dataSourceController() noexcept | |
141 | { |
|
156 | { | |
142 | return *impl->m_DataSourceController; |
|
157 | return *impl->m_DataSourceController; | |
143 | } |
|
158 | } | |
144 |
|
159 | |||
145 | NetworkController &SqpApplication::networkController() noexcept |
|
160 | NetworkController &SqpApplication::networkController() noexcept | |
146 | { |
|
161 | { | |
147 | return *impl->m_NetworkController; |
|
162 | return *impl->m_NetworkController; | |
148 | } |
|
163 | } | |
149 |
|
164 | |||
150 | TimeController &SqpApplication::timeController() noexcept |
|
165 | TimeController &SqpApplication::timeController() noexcept | |
151 | { |
|
166 | { | |
152 | return *impl->m_TimeController; |
|
167 | return *impl->m_TimeController; | |
153 | } |
|
168 | } | |
154 |
|
169 | |||
155 | VariableController &SqpApplication::variableController() noexcept |
|
170 | VariableController &SqpApplication::variableController() noexcept | |
156 | { |
|
171 | { | |
157 | return *impl->m_VariableController; |
|
172 | return *impl->m_VariableController; | |
158 | } |
|
173 | } | |
159 |
|
174 | |||
160 | VisualizationController &SqpApplication::visualizationController() noexcept |
|
175 | VisualizationController &SqpApplication::visualizationController() noexcept | |
161 | { |
|
176 | { | |
162 | return *impl->m_VisualizationController; |
|
177 | return *impl->m_VisualizationController; | |
163 | } |
|
178 | } | |
164 |
|
179 | |||
165 | DragDropHelper &SqpApplication::dragDropHelper() noexcept |
|
180 | DragDropHelper &SqpApplication::dragDropHelper() noexcept | |
166 | { |
|
181 | { | |
167 | return *impl->m_DragDropHelper; |
|
182 | return *impl->m_DragDropHelper; | |
168 | } |
|
183 | } | |
169 |
|
184 | |||
170 | SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const |
|
185 | SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const | |
171 | { |
|
186 | { | |
172 | return impl->m_PlotInterractionMode; |
|
187 | return impl->m_PlotInterractionMode; | |
173 | } |
|
188 | } | |
174 |
|
189 | |||
175 | void SqpApplication::setPlotsInteractionMode(SqpApplication::PlotsInteractionMode mode) |
|
190 | void SqpApplication::setPlotsInteractionMode(SqpApplication::PlotsInteractionMode mode) | |
176 | { |
|
191 | { | |
177 | impl->m_PlotInterractionMode = mode; |
|
192 | impl->m_PlotInterractionMode = mode; | |
178 | } |
|
193 | } | |
179 |
|
194 | |||
180 | SqpApplication::PlotsCursorMode SqpApplication::plotsCursorMode() const |
|
195 | SqpApplication::PlotsCursorMode SqpApplication::plotsCursorMode() const | |
181 | { |
|
196 | { | |
182 | return impl->m_PlotCursorMode; |
|
197 | return impl->m_PlotCursorMode; | |
183 | } |
|
198 | } | |
184 |
|
199 | |||
185 | void SqpApplication::setPlotsCursorMode(SqpApplication::PlotsCursorMode mode) |
|
200 | void SqpApplication::setPlotsCursorMode(SqpApplication::PlotsCursorMode mode) | |
186 | { |
|
201 | { | |
187 | impl->m_PlotCursorMode = mode; |
|
202 | impl->m_PlotCursorMode = mode; | |
188 | } |
|
203 | } |
@@ -1,195 +1,195 | |||||
1 | #include "CosinusProvider.h" |
|
1 | #include "CosinusProvider.h" | |
2 | #include "MockDefs.h" |
|
2 | #include "MockDefs.h" | |
3 |
|
3 | |||
4 | #include <Data/DataProviderParameters.h> |
|
4 | #include <Data/DataProviderParameters.h> | |
5 | #include <Data/ScalarSeries.h> |
|
5 | #include <Data/ScalarSeries.h> | |
6 | #include <SqpApplication.h> |
|
6 | #include <SqpApplication.h> | |
7 | #include <Time/TimeController.h> |
|
7 | #include <Time/TimeController.h> | |
8 | #include <Variable/Variable.h> |
|
8 | #include <Variable/Variable.h> | |
9 | #include <Variable/VariableController.h> |
|
9 | #include <Variable/VariableController.h> | |
10 |
|
10 | |||
11 | #include <QObject> |
|
11 | #include <QObject> | |
12 | #include <QtTest> |
|
12 | #include <QtTest> | |
13 |
|
13 | |||
14 | #include <cmath> |
|
14 | #include <cmath> | |
15 | #include <memory> |
|
15 | #include <memory> | |
16 |
|
16 | |||
17 | namespace { |
|
17 | namespace { | |
18 |
|
18 | |||
19 | /// Path for the tests |
|
19 | /// Path for the tests | |
20 | const auto TESTS_RESOURCES_PATH = QFileInfo{ |
|
20 | const auto TESTS_RESOURCES_PATH = QFileInfo{ | |
21 | QString{MOCKPLUGIN_TESTS_RESOURCES_DIR}, |
|
21 | QString{MOCKPLUGIN_TESTS_RESOURCES_DIR}, | |
22 | "TestCosinusAcquisition"}.absoluteFilePath(); |
|
22 | "TestCosinusAcquisition"}.absoluteFilePath(); | |
23 |
|
23 | |||
24 | /// Format of dates in data files |
|
24 | /// Format of dates in data files | |
25 | const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss:zzz"); |
|
25 | const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss:zzz"); | |
26 |
|
26 | |||
27 | /** |
|
27 | /** | |
28 | * Verifies that the data in the candidate series are identical to the data in the reference series |
|
28 | * Verifies that the data in the candidate series are identical to the data in the reference series | |
29 | * in a specific range |
|
29 | * in a specific range | |
30 | * @param candidate the candidate data series |
|
30 | * @param candidate the candidate data series | |
31 | * @param range the range to check |
|
31 | * @param range the range to check | |
32 | * @param reference the reference data series |
|
32 | * @param reference the reference data series | |
33 | * @return true if the data of the candidate series and the reference series are identical in the |
|
33 | * @return true if the data of the candidate series and the reference series are identical in the | |
34 | * range, false otherwise |
|
34 | * range, false otherwise | |
35 | */ |
|
35 | */ | |
36 | bool checkDataSeries(std::shared_ptr<IDataSeries> candidate, const SqpRange &range, |
|
36 | bool checkDataSeries(std::shared_ptr<IDataSeries> candidate, const SqpRange &range, | |
37 | std::shared_ptr<IDataSeries> reference) |
|
37 | std::shared_ptr<IDataSeries> reference) | |
38 | { |
|
38 | { | |
39 | if (candidate == nullptr || reference == nullptr) { |
|
39 | if (candidate == nullptr || reference == nullptr) { | |
40 | return candidate == reference; |
|
40 | return candidate == reference; | |
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 | auto referenceIt = reference->xAxisRange(range.m_TStart, range.m_TEnd); |
|
43 | auto referenceIt = reference->xAxisRange(range.m_TStart, range.m_TEnd); | |
44 |
|
44 | |||
45 | qInfo() << "candidateSize" << std::distance(candidate->cbegin(), candidate->cend()); |
|
45 | qInfo() << "candidateSize" << std::distance(candidate->cbegin(), candidate->cend()); | |
46 | qInfo() << "refSize" << std::distance(referenceIt.first, referenceIt.second); |
|
46 | qInfo() << "refSize" << std::distance(referenceIt.first, referenceIt.second); | |
47 |
|
47 | |||
48 | return std::equal(candidate->cbegin(), candidate->cend(), referenceIt.first, referenceIt.second, |
|
48 | return std::equal(candidate->cbegin(), candidate->cend(), referenceIt.first, referenceIt.second, | |
49 | [](const auto &it1, const auto &it2) { |
|
49 | [](const auto &it1, const auto &it2) { | |
50 | // - milliseconds precision for time |
|
50 | // - milliseconds precision for time | |
51 | // - 1e-6 precision for value |
|
51 | // - 1e-6 precision for value | |
52 | return std::abs(it1.x() - it2.x()) < 1e-3 |
|
52 | return std::abs(it1.x() - it2.x()) < 1e-3 | |
53 | && std::abs(it1.value() - it2.value()) < 1e-6; |
|
53 | && std::abs(it1.value() - it2.value()) < 1e-6; | |
54 | }); |
|
54 | }); | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | } // namespace |
|
57 | } // namespace | |
58 |
|
58 | |||
59 | /** |
|
59 | /** | |
60 | * @brief The TestCosinusAcquisition class tests acquisition in SciQlop (operations like zooms in, |
|
60 | * @brief The TestCosinusAcquisition class tests acquisition in SciQlop (operations like zooms in, | |
61 | * zooms out, pans) of data from CosinusProvider |
|
61 | * zooms out, pans) of data from CosinusProvider | |
62 | * @sa CosinusProvider |
|
62 | * @sa CosinusProvider | |
63 | */ |
|
63 | */ | |
64 | class TestCosinusAcquisition : public QObject { |
|
64 | class TestCosinusAcquisition : public QObject { | |
65 | Q_OBJECT |
|
65 | Q_OBJECT | |
66 |
|
66 | |||
67 | private slots: |
|
67 | private slots: | |
68 | /// Input data for @sa testAcquisition() |
|
68 | /// Input data for @sa testAcquisition() | |
69 | void testAcquisition_data(); |
|
69 | void testAcquisition_data(); | |
70 | void testAcquisition(); |
|
70 | void testAcquisition(); | |
71 | }; |
|
71 | }; | |
72 |
|
72 | |||
73 | void TestCosinusAcquisition::testAcquisition_data() |
|
73 | void TestCosinusAcquisition::testAcquisition_data() | |
74 | { |
|
74 | { | |
75 | // ////////////// // |
|
75 | // ////////////// // | |
76 | // Test structure // |
|
76 | // Test structure // | |
77 | // ////////////// // |
|
77 | // ////////////// // | |
78 |
|
78 | |||
79 | QTest::addColumn<SqpRange>("referenceRange"); // Range for generating reference series |
|
79 | QTest::addColumn<SqpRange>("referenceRange"); // Range for generating reference series | |
80 | QTest::addColumn<SqpRange>("initialRange"); // First acquisition |
|
80 | QTest::addColumn<SqpRange>("initialRange"); // First acquisition | |
81 | QTest::addColumn<int>("operationDelay"); // Acquisitions to make |
|
81 | QTest::addColumn<int>("operationDelay"); // Acquisitions to make | |
82 | QTest::addColumn<std::vector<SqpRange> >("operations"); // Acquisitions to make |
|
82 | QTest::addColumn<std::vector<SqpRange> >("operations"); // Acquisitions to make | |
83 |
|
83 | |||
84 | // ////////// // |
|
84 | // ////////// // | |
85 | // Test cases // |
|
85 | // Test cases // | |
86 | // ////////// // |
|
86 | // ////////// // | |
87 |
|
87 | |||
88 | auto dateTime = [](int year, int month, int day, int hours, int minutes, int seconds) { |
|
88 | auto dateTime = [](int year, int month, int day, int hours, int minutes, int seconds) { | |
89 | return DateUtils::secondsSinceEpoch( |
|
89 | return DateUtils::secondsSinceEpoch( | |
90 | QDateTime{{year, month, day}, {hours, minutes, seconds}, Qt::UTC}); |
|
90 | QDateTime{{year, month, day}, {hours, minutes, seconds}, Qt::UTC}); | |
91 | }; |
|
91 | }; | |
92 |
|
92 | |||
93 | QTest::newRow("cosinus") |
|
93 | QTest::newRow("cosinus") | |
94 | << SqpRange{dateTime(2017, 1, 1, 12, 0, 0), dateTime(2017, 1, 1, 13, 0, 0)} |
|
94 | << SqpRange{dateTime(2017, 1, 1, 12, 0, 0), dateTime(2017, 1, 1, 13, 0, 0)} | |
95 | << SqpRange{dateTime(2017, 1, 1, 12, 30, 0), dateTime(2017, 1, 1, 12, 35, 1)} << 250 |
|
95 | << SqpRange{dateTime(2017, 1, 1, 12, 30, 0), dateTime(2017, 1, 1, 12, 35, 1)} << 250 | |
96 | << std::vector<SqpRange>{ |
|
96 | << std::vector<SqpRange>{ | |
97 | // Pan (jump) left |
|
97 | // Pan (jump) left | |
98 | SqpRange{dateTime(2017, 1, 1, 12, 45, 0), dateTime(2017, 1, 1, 12, 50, 0)}, |
|
98 | SqpRange{dateTime(2017, 1, 1, 12, 45, 0), dateTime(2017, 1, 1, 12, 50, 0)}, | |
99 | // Pan (jump) right |
|
99 | // Pan (jump) right | |
100 | SqpRange{dateTime(2017, 1, 1, 12, 15, 0), dateTime(2017, 1, 1, 12, 20, 0)}, |
|
100 | SqpRange{dateTime(2017, 1, 1, 12, 15, 0), dateTime(2017, 1, 1, 12, 20, 0)}, | |
101 | // Pan (overlay) right |
|
101 | // Pan (overlay) right | |
102 | SqpRange{dateTime(2017, 1, 1, 12, 14, 0), dateTime(2017, 1, 1, 12, 19, 0)}, |
|
102 | SqpRange{dateTime(2017, 1, 1, 12, 14, 0), dateTime(2017, 1, 1, 12, 19, 0)}, | |
103 | // Pan (overlay) left |
|
103 | // Pan (overlay) left | |
104 | SqpRange{dateTime(2017, 1, 1, 12, 15, 0), dateTime(2017, 1, 1, 12, 20, 0)}, |
|
104 | SqpRange{dateTime(2017, 1, 1, 12, 15, 0), dateTime(2017, 1, 1, 12, 20, 0)}, | |
105 | // Pan (overlay) left |
|
105 | // Pan (overlay) left | |
106 | SqpRange{dateTime(2017, 1, 1, 12, 16, 0), dateTime(2017, 1, 1, 12, 21, 0)}, |
|
106 | SqpRange{dateTime(2017, 1, 1, 12, 16, 0), dateTime(2017, 1, 1, 12, 21, 0)}, | |
107 | // Zoom in |
|
107 | // Zoom in | |
108 | SqpRange{dateTime(2017, 1, 1, 12, 17, 30), dateTime(2017, 1, 1, 12, 19, 30)}, |
|
108 | SqpRange{dateTime(2017, 1, 1, 12, 17, 30), dateTime(2017, 1, 1, 12, 19, 30)}, | |
109 | // Zoom out |
|
109 | // Zoom out | |
110 | SqpRange{dateTime(2017, 1, 1, 12, 12, 30), dateTime(2017, 1, 1, 12, 24, 30)}}; |
|
110 | SqpRange{dateTime(2017, 1, 1, 12, 12, 30), dateTime(2017, 1, 1, 12, 24, 30)}}; | |
111 |
|
111 | |||
112 | QTest::newRow("cosinus_big") |
|
112 | QTest::newRow("cosinus_big") | |
113 | << SqpRange{dateTime(2017, 1, 1, 1, 0, 0), dateTime(2017, 1, 5, 13, 0, 0)} |
|
113 | << SqpRange{dateTime(2017, 1, 1, 1, 0, 0), dateTime(2017, 1, 5, 13, 0, 0)} | |
114 | << SqpRange{dateTime(2017, 1, 2, 6, 30, 0), dateTime(2017, 1, 2, 18, 30, 0)} << 5000 |
|
114 | << SqpRange{dateTime(2017, 1, 2, 6, 30, 0), dateTime(2017, 1, 2, 18, 30, 0)} << 5000 | |
115 | << std::vector<SqpRange>{ |
|
115 | << std::vector<SqpRange>{ | |
116 | // Pan (jump) left |
|
116 | // Pan (jump) left | |
117 | SqpRange{dateTime(2017, 1, 1, 13, 30, 0), dateTime(2017, 1, 1, 18, 30, 0)}, |
|
117 | SqpRange{dateTime(2017, 1, 1, 13, 30, 0), dateTime(2017, 1, 1, 18, 30, 0)}, | |
118 | // Pan (jump) right |
|
118 | // Pan (jump) right | |
119 | SqpRange{dateTime(2017, 1, 3, 4, 30, 0), dateTime(2017, 1, 3, 10, 30, 0)}, |
|
119 | SqpRange{dateTime(2017, 1, 3, 4, 30, 0), dateTime(2017, 1, 3, 10, 30, 0)}, | |
120 | // Pan (overlay) right |
|
120 | // Pan (overlay) right | |
121 | SqpRange{dateTime(2017, 1, 3, 8, 30, 0), dateTime(2017, 1, 3, 12, 30, 0)}, |
|
121 | SqpRange{dateTime(2017, 1, 3, 8, 30, 0), dateTime(2017, 1, 3, 12, 30, 0)}, | |
122 | // Pan (overlay) left |
|
122 | // Pan (overlay) left | |
123 | SqpRange{dateTime(2017, 1, 2, 8, 30, 0), dateTime(2017, 1, 3, 10, 30, 0)}, |
|
123 | SqpRange{dateTime(2017, 1, 2, 8, 30, 0), dateTime(2017, 1, 3, 10, 30, 0)}, | |
124 | // Pan (overlay) left |
|
124 | // Pan (overlay) left | |
125 | SqpRange{dateTime(2017, 1, 1, 12, 30, 0), dateTime(2017, 1, 3, 5, 30, 0)}, |
|
125 | SqpRange{dateTime(2017, 1, 1, 12, 30, 0), dateTime(2017, 1, 3, 5, 30, 0)}, | |
126 | // Zoom in |
|
126 | // Zoom in | |
127 | SqpRange{dateTime(2017, 1, 2, 2, 30, 0), dateTime(2017, 1, 2, 8, 30, 0)}, |
|
127 | SqpRange{dateTime(2017, 1, 2, 2, 30, 0), dateTime(2017, 1, 2, 8, 30, 0)}, | |
128 | // Zoom out |
|
128 | // Zoom out | |
129 | SqpRange{dateTime(2017, 1, 1, 14, 30, 0), dateTime(2017, 1, 3, 12, 30, 0)}}; |
|
129 | SqpRange{dateTime(2017, 1, 1, 14, 30, 0), dateTime(2017, 1, 3, 12, 30, 0)}}; | |
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 | void TestCosinusAcquisition::testAcquisition() |
|
132 | void TestCosinusAcquisition::testAcquisition() | |
133 | { |
|
133 | { | |
134 | // Retrieves reference range |
|
134 | // Retrieves reference range | |
135 | QFETCH(SqpRange, referenceRange); |
|
135 | QFETCH(SqpRange, referenceRange); | |
136 | CosinusProvider referenceProvider{}; |
|
136 | CosinusProvider referenceProvider{}; | |
137 | auto dataSeries = referenceProvider.provideDataSeries( |
|
137 | auto dataSeries = referenceProvider.provideDataSeries( | |
138 |
referenceRange, {{COSINUS_TYPE_KEY, "scalar"}, {COSINUS_FREQUENCY_KEY, 10 |
|
138 | referenceRange, {{COSINUS_TYPE_KEY, "scalar"}, {COSINUS_FREQUENCY_KEY, 10.}}); | |
139 |
|
139 | |||
140 | auto end = dataSeries->cend() - 1; |
|
140 | auto end = dataSeries->cend() - 1; | |
141 | qInfo() << dataSeries->nbPoints() << dataSeries->cbegin()->x() << end->x(); |
|
141 | qInfo() << dataSeries->nbPoints() << dataSeries->cbegin()->x() << end->x(); | |
142 |
|
142 | |||
143 | /// Lambda used to validate a variable at each step |
|
143 | /// Lambda used to validate a variable at each step | |
144 | auto validateVariable |
|
144 | auto validateVariable | |
145 | = [dataSeries](std::shared_ptr<Variable> variable, const SqpRange &range) { |
|
145 | = [dataSeries](std::shared_ptr<Variable> variable, const SqpRange &range) { | |
146 | // Checks that the variable's range has changed |
|
146 | // Checks that the variable's range has changed | |
147 | qInfo() << "range vs expected range" << variable->range() << range; |
|
147 | qInfo() << "range vs expected range" << variable->range() << range; | |
148 | QCOMPARE(variable->range(), range); |
|
148 | QCOMPARE(variable->range(), range); | |
149 |
|
149 | |||
150 | // Checks the variable's data series |
|
150 | // Checks the variable's data series | |
151 | QVERIFY(checkDataSeries(variable->dataSeries(), variable->cacheRange(), dataSeries)); |
|
151 | QVERIFY(checkDataSeries(variable->dataSeries(), variable->cacheRange(), dataSeries)); | |
152 | }; |
|
152 | }; | |
153 |
|
153 | |||
154 | // Creates variable |
|
154 | // Creates variable | |
155 | QFETCH(SqpRange, initialRange); |
|
155 | QFETCH(SqpRange, initialRange); | |
156 | sqpApp->timeController().onTimeToUpdate(initialRange); |
|
156 | sqpApp->timeController().onTimeToUpdate(initialRange); | |
157 | auto provider = std::make_shared<CosinusProvider>(); |
|
157 | auto provider = std::make_shared<CosinusProvider>(); | |
158 | auto variable = sqpApp->variableController().createVariable( |
|
158 | auto variable = sqpApp->variableController().createVariable( | |
159 |
"MMS", {{COSINUS_TYPE_KEY, "scalar"}, {COSINUS_FREQUENCY_KEY, 10 |
|
159 | "MMS", {{COSINUS_TYPE_KEY, "scalar"}, {COSINUS_FREQUENCY_KEY, 10.}}, provider); | |
160 |
|
160 | |||
161 |
|
161 | |||
162 | QFETCH(int, operationDelay); |
|
162 | QFETCH(int, operationDelay); | |
163 | QTest::qWait(operationDelay); |
|
163 | QTest::qWait(operationDelay); | |
164 | validateVariable(variable, initialRange); |
|
164 | validateVariable(variable, initialRange); | |
165 |
|
165 | |||
166 | QTest::qWait(operationDelay); |
|
166 | QTest::qWait(operationDelay); | |
167 | // Makes operations on the variable |
|
167 | // Makes operations on the variable | |
168 | QFETCH(std::vector<SqpRange>, operations); |
|
168 | QFETCH(std::vector<SqpRange>, operations); | |
169 | for (const auto &operation : operations) { |
|
169 | for (const auto &operation : operations) { | |
170 | // Asks request on the variable and waits during its execution |
|
170 | // Asks request on the variable and waits during its execution | |
171 | sqpApp->variableController().onRequestDataLoading({variable}, operation, false); |
|
171 | sqpApp->variableController().onRequestDataLoading({variable}, operation, false); | |
172 |
|
172 | |||
173 | QTest::qWait(operationDelay); |
|
173 | QTest::qWait(operationDelay); | |
174 | validateVariable(variable, operation); |
|
174 | validateVariable(variable, operation); | |
175 | } |
|
175 | } | |
176 |
|
176 | |||
177 |
|
177 | |||
178 | for (const auto &operation : operations) { |
|
178 | for (const auto &operation : operations) { | |
179 | // Asks request on the variable and waits during its execution |
|
179 | // Asks request on the variable and waits during its execution | |
180 | sqpApp->variableController().onRequestDataLoading({variable}, operation, false); |
|
180 | sqpApp->variableController().onRequestDataLoading({variable}, operation, false); | |
181 | } |
|
181 | } | |
182 | QTest::qWait(operationDelay); |
|
182 | QTest::qWait(operationDelay); | |
183 | validateVariable(variable, operations.back()); |
|
183 | validateVariable(variable, operations.back()); | |
184 | } |
|
184 | } | |
185 |
|
185 | |||
186 | int main(int argc, char *argv[]) |
|
186 | int main(int argc, char *argv[]) | |
187 | { |
|
187 | { | |
188 | SqpApplication app{argc, argv}; |
|
188 | SqpApplication app{argc, argv}; | |
189 | app.setAttribute(Qt::AA_Use96Dpi, true); |
|
189 | app.setAttribute(Qt::AA_Use96Dpi, true); | |
190 | TestCosinusAcquisition testObject{}; |
|
190 | TestCosinusAcquisition testObject{}; | |
191 | QTEST_SET_MAIN_SOURCE_PATH |
|
191 | QTEST_SET_MAIN_SOURCE_PATH | |
192 | return QTest::qExec(&testObject, argc, argv); |
|
192 | return QTest::qExec(&testObject, argc, argv); | |
193 | } |
|
193 | } | |
194 |
|
194 | |||
195 | #include "TestCosinusAcquisition.moc" |
|
195 | #include "TestCosinusAcquisition.moc" |
General Comments 0
You need to be logged in to leave comments.
Login now