@@ -0,0 +1,4 | |||
|
1 | [Rules] | |
|
2 | *.debug=false | |
|
3 | SqpApplication.debug=true | |
|
4 | DataSourceController.debug=true |
@@ -0,0 +1,3 | |||
|
1 | # On ignore toutes les règles vera++ pour le fichier spimpl | |
|
2 | Common/spimpl\.h:\d+:.* | |
|
3 |
@@ -0,0 +1,4 | |||
|
1 | # On ignore toutes les règles vera++ pour le fichier spimpl | |
|
2 | ||
|
3 | .*IPSIS_S04_METHOD.*found: Q_DECLARE_LOGGING_CATEGORY.* | |
|
4 | .*IPSIS_S04_VARIABLE.*found: impl.* |
@@ -1,147 +1,146 | |||
|
1 | 1 | |
|
2 | 2 | ## sciqlop - CMakeLists.txt |
|
3 | 3 | SET(EXECUTABLE_NAME "sciqlop") |
|
4 | 4 | SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/) |
|
5 | 5 | SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include) |
|
6 | 6 | SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src) |
|
7 | 7 | SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources) |
|
8 | 8 | |
|
9 | 9 | # |
|
10 | 10 | # Find Qt modules |
|
11 | 11 | # |
|
12 | 12 | SCIQLOP_FIND_QT(Core Widgets) |
|
13 | 13 | |
|
14 | 14 | # |
|
15 | 15 | # Find dependent libraries |
|
16 | 16 | # ======================== |
|
17 | 17 | find_package(sciqlop-gui) |
|
18 | 18 | |
|
19 | message("Librairies inclues dans APP: ${SCIQLOP-GUI_LIBRARIES}") | |
|
20 | 19 | SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES}) |
|
21 | 20 | SET(EXTERN_SHARED_LIBRARIES) |
|
22 | 21 | |
|
23 | 22 | INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR}) |
|
24 | 23 | |
|
25 | 24 | # Add sqpcore to the list of libraries to use |
|
26 | 25 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
27 | 26 | |
|
28 | 27 | # Include core directory |
|
29 | 28 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include") |
|
30 | 29 | |
|
31 | 30 | # Add dependent shared libraries |
|
32 | 31 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) |
|
33 | 32 | |
|
34 | 33 | # Retrieve the location of the dynamic library to copy it to the output path |
|
35 | 34 | #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION) |
|
36 | 35 | list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation}) |
|
37 | 36 | |
|
38 | 37 | # |
|
39 | 38 | # Compile the application |
|
40 | 39 | # |
|
41 | 40 | FILE (GLOB_RECURSE APPLICATION_SOURCES |
|
42 | 41 | ${SOURCES_DIR}/*.c |
|
43 | 42 | ${SOURCES_DIR}/*.cpp |
|
44 | 43 | ${SOURCES_DIR}/*.h) |
|
45 | 44 | |
|
46 | 45 | # Headers files (.h) |
|
47 | 46 | FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h) |
|
48 | 47 | |
|
49 | 48 | # Ui files |
|
50 | 49 | FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) |
|
51 | 50 | |
|
52 | 51 | # Resources files |
|
53 | 52 | FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc) |
|
54 | 53 | |
|
55 | 54 | # Retrieve resources files |
|
56 | 55 | FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc) |
|
57 | 56 | |
|
58 | 57 | QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} ) |
|
59 | 58 | |
|
60 | 59 | QT5_WRAP_UI(UIS_HDRS |
|
61 | 60 | ${PROJECT_FORMS} |
|
62 | 61 | ) |
|
63 | 62 | |
|
64 | 63 | |
|
65 | 64 | ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS}) |
|
66 | 65 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14) |
|
67 | 66 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
68 | 67 | target_link_libraries(${EXECUTABLE_NAME} |
|
69 | 68 | ${LIBRARIES}) |
|
70 | 69 | |
|
71 | 70 | # Link with Qt5 modules |
|
72 | 71 | qt5_use_modules(${EXECUTABLE_NAME} Core Widgets) |
|
73 | 72 | |
|
74 | 73 | |
|
75 | 74 | # Add the files to the list of files to be analyzed |
|
76 | 75 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES}) |
|
77 | 76 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
78 | 77 | # Vera++ exclusion files |
|
79 | 78 | #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl) |
|
80 | 79 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
81 | 80 | |
|
82 | 81 | # |
|
83 | 82 | # Compile the tests |
|
84 | 83 | # |
|
85 | 84 | IF(BUILD_TESTS) |
|
86 | 85 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
87 | 86 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
88 | 87 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
89 | 88 | SET( TEST_LIBRARIES ${LIBRARIES}) |
|
90 | 89 | |
|
91 | 90 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
92 | 91 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
93 | 92 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
94 | 93 | |
|
95 | 94 | # Add to the list of sources files all the sources in the same |
|
96 | 95 | # directory that aren't another test |
|
97 | 96 | FILE (GLOB currentTestSources |
|
98 | 97 | ${testDirectory}/*.c |
|
99 | 98 | ${testDirectory}/*.cpp |
|
100 | 99 | ${testDirectory}/*.h) |
|
101 | 100 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
102 | 101 | LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
103 | 102 | |
|
104 | 103 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
105 | 104 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) |
|
106 | 105 | qt5_use_modules(${testName} Test) |
|
107 | 106 | |
|
108 | 107 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
109 | 108 | |
|
110 | 109 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName}) |
|
111 | 110 | ENDFOREACH( testFile ) |
|
112 | 111 | |
|
113 | 112 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
114 | 113 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
115 | 114 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
116 | 115 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
117 | 116 | ENDIF(BUILD_TESTS) |
|
118 | 117 | |
|
119 | 118 | # |
|
120 | 119 | # Set the files that must be formatted by clang-format. |
|
121 | 120 | # |
|
122 | 121 | LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES}) |
|
123 | 122 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
124 | 123 | |
|
125 | 124 | # |
|
126 | 125 | # Set the directories that doxygen must browse to generate the |
|
127 | 126 | # documentation. |
|
128 | 127 | # |
|
129 | 128 | # Source directories: |
|
130 | 129 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
131 | 130 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
132 | 131 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
133 | 132 | # Source directories to exclude from the documentation generation |
|
134 | 133 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
135 | 134 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
136 | 135 | |
|
137 | 136 | # |
|
138 | 137 | # Set the directories with the sources to analyze and propagate the |
|
139 | 138 | # modification to the parent scope |
|
140 | 139 | # |
|
141 | 140 | # Source directories to analyze: |
|
142 | 141 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
143 | 142 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
144 | 143 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
145 | 144 | # Source directories to exclude from the analysis |
|
146 | 145 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
147 | 146 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
@@ -1,37 +1,51 | |||
|
1 | 1 | # |
|
2 | 2 | # Sciqlop_modules.cmake |
|
3 | 3 | # |
|
4 | 4 | # Set ouptut directories |
|
5 | 5 | # |
|
6 | 6 | SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) |
|
7 | 7 | SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) |
|
8 | ||
|
8 | IF (UNIX) | |
|
9 | SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject) | |
|
10 | ELSEIF(WIN32) | |
|
11 | SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}/app/QtProject) | |
|
12 | ELSE() | |
|
13 | SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) | |
|
14 | ENDIF() | |
|
9 | 15 | |
|
10 | 16 | # |
|
11 | 17 | # Compile the diffents modules |
|
12 | 18 | # |
|
13 | 19 | set(sciqlop-core_DIR "${CMAKE_SOURCE_DIR}/core/cmake") |
|
14 | 20 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-core_DIR}") |
|
15 | 21 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/core") |
|
16 | 22 | |
|
17 | 23 | set(sciqlop-gui_DIR "${CMAKE_SOURCE_DIR}/gui/cmake") |
|
18 | 24 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-gui_DIR}") |
|
19 | 25 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/gui") |
|
20 | 26 | |
|
21 | 27 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/app") |
|
22 | 28 | |
|
29 | # LOGGER | |
|
30 | set(QTLOGGING_INI_FILE "${CMAKE_SOURCE_DIR}/config/QtProject/qtlogging.ini") | |
|
31 | FILE(COPY ${QTLOGGING_INI_FILE} DESTINATION ${CONFIG_OUTPUT_PATH}) | |
|
32 | ||
|
33 | ||
|
23 | 34 | # |
|
24 | 35 | # Code formatting |
|
25 | 36 | # |
|
37 | # Vera++ exclusion files | |
|
38 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/formatting/vera-exclusions/exclusions.txt) | |
|
39 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) | |
|
26 | 40 | INCLUDE ("cmake/sciqlop_formatting.cmake") |
|
27 | 41 | |
|
28 | 42 | # |
|
29 | 43 | # Documentation generation |
|
30 | 44 | # |
|
31 | 45 | INCLUDE ("cmake/sciqlop_doxygen.cmake") |
|
32 | 46 | |
|
33 | 47 | # |
|
34 | 48 | # Source code analysis |
|
35 | 49 | # |
|
36 | 50 | INCLUDE ("cmake/sciqlop_code_analysis.cmake") |
|
37 | 51 | INCLUDE ("cmake/sciqlop_code_cppcheck.cmake") |
@@ -1,90 +1,99 | |||
|
1 | 1 | # |
|
2 | 2 | # sciqlop_params : Define compilation parameters |
|
3 | 3 | # |
|
4 | 4 | # Debug or release |
|
5 | 5 | # |
|
6 | 6 | # As the "NMake Makefiles" forces by default the CMAKE_BUILD_TYPE variable to Debug, SCIQLOP_BUILD_TYPE variable is used to be sure that the debug mode is a user choice |
|
7 | 7 | #SET(SCIQLOP_BUILD_TYPE "Release" CACHE STRING "Choose to compile in Debug or Release mode") |
|
8 | 8 | |
|
9 | 9 | #IF(SCIQLOP_BUILD_TYPE MATCHES "Debug") |
|
10 | 10 | # MESSAGE (STATUS "Build in Debug") |
|
11 | 11 | # SET (CMAKE_BUILD_TYPE "Debug") |
|
12 | 12 | # SET (DEBUG_SUFFIX "d") |
|
13 | 13 | #ELSE() |
|
14 | 14 | # MESSAGE (STATUS "Build in Release") |
|
15 | 15 | # SET (CMAKE_BUILD_TYPE "Release") |
|
16 | 16 | # SET (SCIQLOP_BUILD_TYPE "Release") |
|
17 | 17 | # SET (DEBUG_SUFFIX "") |
|
18 | 18 | #ENDIF() |
|
19 | 19 | |
|
20 | IF(CMAKE_BUILD_TYPE MATCHES "Debug") | |
|
21 | SET (CMAKE_BUILD_TYPE "Debug") | |
|
22 | SET (DEBUG_SUFFIX "d") | |
|
23 | ELSE() | |
|
24 | MESSAGE (STATUS "Build in Release") | |
|
25 | SET (SCIQLOP_BUILD_TYPE "Release") | |
|
26 | SET (DEBUG_SUFFIX "") | |
|
27 | ENDIF() | |
|
28 | ||
|
20 | 29 | # |
|
21 | 30 | # Need to compile tests? |
|
22 | 31 | # |
|
23 | 32 | OPTION (BUILD_TESTS "Build the tests" OFF) |
|
24 | 33 | ENABLE_TESTING(${BUILD_TESTS}) |
|
25 | 34 | |
|
26 | 35 | # |
|
27 | 36 | # Path to the folder for sciqlop's extern libraries. |
|
28 | 37 | # |
|
29 | 38 | # When looking for an external library in sciqlop, we look to the following |
|
30 | 39 | # folders: |
|
31 | 40 | # - The specific folder for the library (generally of the form <LIBRARY>_ROOT_DIR |
|
32 | 41 | # - The global Sciqlop extern folder |
|
33 | 42 | # - The system folders. |
|
34 | 43 | # |
|
35 | 44 | # If a dependency is found in the global extern folder or a specific folder for |
|
36 | 45 | # the library, then it is installed with the sciqlop libraries. If it is found |
|
37 | 46 | # in the system folders, it is not. This behavior can be overriden with the |
|
38 | 47 | # <LIBRARY>_COPY_SHARED_LIBRARIES flag. |
|
39 | 48 | # |
|
40 | 49 | set(SCIQLOP_EXTERN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/extern" |
|
41 | 50 | CACHE PATH "Path to the folder for sciqlop's extern libraries") |
|
42 | 51 | option(SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR "Force the <LIBRARY>_ROOT_DIR to be updated to the global sciqlop extern folder" |
|
43 | 52 | OFF) |
|
44 | 53 | |
|
45 | 54 | if (SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR) |
|
46 | 55 | set(libRootDirForceValue FORCE) |
|
47 | 56 | else() |
|
48 | 57 | set(libRootDirForceValue) |
|
49 | 58 | endif() |
|
50 | 59 | |
|
51 | 60 | |
|
52 | 61 | |
|
53 | 62 | # |
|
54 | 63 | # Static or shared libraries |
|
55 | 64 | # |
|
56 | 65 | OPTION (BUILD_SHARED_LIBS "Build the shared libraries" ON) |
|
57 | 66 | |
|
58 | 67 | # Generate position independant code (-fPIC) |
|
59 | 68 | SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE) |
|
60 | 69 | |
|
61 | 70 | # |
|
62 | 71 | # Configure installation directories |
|
63 | 72 | # |
|
64 | 73 | IF (UNIX) |
|
65 | 74 | SET(defaultBin "bin") |
|
66 | 75 | SET(defaultInc "include/sciqlop") |
|
67 | 76 | |
|
68 | 77 | # 32 or 64 bits compiler |
|
69 | 78 | IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) |
|
70 | 79 | SET(defaultLib "lib64/sciqlop") |
|
71 | 80 | ELSE() |
|
72 | 81 | SET(defaultLib "lib/sciqlop") |
|
73 | 82 | ENDIF() |
|
74 | 83 | |
|
75 | 84 | SET(defaultDoc "share/docs/sciqlop") |
|
76 | 85 | ELSE() |
|
77 | 86 | SET(defaultBin "bin") |
|
78 | 87 | SET(defaultInc "include/sciqlop") |
|
79 | 88 | SET(defaultLib "lib/sciqlop") |
|
80 | 89 | SET(defaultDoc "docs/sciqlop") |
|
81 | 90 | ENDIF() |
|
82 | 91 | |
|
83 | 92 | SET(INSTALL_BINARY_DIR "${defaultBin}" CACHE STRING |
|
84 | 93 | "Installation directory for binaries") |
|
85 | 94 | SET(INSTALL_LIBRARY_DIR "${defaultLib}" CACHE STRING |
|
86 | 95 | "Installation directory for libraries") |
|
87 | 96 | SET(INSTALL_INCLUDE_DIR "${defaultInc}" CACHE STRING |
|
88 | 97 | "Installation directory for headers") |
|
89 | 98 | SET(INSTALL_DOCUMENTATION_DIR "${defaultDoc}" CACHE STRING |
|
90 | 99 | "Installation directory for documentations") |
@@ -1,128 +1,128 | |||
|
1 | 1 | |
|
2 | 2 | ## core - CMakeLists.txt |
|
3 | 3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
4 | 4 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") |
|
5 | 5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") |
|
6 | 6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") |
|
7 | 7 | |
|
8 | 8 | # Include core directory |
|
9 | 9 | include_directories("${INCLUDES_DIR}") |
|
10 | 10 | |
|
11 | 11 | # Set a variable to display a warning in the version files. |
|
12 | 12 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
13 | 13 | # Generate the version file from the cmake version variables. The version |
|
14 | 14 | # variables are defined in the cmake/sciqlop_version.cmake file. |
|
15 | 15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" |
|
16 | 16 | "${INCLUDES_DIR}/Version.h") |
|
17 | 17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" |
|
18 | 18 | "${SOURCES_DIR}/Version.cpp") |
|
19 | 19 | |
|
20 | 20 | # |
|
21 | 21 | # Find Qt modules |
|
22 | 22 | # |
|
23 | 23 | SCIQLOP_FIND_QT(Core) |
|
24 | 24 | |
|
25 | 25 | # |
|
26 | 26 | # Compile the library library |
|
27 | 27 | # |
|
28 | 28 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
29 | 29 | ${INCLUDES_DIR}/*.h |
|
30 | 30 | ${SOURCES_DIR}/*.c |
|
31 | 31 | ${SOURCES_DIR}/*.cpp |
|
32 | 32 | ${SOURCES_DIR}/*.h) |
|
33 | 33 | |
|
34 | 34 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) |
|
35 | 35 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
36 | 36 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
37 | 37 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) |
|
38 | 38 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core) |
|
39 | 39 | |
|
40 | 40 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
41 | 41 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
42 | 42 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
43 | 43 | IF(BUILD_SHARED_LIBS) |
|
44 | 44 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
45 | 45 | ELSE() |
|
46 | 46 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
47 | 47 | ENDIF() |
|
48 | 48 | |
|
49 | 49 | # Set the variable to parent scope so that the other projects can copy the |
|
50 | 50 | # dependent shared libraries |
|
51 | 51 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) |
|
52 | 52 | |
|
53 | 53 | # Copy extern shared libraries to the lib folder |
|
54 | 54 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) |
|
55 | 55 | |
|
56 | 56 | # Add the files to the list of files to be analyzed |
|
57 | 57 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
58 | 58 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
59 | 59 | # Vera++ exclusion files |
|
60 |
|
|
|
60 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) | |
|
61 | 61 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
62 | 62 | |
|
63 | 63 | # |
|
64 | 64 | # Compile the tests |
|
65 | 65 | # |
|
66 | 66 | IF(BUILD_TESTS) |
|
67 | 67 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
68 | 68 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
69 | 69 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
70 | 70 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
71 | 71 | |
|
72 | 72 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
73 | 73 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
74 | 74 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
75 | 75 | |
|
76 | 76 | # Add to the list of sources files all the sources in the same |
|
77 | 77 | # directory that aren't another test |
|
78 | 78 | FILE (GLOB currentTestSources |
|
79 | 79 | ${testDirectory}/*.c |
|
80 | 80 | ${testDirectory}/*.cpp |
|
81 | 81 | ${testDirectory}/*.h) |
|
82 | 82 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
83 | 83 | LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
84 | 84 | |
|
85 | 85 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
86 | 86 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) |
|
87 | 87 | qt5_use_modules(${testName} Test) |
|
88 | 88 | |
|
89 | 89 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
90 | 90 | |
|
91 | 91 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
92 | 92 | ENDFOREACH( testFile ) |
|
93 | 93 | |
|
94 | 94 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
95 | 95 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
96 | 96 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
97 | 97 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
98 | 98 | ENDIF(BUILD_TESTS) |
|
99 | 99 | |
|
100 | 100 | # |
|
101 | 101 | # Set the files that must be formatted by clang-format. |
|
102 | 102 | # |
|
103 | 103 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
104 | 104 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
105 | 105 | |
|
106 | 106 | # |
|
107 | 107 | # Set the directories that doxygen must browse to generate the |
|
108 | 108 | # documentation. |
|
109 | 109 | # |
|
110 | 110 | # Source directories: |
|
111 | 111 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
112 | 112 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
113 | 113 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
114 | 114 | # Source directories to exclude from the documentation generation |
|
115 | 115 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
116 | 116 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
117 | 117 | |
|
118 | 118 | # |
|
119 | 119 | # Set the directories with the sources to analyze and propagate the |
|
120 | 120 | # modification to the parent scope |
|
121 | 121 | # |
|
122 | 122 | # Source directories to analyze: |
|
123 | 123 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
124 | 124 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
125 | 125 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
126 | 126 | # Source directories to exclude from the analysis |
|
127 | 127 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
128 | 128 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
@@ -1,461 +1,460 | |||
|
1 | 1 | /* |
|
2 | 2 | ==================================================================== |
|
3 | 3 | A Smart Pointer to IMPLementation (i.e. Smart PIMPL or just SPIMPL). |
|
4 | 4 | ==================================================================== |
|
5 | 5 | |
|
6 | 6 | Version: 1.1 |
|
7 | 7 | |
|
8 | 8 | Latest version: |
|
9 | 9 | https://github.com/oliora/samples/blob/master/spimpl.h |
|
10 | 10 | Rationale and description: |
|
11 | 11 | http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html |
|
12 | 12 | |
|
13 | 13 | Copyright (c) 2015 Andrey Upadyshev (oliora@gmail.com) |
|
14 | 14 | |
|
15 | 15 | Distributed under the Boost Software License, Version 1.0. |
|
16 | 16 | See http://www.boost.org/LICENSE_1_0.txt |
|
17 | 17 | |
|
18 | 18 | Changes history |
|
19 | 19 | --------------- |
|
20 | 20 | v1.1: |
|
21 | 21 | - auto_ptr support is disabled by default for C++17 compatibility |
|
22 | 22 | v1.0: |
|
23 | 23 | - Released |
|
24 | 24 | */ |
|
25 | 25 | |
|
26 | 26 | #ifndef SPIMPL_H_ |
|
27 | 27 | #define SPIMPL_H_ |
|
28 | 28 | |
|
29 | 29 | #include <cassert> |
|
30 | 30 | #include <memory> |
|
31 | 31 | #include <type_traits> |
|
32 | 32 | |
|
33 | ||
|
34 | 33 | #if defined _MSC_VER && _MSC_VER < 1900 // MS Visual Studio before VS2015 |
|
35 | 34 | #define SPIMPL_NO_CPP11_NOEXCEPT |
|
36 | 35 | #define SPIMPL_NO_CPP11_CONSTEXPR |
|
37 | 36 | #define SPIMPL_NO_CPP11_DEFAULT_MOVE_SPEC_FUNC |
|
38 | 37 | #endif |
|
39 | 38 | |
|
40 | 39 | #if !defined SPIMPL_NO_CPP11_NOEXCEPT |
|
41 | 40 | #define SPIMPL_NOEXCEPT noexcept |
|
42 | 41 | #else |
|
43 | 42 | #define SPIMPL_NOEXCEPT |
|
44 | 43 | #endif |
|
45 | 44 | |
|
46 | 45 | #if !defined SPIMPL_NO_CPP11_CONSTEXPR |
|
47 | 46 | #define SPIMPL_CONSTEXPR constexpr |
|
48 | 47 | #else |
|
49 | 48 | #define SPIMPL_CONSTEXPR |
|
50 | 49 | #endif |
|
51 | 50 | |
|
52 | 51 | // define SPIMPL_HAS_AUTO_PTR to enable constructor and assignment operator that accept |
|
53 | 52 | // std::auto_ptr |
|
54 | 53 | // TODO: auto detect std::auto_ptr support |
|
55 | 54 | |
|
56 | 55 | |
|
57 | 56 | namespace spimpl { |
|
58 | 57 | namespace details { |
|
59 | 58 | template <class T> |
|
60 | 59 | T *default_copy(T *src) |
|
61 | 60 | { |
|
62 | 61 | static_assert(sizeof(T) > 0, "default_copy cannot copy incomplete type"); |
|
63 | 62 | static_assert(!std::is_void<T>::value, "default_copy cannot copy incomplete type"); |
|
64 | 63 | return new T(*src); |
|
65 | 64 | } |
|
66 | 65 | |
|
67 | 66 | template <class T> |
|
68 | 67 | void default_delete(T *p) SPIMPL_NOEXCEPT |
|
69 | 68 | { |
|
70 | 69 | static_assert(sizeof(T) > 0, "default_delete cannot delete incomplete type"); |
|
71 | 70 | static_assert(!std::is_void<T>::value, "default_delete cannot delete incomplete type"); |
|
72 | 71 | delete p; |
|
73 | 72 | } |
|
74 | 73 | |
|
75 | 74 | template <class T> |
|
76 | 75 | struct default_deleter { |
|
77 | 76 | using type = void (*)(T *); |
|
78 | 77 | }; |
|
79 | 78 | |
|
80 | 79 | template <class T> |
|
81 | 80 | using default_deleter_t = typename default_deleter<T>::type; |
|
82 | 81 | |
|
83 | 82 | template <class T> |
|
84 | 83 | struct default_copier { |
|
85 | 84 | using type = T *(*)(T *); |
|
86 | 85 | }; |
|
87 | 86 | |
|
88 | 87 | template <class T> |
|
89 | 88 | using default_copier_t = typename default_copier<T>::type; |
|
90 | 89 | |
|
91 | 90 | template <class T, class D, class C> |
|
92 | 91 | struct is_default_manageable |
|
93 | 92 | : public std::integral_constant<bool, std::is_same<D, default_deleter_t<T> >::value |
|
94 | 93 | && std::is_same<C, default_copier_t<T> >::value> { |
|
95 | 94 | }; |
|
96 | 95 | } |
|
97 | 96 | |
|
98 | 97 | |
|
99 | 98 | template <class T, class Deleter = details::default_deleter_t<T>, |
|
100 | 99 | class Copier = details::default_copier_t<T> > |
|
101 | 100 | class impl_ptr { |
|
102 | 101 | private: |
|
103 | 102 | static_assert(!std::is_array<T>::value, |
|
104 | 103 | "impl_ptr specialization for arrays is not implemented"); |
|
105 | 104 | struct dummy_t_ { |
|
106 | 105 | int dummy__; |
|
107 | 106 | }; |
|
108 | 107 | |
|
109 | 108 | public: |
|
110 | 109 | using pointer = T *; |
|
111 | 110 | using element_type = T; |
|
112 | 111 | using copier_type = typename std::decay<Copier>::type; |
|
113 | 112 | using deleter_type = typename std::decay<Deleter>::type; |
|
114 | 113 | using unique_ptr_type = std::unique_ptr<T, deleter_type>; |
|
115 | 114 | using is_default_manageable = details::is_default_manageable<T, deleter_type, copier_type>; |
|
116 | 115 | |
|
117 | 116 | SPIMPL_CONSTEXPR impl_ptr() SPIMPL_NOEXCEPT : ptr_(nullptr, deleter_type{}), |
|
118 | 117 | copier_(copier_type{}) |
|
119 | 118 | { |
|
120 | 119 | } |
|
121 | 120 | |
|
122 | 121 | SPIMPL_CONSTEXPR impl_ptr(std::nullptr_t) SPIMPL_NOEXCEPT : impl_ptr() {} |
|
123 | 122 | |
|
124 | 123 | template <class D, class C> |
|
125 | 124 | impl_ptr(pointer p, D &&d, C &&c, |
|
126 | 125 | typename std::enable_if<std::is_convertible<D, deleter_type>::value |
|
127 | 126 | && std::is_convertible<C, copier_type>::value, |
|
128 | 127 | dummy_t_>::type |
|
129 | 128 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(std::move(p), std::forward<D>(d)), |
|
130 | 129 | copier_(std::forward<C>(c)) |
|
131 | 130 | { |
|
132 | 131 | } |
|
133 | 132 | |
|
134 | 133 | template <class U> |
|
135 | 134 | impl_ptr(U *u, typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
136 | 135 | && is_default_manageable::value, |
|
137 | 136 | dummy_t_>::type |
|
138 | 137 | = dummy_t_()) SPIMPL_NOEXCEPT |
|
139 | 138 | : impl_ptr(u, &details::default_delete<T>, &details::default_copy<T>) |
|
140 | 139 | { |
|
141 | 140 | } |
|
142 | 141 | |
|
143 | 142 | impl_ptr(const impl_ptr &r) : impl_ptr(r.clone()) {} |
|
144 | 143 | |
|
145 | 144 | #ifndef SPIMPL_NO_CPP11_DEFAULT_MOVE_SPEC_FUNC |
|
146 | 145 | impl_ptr(impl_ptr &&r) SPIMPL_NOEXCEPT = default; |
|
147 | 146 | #else |
|
148 | 147 | impl_ptr(impl_ptr &&r) SPIMPL_NOEXCEPT : ptr_(std::move(r.ptr_)), copier_(std::move(r.copier_)) |
|
149 | 148 | { |
|
150 | 149 | } |
|
151 | 150 | #endif |
|
152 | 151 | |
|
153 | 152 | #ifdef SPIMPL_HAS_AUTO_PTR |
|
154 | 153 | template <class U> |
|
155 | 154 | impl_ptr(std::auto_ptr<U> &&u, typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
156 | 155 | && is_default_manageable::value, |
|
157 | 156 | dummy_t_>::type |
|
158 | 157 | = dummy_t_()) SPIMPL_NOEXCEPT |
|
159 | 158 | : ptr_(u.release(), &details::default_delete<T>), |
|
160 | 159 | copier_(&details::default_copy<T>) |
|
161 | 160 | { |
|
162 | 161 | } |
|
163 | 162 | #endif |
|
164 | 163 | |
|
165 | 164 | template <class U> |
|
166 | 165 | impl_ptr(std::unique_ptr<U> &&u, |
|
167 | 166 | typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
168 | 167 | && is_default_manageable::value, |
|
169 | 168 | dummy_t_>::type |
|
170 | 169 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(u.release(), &details::default_delete<T>), |
|
171 | 170 | copier_(&details::default_copy<T>) |
|
172 | 171 | { |
|
173 | 172 | } |
|
174 | 173 | |
|
175 | 174 | template <class U, class D, class C> |
|
176 | 175 | impl_ptr(std::unique_ptr<U, D> &&u, C &&c, |
|
177 | 176 | typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
178 | 177 | && std::is_convertible<D, deleter_type>::value |
|
179 | 178 | && std::is_convertible<C, copier_type>::value, |
|
180 | 179 | dummy_t_>::type |
|
181 | 180 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(std::move(u)), |
|
182 | 181 | copier_(std::forward<C>(c)) |
|
183 | 182 | { |
|
184 | 183 | } |
|
185 | 184 | |
|
186 | 185 | template <class U, class D, class C> |
|
187 | 186 | impl_ptr(impl_ptr<U, D, C> &&u, |
|
188 | 187 | typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
189 | 188 | && std::is_convertible<D, deleter_type>::value |
|
190 | 189 | && std::is_convertible<C, copier_type>::value, |
|
191 | 190 | dummy_t_>::type |
|
192 | 191 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(std::move(u.ptr_)), |
|
193 | 192 | copier_(std::move(u.copier_)) |
|
194 | 193 | { |
|
195 | 194 | } |
|
196 | 195 | |
|
197 | 196 | impl_ptr &operator=(const impl_ptr &r) |
|
198 | 197 | { |
|
199 | 198 | if (this == &r) |
|
200 | 199 | return *this; |
|
201 | 200 | |
|
202 | 201 | return operator=(r.clone()); |
|
203 | 202 | } |
|
204 | 203 | |
|
205 | 204 | #ifndef SPIMPL_NO_CPP11_DEFAULT_MOVE_SPEC_FUNC |
|
206 | 205 | impl_ptr &operator=(impl_ptr &&r) SPIMPL_NOEXCEPT = default; |
|
207 | 206 | #else |
|
208 | 207 | impl_ptr &operator=(impl_ptr &&r) SPIMPL_NOEXCEPT |
|
209 | 208 | { |
|
210 | 209 | ptr_ = std::move(r.ptr_); |
|
211 | 210 | copier_ = std::move(r.copier_); |
|
212 | 211 | return *this; |
|
213 | 212 | } |
|
214 | 213 | #endif |
|
215 | 214 | |
|
216 | 215 | template <class U, class D, class C> |
|
217 | 216 | typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
218 | 217 | && std::is_convertible<D, deleter_type>::value |
|
219 | 218 | && std::is_convertible<C, copier_type>::value, |
|
220 | 219 | impl_ptr &>::type |
|
221 | 220 | operator=(impl_ptr<U, D, C> &&u) SPIMPL_NOEXCEPT |
|
222 | 221 | { |
|
223 | 222 | ptr_ = std::move(u.ptr_); |
|
224 | 223 | copier_ = std::move(u.copier_); |
|
225 | 224 | return *this; |
|
226 | 225 | } |
|
227 | 226 | |
|
228 | 227 | template <class U, class D, class C> |
|
229 | 228 | typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
230 | 229 | && std::is_convertible<D, deleter_type>::value |
|
231 | 230 | && std::is_convertible<C, copier_type>::value, |
|
232 | 231 | impl_ptr &>::type |
|
233 | 232 | operator=(const impl_ptr<U, D, C> &u) |
|
234 | 233 | { |
|
235 | 234 | return operator=(u.clone()); |
|
236 | 235 | } |
|
237 | 236 | |
|
238 | 237 | // |
|
239 | 238 | |
|
240 | 239 | #ifdef SPIMPL_HAS_AUTO_PTR |
|
241 | 240 | template <class U> |
|
242 | 241 | typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
243 | 242 | && is_default_manageable::value, |
|
244 | 243 | impl_ptr &>::type |
|
245 | 244 | operator=(std::auto_ptr<U> &&u) SPIMPL_NOEXCEPT |
|
246 | 245 | { |
|
247 | 246 | return operator=(impl_ptr(std::move(u))); |
|
248 | 247 | } |
|
249 | 248 | #endif |
|
250 | 249 | |
|
251 | 250 | template <class U> |
|
252 | 251 | typename std::enable_if<std::is_convertible<U *, pointer>::value |
|
253 | 252 | && is_default_manageable::value, |
|
254 | 253 | impl_ptr &>::type |
|
255 | 254 | operator=(std::unique_ptr<U> &&u) SPIMPL_NOEXCEPT |
|
256 | 255 | { |
|
257 | 256 | return operator=(impl_ptr(std::move(u))); |
|
258 | 257 | } |
|
259 | 258 | |
|
260 | 259 | impl_ptr clone() const |
|
261 | 260 | { |
|
262 | 261 | return impl_ptr(ptr_ ? copier_(ptr_.get()) : nullptr, ptr_.get_deleter(), copier_); |
|
263 | 262 | } |
|
264 | 263 | |
|
265 | 264 | typename std::remove_reference<T>::type &operator*() const { return *ptr_; } |
|
266 | 265 | pointer operator->() const SPIMPL_NOEXCEPT { return get(); } |
|
267 | 266 | pointer get() const SPIMPL_NOEXCEPT { return ptr_.get(); } |
|
268 | 267 | |
|
269 | 268 | void swap(impl_ptr &u) SPIMPL_NOEXCEPT |
|
270 | 269 | { |
|
271 | 270 | using std::swap; |
|
272 | 271 | ptr_.swap(u.ptr_); |
|
273 | 272 | swap(copier_, u.copier_); |
|
274 | 273 | } |
|
275 | 274 | |
|
276 | 275 | pointer release() SPIMPL_NOEXCEPT { return ptr_.release(); } |
|
277 | 276 | |
|
278 | 277 | unique_ptr_type release_unique() SPIMPL_NOEXCEPT { return std::move(ptr_); } |
|
279 | 278 | |
|
280 | 279 | explicit operator bool() const SPIMPL_NOEXCEPT { return static_cast<bool>(ptr_); } |
|
281 | 280 | |
|
282 | 281 | typename std::remove_reference<deleter_type>::type &get_deleter() SPIMPL_NOEXCEPT |
|
283 | 282 | { |
|
284 | 283 | return ptr_.get_deleter(); |
|
285 | 284 | } |
|
286 | 285 | const typename std::remove_reference<deleter_type>::type &get_deleter() const SPIMPL_NOEXCEPT |
|
287 | 286 | { |
|
288 | 287 | return ptr_.get_deleter(); |
|
289 | 288 | } |
|
290 | 289 | |
|
291 | 290 | typename std::remove_reference<copier_type>::type &get_copier() SPIMPL_NOEXCEPT |
|
292 | 291 | { |
|
293 | 292 | return copier_; |
|
294 | 293 | } |
|
295 | 294 | const typename std::remove_reference<copier_type>::type &get_copier() const SPIMPL_NOEXCEPT |
|
296 | 295 | { |
|
297 | 296 | return copier_; |
|
298 | 297 | } |
|
299 | 298 | |
|
300 | 299 | private: |
|
301 | 300 | unique_ptr_type ptr_; |
|
302 | 301 | copier_type copier_; |
|
303 | 302 | }; |
|
304 | 303 | |
|
305 | 304 | |
|
306 | 305 | template <class T, class D, class C> |
|
307 | 306 | inline void swap(impl_ptr<T, D, C> &l, impl_ptr<T, D, C> &r) SPIMPL_NOEXCEPT |
|
308 | 307 | { |
|
309 | 308 | l.swap(r); |
|
310 | 309 | } |
|
311 | 310 | |
|
312 | 311 | |
|
313 | 312 | template <class T1, class D1, class C1, class T2, class D2, class C2> |
|
314 | 313 | inline bool operator==(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) |
|
315 | 314 | { |
|
316 | 315 | return l.get() == r.get(); |
|
317 | 316 | } |
|
318 | 317 | |
|
319 | 318 | template <class T1, class D1, class C1, class T2, class D2, class C2> |
|
320 | 319 | inline bool operator!=(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) |
|
321 | 320 | { |
|
322 | 321 | return !(l == r); |
|
323 | 322 | } |
|
324 | 323 | |
|
325 | 324 | template <class T1, class D1, class C1, class T2, class D2, class C2> |
|
326 | 325 | inline bool operator<(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) |
|
327 | 326 | { |
|
328 | 327 | using P1 = typename impl_ptr<T1, D1, C1>::pointer; |
|
329 | 328 | using P2 = typename impl_ptr<T2, D2, C2>::pointer; |
|
330 | 329 | using CT = typename std::common_type<P1, P2>::type; |
|
331 | 330 | return std::less<CT>()(l.get(), r.get()); |
|
332 | 331 | } |
|
333 | 332 | |
|
334 | 333 | template <class T1, class D1, class C1, class T2, class D2, class C2> |
|
335 | 334 | inline bool operator>(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) |
|
336 | 335 | { |
|
337 | 336 | return r < l; |
|
338 | 337 | } |
|
339 | 338 | |
|
340 | 339 | template <class T1, class D1, class C1, class T2, class D2, class C2> |
|
341 | 340 | inline bool operator<=(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) |
|
342 | 341 | { |
|
343 | 342 | return !(r < l); |
|
344 | 343 | } |
|
345 | 344 | |
|
346 | 345 | template <class T1, class D1, class C1, class T2, class D2, class C2> |
|
347 | 346 | inline bool operator>=(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) |
|
348 | 347 | { |
|
349 | 348 | return !(l < r); |
|
350 | 349 | } |
|
351 | 350 | |
|
352 | 351 | template <class T, class D, class C> |
|
353 | 352 | inline bool operator==(const impl_ptr<T, D, C> &p, std::nullptr_t) SPIMPL_NOEXCEPT |
|
354 | 353 | { |
|
355 | 354 | return !p; |
|
356 | 355 | } |
|
357 | 356 | |
|
358 | 357 | template <class T, class D, class C> |
|
359 | 358 | inline bool operator==(std::nullptr_t, const impl_ptr<T, D, C> &p) SPIMPL_NOEXCEPT |
|
360 | 359 | { |
|
361 | 360 | return !p; |
|
362 | 361 | } |
|
363 | 362 | |
|
364 | 363 | template <class T, class D, class C> |
|
365 | 364 | inline bool operator!=(const impl_ptr<T, D, C> &p, std::nullptr_t) SPIMPL_NOEXCEPT |
|
366 | 365 | { |
|
367 | 366 | return static_cast<bool>(p); |
|
368 | 367 | } |
|
369 | 368 | |
|
370 | 369 | template <class T, class D, class C> |
|
371 | 370 | inline bool operator!=(std::nullptr_t, const impl_ptr<T, D, C> &p) SPIMPL_NOEXCEPT |
|
372 | 371 | { |
|
373 | 372 | return static_cast<bool>(p); |
|
374 | 373 | } |
|
375 | 374 | |
|
376 | 375 | template <class T, class D, class C> |
|
377 | 376 | inline bool operator<(const impl_ptr<T, D, C> &l, std::nullptr_t) |
|
378 | 377 | { |
|
379 | 378 | using P = typename impl_ptr<T, D, C>::pointer; |
|
380 | 379 | return std::less<P>()(l.get(), nullptr); |
|
381 | 380 | } |
|
382 | 381 | |
|
383 | 382 | template <class T, class D, class C> |
|
384 | 383 | inline bool operator<(std::nullptr_t, const impl_ptr<T, D, C> &p) |
|
385 | 384 | { |
|
386 | 385 | using P = typename impl_ptr<T, D, C>::pointer; |
|
387 | 386 | return std::less<P>()(nullptr, p.get()); |
|
388 | 387 | } |
|
389 | 388 | |
|
390 | 389 | template <class T, class D, class C> |
|
391 | 390 | inline bool operator>(const impl_ptr<T, D, C> &p, std::nullptr_t) |
|
392 | 391 | { |
|
393 | 392 | return nullptr < p; |
|
394 | 393 | } |
|
395 | 394 | |
|
396 | 395 | template <class T, class D, class C> |
|
397 | 396 | inline bool operator>(std::nullptr_t, const impl_ptr<T, D, C> &p) |
|
398 | 397 | { |
|
399 | 398 | return p < nullptr; |
|
400 | 399 | } |
|
401 | 400 | |
|
402 | 401 | template <class T, class D, class C> |
|
403 | 402 | inline bool operator<=(const impl_ptr<T, D, C> &p, std::nullptr_t) |
|
404 | 403 | { |
|
405 | 404 | return !(nullptr < p); |
|
406 | 405 | } |
|
407 | 406 | |
|
408 | 407 | template <class T, class D, class C> |
|
409 | 408 | inline bool operator<=(std::nullptr_t, const impl_ptr<T, D, C> &p) |
|
410 | 409 | { |
|
411 | 410 | return !(p < nullptr); |
|
412 | 411 | } |
|
413 | 412 | |
|
414 | 413 | template <class T, class D, class C> |
|
415 | 414 | inline bool operator>=(const impl_ptr<T, D, C> &p, std::nullptr_t) |
|
416 | 415 | { |
|
417 | 416 | return !(p < nullptr); |
|
418 | 417 | } |
|
419 | 418 | |
|
420 | 419 | template <class T, class D, class C> |
|
421 | 420 | inline bool operator>=(std::nullptr_t, const impl_ptr<T, D, C> &p) |
|
422 | 421 | { |
|
423 | 422 | return !(nullptr < p); |
|
424 | 423 | } |
|
425 | 424 | |
|
426 | 425 | |
|
427 | 426 | template <class T, class... Args> |
|
428 | 427 | inline impl_ptr<T> make_impl(Args &&... args) |
|
429 | 428 | { |
|
430 | 429 | return impl_ptr<T>(new T(std::forward<Args>(args)...), &details::default_delete<T>, |
|
431 | 430 | &details::default_copy<T>); |
|
432 | 431 | } |
|
433 | 432 | |
|
434 | 433 | |
|
435 | 434 | // Helpers to manage unique impl, stored in std::unique_ptr |
|
436 | 435 | |
|
437 | 436 | template <class T, class Deleter = void (*)(T *)> |
|
438 | 437 | using unique_impl_ptr = std::unique_ptr<T, Deleter>; |
|
439 | 438 | |
|
440 | 439 | template <class T, class... Args> |
|
441 | 440 | inline unique_impl_ptr<T> make_unique_impl(Args &&... args) |
|
442 | 441 | { |
|
443 | 442 | static_assert(!std::is_array<T>::value, "unique_impl_ptr does not support arrays"); |
|
444 | 443 | return unique_impl_ptr<T>(new T(std::forward<Args>(args)...), &details::default_delete<T>); |
|
445 | 444 | } |
|
446 | 445 | } |
|
447 | 446 | |
|
448 | 447 | namespace std { |
|
449 | 448 | template <class T, class D, class C> |
|
450 | 449 | struct hash<spimpl::impl_ptr<T, D, C> > { |
|
451 | 450 | using argument_type = spimpl::impl_ptr<T, D, C>; |
|
452 | 451 | using result_type = size_t; |
|
453 | 452 | |
|
454 | 453 | result_type operator()(const argument_type &p) const SPIMPL_NOEXCEPT |
|
455 | 454 | { |
|
456 | 455 | return hash<typename argument_type::pointer>()(p.get()); |
|
457 | 456 | } |
|
458 | 457 | }; |
|
459 | 458 | } |
|
460 | 459 | |
|
461 | 460 | #endif // SPIMPL_H_ |
@@ -1,45 +1,48 | |||
|
1 | 1 | #include "DataSource/DataSourceController.h" |
|
2 | 2 | |
|
3 | 3 | #include <QMutex> |
|
4 | 4 | #include <QThread> |
|
5 | 5 | |
|
6 | Q_LOGGING_CATEGORY(LOG_DataSourceController, "dataSourceController") | |
|
6 | #include <QDir> | |
|
7 | #include <QStandardPaths> | |
|
8 | ||
|
9 | Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController") | |
|
7 | 10 | |
|
8 | 11 | class DataSourceController::DataSourceControllerPrivate { |
|
9 | 12 | public: |
|
10 | 13 | DataSourceControllerPrivate() {} |
|
11 | 14 | |
|
12 | 15 | QMutex m_WorkingMutex; |
|
13 | 16 | }; |
|
14 | 17 | |
|
15 | 18 | DataSourceController::DataSourceController(QObject *parent) |
|
16 | 19 | : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()} |
|
17 | 20 | { |
|
18 | 21 | qCDebug(LOG_DataSourceController()) << tr("Construction du DataSourceController") |
|
19 | 22 | << QThread::currentThread(); |
|
20 | 23 | } |
|
21 | 24 | |
|
22 | 25 | DataSourceController::~DataSourceController() |
|
23 | 26 | { |
|
24 | 27 | qCDebug(LOG_DataSourceController()) << tr("Desctruction du DataSourceController") |
|
25 | 28 | << QThread::currentThread(); |
|
26 | 29 | this->waitForFinish(); |
|
27 | 30 | } |
|
28 | 31 | |
|
29 | 32 | void DataSourceController::initialize() |
|
30 | 33 | { |
|
31 | 34 | qCDebug(LOG_DataSourceController()) << tr("initialize du DataSourceController") |
|
32 | 35 | << QThread::currentThread(); |
|
33 | 36 | impl->m_WorkingMutex.lock(); |
|
34 | 37 | qCDebug(LOG_DataSourceController()) << tr("initialize du DataSourceController END"); |
|
35 | 38 | } |
|
36 | 39 | |
|
37 | 40 | void DataSourceController::finalize() |
|
38 | 41 | { |
|
39 | 42 | impl->m_WorkingMutex.unlock(); |
|
40 | 43 | } |
|
41 | 44 | |
|
42 | 45 | void DataSourceController::waitForFinish() |
|
43 | 46 | { |
|
44 | 47 | QMutexLocker locker(&impl->m_WorkingMutex); |
|
45 | 48 | } |
@@ -1,159 +1,158 | |||
|
1 | 1 | |
|
2 | 2 | ## gui - CMakeLists.txt |
|
3 | 3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
4 | 4 | SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}") |
|
5 | 5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
6 | 6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") |
|
7 | 7 | SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui") |
|
8 | 8 | SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources") |
|
9 | 9 | |
|
10 | 10 | # Include gui directory |
|
11 | 11 | include_directories("${INCLUDES_DIR}") |
|
12 | 12 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
|
13 | 13 | |
|
14 | 14 | # Set a variable to display a warning in the version files. |
|
15 | 15 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
16 | 16 | |
|
17 | 17 | # |
|
18 | 18 | # Find Qt modules |
|
19 | 19 | # |
|
20 | 20 | SCIQLOP_FIND_QT(Core Widgets) |
|
21 | 21 | |
|
22 | 22 | # |
|
23 | 23 | # Find dependent libraries |
|
24 | 24 | # ======================== |
|
25 | 25 | find_package(sciqlop-core) |
|
26 | 26 | |
|
27 | message("Librairies inclues dans APP: ${SCIQLOP-CORE_LIBRARIES}") | |
|
28 | 27 | SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES}) |
|
29 | 28 | |
|
30 | 29 | INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR}) |
|
31 | 30 | |
|
32 | 31 | # Add sqpcore to the list of libraries to use |
|
33 | 32 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
34 | 33 | |
|
35 | 34 | # Add dependent shared libraries |
|
36 | 35 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) |
|
37 | 36 | |
|
38 | 37 | |
|
39 | 38 | # Ui files |
|
40 | 39 | FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) |
|
41 | 40 | |
|
42 | 41 | # Resources files |
|
43 | 42 | FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc) |
|
44 | 43 | |
|
45 | 44 | # |
|
46 | 45 | # Compile the library library |
|
47 | 46 | # |
|
48 | 47 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
49 | 48 | ${INCLUDES_DIR}/*.h |
|
50 | 49 | ${SOURCES_DIR}/*.c |
|
51 | 50 | ${SOURCES_DIR}/*.cpp |
|
52 | 51 | ${SOURCES_DIR}/*.h |
|
53 | 52 | ${PROJECT_FORMS}) |
|
54 | 53 | |
|
55 | 54 | QT5_ADD_RESOURCES(RCC_HDRS |
|
56 | 55 | ${PROJECT_RESOURCES} |
|
57 | 56 | ) |
|
58 | 57 | |
|
59 | 58 | QT5_WRAP_UI(UIS_HDRS |
|
60 | 59 | ${PROJECT_FORMS} |
|
61 | 60 | ) |
|
62 | 61 | |
|
63 | 62 | |
|
64 | 63 | ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS}) |
|
65 | 64 | set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
66 | 65 | set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
67 | 66 | |
|
68 | 67 | TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES}) |
|
69 | 68 | qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets) |
|
70 | 69 | |
|
71 | 70 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
72 | 71 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
73 | 72 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
74 | 73 | IF(BUILD_SHARED_LIBS) |
|
75 | 74 | SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
76 | 75 | ELSE() |
|
77 | 76 | TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
78 | 77 | ENDIF() |
|
79 | 78 | |
|
80 | 79 | # Set the variable to parent scope so that the other projects can copy the |
|
81 | 80 | # dependent shared libraries |
|
82 | 81 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME) |
|
83 | 82 | |
|
84 | 83 | # Copy extern shared libraries to the lib folder |
|
85 | 84 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME}) |
|
86 | 85 | |
|
87 | 86 | # Add the files to the list of files to be analyzed |
|
88 | 87 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
89 | 88 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
90 | 89 | # Vera++ exclusion files |
|
91 | 90 | #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl) |
|
92 | 91 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
93 | 92 | |
|
94 | 93 | # |
|
95 | 94 | # Compile the tests |
|
96 | 95 | # |
|
97 | 96 | IF(BUILD_TESTS) |
|
98 | 97 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
99 | 98 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
100 | 99 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
101 | 100 | SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME}) |
|
102 | 101 | |
|
103 | 102 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
104 | 103 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
105 | 104 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
106 | 105 | |
|
107 | 106 | # Add to the list of sources files all the sources in the same |
|
108 | 107 | # directory that aren't another test |
|
109 | 108 | FILE (GLOB currentTestSources |
|
110 | 109 | ${testDirectory}/*.c |
|
111 | 110 | ${testDirectory}/*.cpp |
|
112 | 111 | ${testDirectory}/*.h) |
|
113 | 112 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
114 | 113 | LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
115 | 114 | |
|
116 | 115 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
117 | 116 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) |
|
118 | 117 | qt5_use_modules(${testName} Test) |
|
119 | 118 | |
|
120 | 119 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
121 | 120 | |
|
122 | 121 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
123 | 122 | ENDFOREACH( testFile ) |
|
124 | 123 | |
|
125 | 124 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
126 | 125 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
127 | 126 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
128 | 127 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
129 | 128 | ENDIF(BUILD_TESTS) |
|
130 | 129 | |
|
131 | 130 | # |
|
132 | 131 | # Set the files that must be formatted by clang-format. |
|
133 | 132 | # |
|
134 | 133 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
135 | 134 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
136 | 135 | |
|
137 | 136 | # |
|
138 | 137 | # Set the directories that doxygen must browse to generate the |
|
139 | 138 | # documentation. |
|
140 | 139 | # |
|
141 | 140 | # Source directories: |
|
142 | 141 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
143 | 142 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
144 | 143 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
145 | 144 | # Source directories to exclude from the documentation generation |
|
146 | 145 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
147 | 146 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
148 | 147 | |
|
149 | 148 | # |
|
150 | 149 | # Set the directories with the sources to analyze and propagate the |
|
151 | 150 | # modification to the parent scope |
|
152 | 151 | # |
|
153 | 152 | # Source directories to analyze: |
|
154 | 153 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
155 | 154 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
156 | 155 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
157 | 156 | # Source directories to exclude from the analysis |
|
158 | 157 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
159 | 158 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
@@ -1,33 +1,34 | |||
|
1 | 1 | #ifndef SCIQLOP_SQPAPPLICATION_H |
|
2 | 2 | #define SCIQLOP_SQPAPPLICATION_H |
|
3 | 3 | |
|
4 | 4 | #include "SqpApplication.h" |
|
5 | 5 | |
|
6 | 6 | #include <QApplication> |
|
7 | 7 | #include <QLoggingCategory> |
|
8 | 8 | |
|
9 | 9 | #include <Common/spimpl.h> |
|
10 | 10 | |
|
11 | 11 | Q_DECLARE_LOGGING_CATEGORY(LOG_SqpApplication) |
|
12 | 12 | |
|
13 | 13 | /** |
|
14 | 14 | * @brief The SqpApplication class aims to make the link between SciQlop |
|
15 | 15 | * and its plugins. This is the intermediate class that SciQlop have to use |
|
16 | 16 | * in the way to connect a data source. Please first use load method to intialize |
|
17 | 17 | * a plugin specified by its metadata name (JSON plugin source) then others specifics |
|
18 | 18 | * method will ba able to access it. |
|
19 | 19 | * You can load a data source driver plugin then create a data source. |
|
20 | 20 | */ |
|
21 | ||
|
21 | 22 | class SqpApplication : public QApplication { |
|
22 | 23 | Q_OBJECT |
|
23 | 24 | public: |
|
24 | 25 | explicit SqpApplication(int &argc, char **argv); |
|
25 | 26 | virtual ~SqpApplication(); |
|
26 | 27 | void initialize(); |
|
27 | 28 | |
|
28 | 29 | private: |
|
29 | 30 | class SqpApplicationPrivate; |
|
30 | 31 | spimpl::unique_impl_ptr<SqpApplicationPrivate> impl; |
|
31 | 32 | }; |
|
32 | 33 | |
|
33 | 34 | #endif // SCIQLOP_SQPAPPLICATION_H |
@@ -1,46 +1,45 | |||
|
1 | 1 | #include "SqpApplication.h" |
|
2 | 2 | |
|
3 | 3 | #include <DataSource/DataSourceController.h> |
|
4 | 4 | #include <QThread> |
|
5 | 5 | |
|
6 | 6 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
7 | 7 | |
|
8 | 8 | class SqpApplication::SqpApplicationPrivate { |
|
9 | 9 | public: |
|
10 | 10 | SqpApplicationPrivate() {} |
|
11 | ~SqpApplicationPrivate() | |
|
11 | virtual ~SqpApplicationPrivate() | |
|
12 | 12 | { |
|
13 | 13 | qCInfo(LOG_SqpApplication()) << tr("Desctruction du SqpApplicationPrivate"); |
|
14 | ; | |
|
15 | 14 | m_DataSourceControllerThread.quit(); |
|
16 | 15 | m_DataSourceControllerThread.wait(); |
|
17 | 16 | } |
|
18 | 17 | |
|
19 | 18 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
20 | 19 | QThread m_DataSourceControllerThread; |
|
21 | 20 | }; |
|
22 | 21 | |
|
23 | 22 | |
|
24 | 23 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
25 | 24 | : QApplication(argc, argv), impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
26 | 25 | { |
|
27 | 26 | qCInfo(LOG_SqpApplication()) << tr("Construction du SqpApplication"); |
|
28 | 27 | |
|
29 | 28 | impl->m_DataSourceController = std::make_unique<DataSourceController>(); |
|
30 | 29 | impl->m_DataSourceController->moveToThread(&impl->m_DataSourceControllerThread); |
|
31 | 30 | |
|
32 | 31 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
33 | 32 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
34 | 33 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
35 | 34 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
36 | 35 | |
|
37 | 36 | impl->m_DataSourceControllerThread.start(); |
|
38 | 37 | } |
|
39 | 38 | |
|
40 | 39 | SqpApplication::~SqpApplication() |
|
41 | 40 | { |
|
42 | 41 | } |
|
43 | 42 | |
|
44 | 43 | void SqpApplication::initialize() |
|
45 | 44 | { |
|
46 | 45 | } |
General Comments 0
You need to be logged in to leave comments.
Login now