@@ -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 |
General Comments 0
You need to be logged in to leave comments.
Login now