#ifndef SCIQLOP_VARIABLESTATES_H #define SCIQLOP_VARIABLESTATES_H #include "CoreGlobal.h" #include #include #include #include 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 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; }; /** * State when a variable is fully loaded (i.e. the last request on the variable has been * successfully completed) */ class LoadedState : public AbstractVariableState { public: explicit LoadedState(); std::unique_ptr clone() const override; }; /** * State when a variable is loading (i.e. there's pending requests for the variable) */ class LoadingState : public AbstractVariableState { public: explicit LoadingState(); std::unique_ptr clone() const override; }; /** * State when a variable is canceled (i.e. the last request on the variable has been canceled) */ class CanceledState : public AbstractVariableState { public: explicit CanceledState(); std::unique_ptr clone() const override; }; #endif // SCIQLOP_VARIABLESTATES_H