@@ -0,0 +1,51 | |||
|
1 | #include "AmdaResultParserHelper.h" | |
|
2 | ||
|
3 | Q_LOGGING_CATEGORY(LOG_AmdaResultParserHelper, "AmdaResultParserHelper") | |
|
4 | ||
|
5 | // ////////////////// // | |
|
6 | // ScalarParserHelper // | |
|
7 | // ////////////////// // | |
|
8 | ||
|
9 | bool ScalarParserHelper::checkProperties() | |
|
10 | { | |
|
11 | /// @todo ALX | |
|
12 | } | |
|
13 | ||
|
14 | std::shared_ptr<IDataSeries> ScalarParserHelper::createSeries() | |
|
15 | { | |
|
16 | /// @todo ALX | |
|
17 | } | |
|
18 | ||
|
19 | void ScalarParserHelper::readPropertyLine(const QString &line) | |
|
20 | { | |
|
21 | /// @todo ALX | |
|
22 | } | |
|
23 | ||
|
24 | void ScalarParserHelper::readResultLine(const QString &line) | |
|
25 | { | |
|
26 | /// @todo ALX | |
|
27 | } | |
|
28 | ||
|
29 | // ////////////////// // | |
|
30 | // VectorParserHelper // | |
|
31 | // ////////////////// // | |
|
32 | ||
|
33 | bool VectorParserHelper::checkProperties() | |
|
34 | { | |
|
35 | /// @todo ALX | |
|
36 | } | |
|
37 | ||
|
38 | std::shared_ptr<IDataSeries> VectorParserHelper::createSeries() | |
|
39 | { | |
|
40 | /// @todo ALX | |
|
41 | } | |
|
42 | ||
|
43 | void VectorParserHelper::readPropertyLine(const QString &line) | |
|
44 | { | |
|
45 | /// @todo ALX | |
|
46 | } | |
|
47 | ||
|
48 | void VectorParserHelper::readResultLine(const QString &line) | |
|
49 | { | |
|
50 | /// @todo ALX | |
|
51 | } |
@@ -1,46 +1,68 | |||
|
1 | 1 | #ifndef SCIQLOP_AMDARESULTPARSERHELPER_H |
|
2 | 2 | #define SCIQLOP_AMDARESULTPARSERHELPER_H |
|
3 | 3 | |
|
4 | 4 | #include <QtCore/QLoggingCategory> |
|
5 | 5 | #include <QtCore/QString> |
|
6 | 6 | |
|
7 | 7 | #include <memory> |
|
8 | 8 | |
|
9 | 9 | class IDataSeries; |
|
10 | 10 | |
|
11 | 11 | Q_DECLARE_LOGGING_CATEGORY(LOG_AmdaResultParserHelper) |
|
12 | 12 | |
|
13 | 13 | /** |
|
14 | 14 | * Helper used to interpret the data of an AMDA result file and generate the corresponding data |
|
15 | 15 | * series. |
|
16 | 16 | * |
|
17 | 17 | * It proposes methods allowing to read line by line an AMDA file and to extract the properties |
|
18 | 18 | * (from the header) and the values corresponding to the data series |
|
19 | 19 | * |
|
20 | 20 | * @sa DataSeries |
|
21 | 21 | */ |
|
22 | 22 | struct IAmdaResultParserHelper { |
|
23 | 23 | virtual ~IAmdaResultParserHelper() noexcept = default; |
|
24 | 24 | |
|
25 | 25 | /// Verifies that the extracted properties are well formed and possibly applies other treatments |
|
26 | 26 | /// on them |
|
27 | 27 | /// @return true if the properties are well formed, false otherwise |
|
28 | 28 | virtual bool checkProperties() = 0; |
|
29 | 29 | |
|
30 | 30 | /// Creates the data series from the properties and values extracted from the AMDA file. |
|
31 | 31 | /// @warning as the data are moved in the data series, the helper shouldn't be used after |
|
32 | 32 | /// calling this method |
|
33 | 33 | /// @return the data series created |
|
34 | 34 | virtual std::shared_ptr<IDataSeries> createSeries() = 0; |
|
35 | 35 | |
|
36 | 36 | /// Reads a line from the AMDA file to extract a property that will be used to generate the data |
|
37 | 37 | /// series |
|
38 | 38 | /// @param line tahe line to interpret |
|
39 | 39 | virtual void readPropertyLine(const QString &line) = 0; |
|
40 | 40 | |
|
41 | 41 | /// Reads a line from the AMDA file to extract a value that will be set in the data series |
|
42 | 42 | /// @param line the line to interpret |
|
43 | 43 | virtual void readResultLine(const QString &line) = 0; |
|
44 | 44 | }; |
|
45 | 45 | |
|
46 | /** | |
|
47 | * Implementation of @sa IAmdaResultParserHelper for scalars | |
|
48 | */ | |
|
49 | class ScalarParserHelper : public IAmdaResultParserHelper { | |
|
50 | public: | |
|
51 | bool checkProperties() override; | |
|
52 | std::shared_ptr<IDataSeries> createSeries() override; | |
|
53 | void readPropertyLine(const QString &line) override; | |
|
54 | void readResultLine(const QString &line) override; | |
|
55 | }; | |
|
56 | ||
|
57 | /** | |
|
58 | * Implementation of @sa IAmdaResultParserHelper for vectors | |
|
59 | */ | |
|
60 | class VectorParserHelper : public IAmdaResultParserHelper { | |
|
61 | public: | |
|
62 | bool checkProperties() override; | |
|
63 | std::shared_ptr<IDataSeries> createSeries() override; | |
|
64 | void readPropertyLine(const QString &line) override; | |
|
65 | void readResultLine(const QString &line) override; | |
|
66 | }; | |
|
67 | ||
|
46 | 68 | #endif // SCIQLOP_AMDARESULTPARSERHELPER_H |
@@ -1,73 +1,74 | |||
|
1 | 1 | |
|
2 | 2 | amdaplugin_moc_headers = [ |
|
3 | 3 | 'include/AmdaPlugin.h', |
|
4 | 4 | 'include/AmdaProvider.h' |
|
5 | 5 | ] |
|
6 | 6 | |
|
7 | 7 | amdaplugin_sources = [ |
|
8 | 8 | 'src/AmdaDefs.cpp', |
|
9 | 9 | 'src/AmdaParser.cpp', |
|
10 | 10 | 'src/AmdaPlugin.cpp', |
|
11 | 11 | 'src/AmdaProvider.cpp', |
|
12 | 12 | 'src/AmdaResultParser.cpp' |
|
13 | 'src/AmdaResultParserHelper.cpp' | |
|
13 | 14 | ] |
|
14 | 15 | |
|
15 | 16 | amdaplugin_ui_files = [] |
|
16 | 17 | amdaplugin_resources_files = [ |
|
17 | 18 | 'resources/amdaresources.qrc' |
|
18 | 19 | ] |
|
19 | 20 | |
|
20 | 21 | amdaplugin_inc = include_directories(['include', '../../plugin/include']) |
|
21 | 22 | |
|
22 | 23 | moc_gen = generator(moc, |
|
23 | 24 | output : 'moc_@BASENAME@.cpp', |
|
24 | 25 | arguments : ['@INPUT@', |
|
25 | 26 | '-DPLUGIN_JSON_FILE_PATH="'+meson.source_root()+'/plugins/amda/resources/amda.json"', |
|
26 | 27 | '-I', meson.current_source_dir()+'/include', |
|
27 | 28 | '-I', meson.current_source_dir()+'/../../plugin/include', |
|
28 | 29 | '-o', '@OUTPUT@']) |
|
29 | 30 | |
|
30 | 31 | rcc_gen = generator(rcc, |
|
31 | 32 | output : 'qrc_@BASENAME@.cpp', |
|
32 | 33 | arguments : ['--name=@BASENAME@"', |
|
33 | 34 | '--output', |
|
34 | 35 | '@OUTPUT@', |
|
35 | 36 | '@INPUT@']) |
|
36 | 37 | |
|
37 | 38 | amdaplugin_moc_plugin_files = moc_gen.process(amdaplugin_moc_headers) |
|
38 | 39 | |
|
39 | 40 | amdaplugin_rcc_plugin_files = rcc_gen.process(amdaplugin_resources_files) |
|
40 | 41 | |
|
41 | 42 | #amdaplugin_rcc_plugin_files = qt5.preprocess( |
|
42 | 43 | # qresources : amdaplugin_resources_files) |
|
43 | 44 | |
|
44 | 45 | amdaplugin_moc_files = qt5.preprocess( |
|
45 | 46 | ui_files : amdaplugin_ui_files) |
|
46 | 47 | |
|
47 | 48 | sciqlop_amdaplugin = library('amdaplugin', |
|
48 | 49 | amdaplugin_sources, |
|
49 | 50 | amdaplugin_moc_files, |
|
50 | 51 | amdaplugin_rcc_plugin_files, |
|
51 | 52 | amdaplugin_moc_plugin_files, |
|
52 | 53 | cpp_args : ['-DAMDA_LIB','-DQT_PLUGIN'], |
|
53 | 54 | include_directories : [amdaplugin_inc], |
|
54 | 55 | dependencies : [sciqlop_core, sciqlop_gui], |
|
55 | 56 | install : true |
|
56 | 57 | ) |
|
57 | 58 | |
|
58 | 59 | |
|
59 | 60 | tests = [ |
|
60 | 61 | [['tests/TestAmdaParser.cpp'],'test_amda_parser','AMDA parser test'], |
|
61 | 62 | [['tests/TestAmdaResultParser.cpp'],'test_amda_result_parser','AMDA result parser test'], |
|
62 | 63 | [['tests/TestAmdaAcquisition.cpp'],'test_amda_acquisition','AMDA Acquisition test'] |
|
63 | 64 | ] |
|
64 | 65 | |
|
65 | 66 | foreach unit_test : tests |
|
66 | 67 | test_moc_files = qt5.preprocess(moc_sources : unit_test[0]) |
|
67 | 68 | test_exe = executable(unit_test[1],unit_test[0] , test_moc_files, |
|
68 | 69 | link_with : [sciqlop_amdaplugin], |
|
69 | 70 | include_directories : [amdaplugin_inc], |
|
70 | 71 | cpp_args : ['-DAMDA_TESTS_RESOURCES_DIR="'+meson.current_source_dir()+'/tests-resources"'], |
|
71 | 72 | dependencies : [sciqlop_core, sciqlop_gui, qt5test]) |
|
72 | 73 | test(unit_test[2], test_exe, args: ['-teamcity', '-o', '@0@.teamcity.txt'.format(unit_test[1])], timeout: 3 * 60) |
|
73 | 74 | endforeach |
General Comments 0
You need to be logged in to leave comments.
Login now