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