@@ -0,0 +1,43 | |||
|
1 | #ifndef SCIQLOP_VARIABLESTATES_H | |
|
2 | #define SCIQLOP_VARIABLESTATES_H | |
|
3 | ||
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
6 | #include <Common/MetaTypes.h> | |
|
7 | ||
|
8 | #include <memory> | |
|
9 | #include <tuple> | |
|
10 | ||
|
11 | #include <QVariantMap> | |
|
12 | ||
|
13 | using StateData = QVariantMap; | |
|
14 | SCIQLOP_REGISTER_META_TYPE(STATEDATA_REGISTRY, StateData) | |
|
15 | ||
|
16 | /** | |
|
17 | * @brief The IVariableState class is the representation interface of a state in which a variable | |
|
18 | * may be. It proposes different methods to represent the variable according to its current state | |
|
19 | * @sa Variable | |
|
20 | */ | |
|
21 | struct SCIQLOP_CORE_EXPORT IVariableState { | |
|
22 | virtual ~IVariableState() noexcept = default; | |
|
23 | ||
|
24 | virtual std::unique_ptr<IVariableState> clone() const = 0; | |
|
25 | ||
|
26 | /// @return the data associated with the state | |
|
27 | virtual StateData data() const = 0; | |
|
28 | }; | |
|
29 | ||
|
30 | /// Default implementation of @sa IVariableState | |
|
31 | class AbstractVariableState : public IVariableState { | |
|
32 | public: | |
|
33 | /// @sa IVariableState::data() | |
|
34 | StateData data() const override; | |
|
35 | ||
|
36 | protected: | |
|
37 | explicit AbstractVariableState(StateData data); | |
|
38 | ||
|
39 | private: | |
|
40 | StateData m_Data; | |
|
41 | }; | |
|
42 | ||
|
43 | #endif // SCIQLOP_VARIABLESTATES_H |
@@ -0,0 +1,10 | |||
|
1 | #include "Variable/VariableStates.h" | |
|
2 | ||
|
3 | AbstractVariableState::AbstractVariableState(StateData data) : m_Data{std::move(data)} | |
|
4 | { | |
|
5 | } | |
|
6 | ||
|
7 | StateData AbstractVariableState::data() const | |
|
8 | { | |
|
9 | return m_Data; | |
|
10 | } |
@@ -1,62 +1,63 | |||
|
1 | 1 | |
|
2 | 2 | core_moc_headers = [ |
|
3 | 3 | 'include/Data/IDataProvider.h', |
|
4 | 4 | 'include/DataSource/DataSourceController.h', |
|
5 | 5 | 'include/DataSource/DataSourceItemAction.h', |
|
6 | 6 | 'include/Network/NetworkController.h', |
|
7 | 7 | 'include/Time/TimeController.h', |
|
8 | 8 | 'include/Variable/Variable.h', |
|
9 | 9 | 'include/Variable/VariableCacheController.h', |
|
10 | 10 | 'include/Variable/VariableController.h', |
|
11 | 11 | 'include/Variable/VariableAcquisitionWorker.h', |
|
12 | 12 | 'include/Variable/VariableCacheStrategy.h', |
|
13 | 13 | 'include/Variable/VariableSynchronizationGroup.h', |
|
14 | 14 | 'include/Variable/VariableModel.h', |
|
15 | 15 | 'include/Visualization/VisualizationController.h' |
|
16 | 16 | ] |
|
17 | 17 | |
|
18 | 18 | |
|
19 | 19 | core_moc_files = qt5.preprocess(moc_headers : core_moc_headers) |
|
20 | 20 | |
|
21 | 21 | core_sources = [ |
|
22 | 22 | 'src/Common/DateUtils.cpp', |
|
23 | 23 | 'src/Common/StringUtils.cpp', |
|
24 | 24 | 'src/Data/ScalarSeries.cpp', |
|
25 | 25 | 'src/Data/DataSeriesIterator.cpp', |
|
26 | 26 | 'src/Data/ArrayDataIterator.cpp', |
|
27 | 27 | 'src/Data/VectorSeries.cpp', |
|
28 | 28 | 'src/DataSource/DataSourceController.cpp', |
|
29 | 29 | 'src/DataSource/DataSourceItem.cpp', |
|
30 | 30 | 'src/DataSource/DataSourceItemAction.cpp', |
|
31 | 31 | 'src/Network/NetworkController.cpp', |
|
32 | 32 | 'src/Plugin/PluginManager.cpp', |
|
33 | 33 | 'src/Settings/SqpSettingsDefs.cpp', |
|
34 | 34 | 'src/Time/TimeController.cpp', |
|
35 | 35 | 'src/Variable/Variable.cpp', |
|
36 | 36 | 'src/Variable/VariableCacheController.cpp', |
|
37 | 37 | 'src/Variable/VariableController.cpp', |
|
38 | 38 | 'src/Variable/VariableAcquisitionWorker.cpp', |
|
39 | 39 | 'src/Variable/VariableSynchronizationGroup.cpp', |
|
40 | 40 | 'src/Variable/VariableModel.cpp', |
|
41 | 'src/Variable/VariableStates.cpp', | |
|
41 | 42 | 'src/Visualization/VisualizationController.cpp' |
|
42 | 43 | ] |
|
43 | 44 | |
|
44 | 45 | core_inc = include_directories(['include', '../plugin/include']) |
|
45 | 46 | |
|
46 | 47 | sciqlop_core_lib = library('sciqlopcore', |
|
47 | 48 | core_sources, |
|
48 | 49 | core_moc_files, |
|
49 | 50 | cpp_args : '-DCORE_LIB', |
|
50 | 51 | include_directories : core_inc, |
|
51 | 52 | dependencies : [qt5core, qt5network], |
|
52 | 53 | install : true |
|
53 | 54 | ) |
|
54 | 55 | |
|
55 | 56 | |
|
56 | 57 | sciqlop_core = declare_dependency(link_with : sciqlop_core_lib, |
|
57 | 58 | include_directories : core_inc, |
|
58 | 59 | dependencies : [qt5core, qt5network]) |
|
59 | 60 | |
|
60 | 61 | |
|
61 | 62 | subdir('tests') |
|
62 | 63 |
General Comments 0
You need to be logged in to leave comments.
Login now