VariableStates.h
43 lines
| 1.0 KiB
| text/x-c
|
CLexer
|
r806 | #ifndef SCIQLOP_VARIABLESTATES_H | ||
#define SCIQLOP_VARIABLESTATES_H | ||||
#include "CoreGlobal.h" | ||||
#include <Common/MetaTypes.h> | ||||
#include <memory> | ||||
#include <tuple> | ||||
#include <QVariantMap> | ||||
using StateData = QVariantMap; | ||||
SCIQLOP_REGISTER_META_TYPE(STATEDATA_REGISTRY, StateData) | ||||
/** | ||||
* @brief The IVariableState class is the representation interface of a state in which a variable | ||||
* may be. It proposes different methods to represent the variable according to its current state | ||||
* @sa Variable | ||||
*/ | ||||
struct SCIQLOP_CORE_EXPORT IVariableState { | ||||
virtual ~IVariableState() noexcept = default; | ||||
virtual std::unique_ptr<IVariableState> clone() const = 0; | ||||
/// @return the data associated with the state | ||||
virtual StateData data() const = 0; | ||||
}; | ||||
/// Default implementation of @sa IVariableState | ||||
class AbstractVariableState : public IVariableState { | ||||
public: | ||||
/// @sa IVariableState::data() | ||||
StateData data() const override; | ||||
protected: | ||||
explicit AbstractVariableState(StateData data); | ||||
private: | ||||
StateData m_Data; | ||||
}; | ||||
#endif // SCIQLOP_VARIABLESTATES_H | ||||