##// END OF EJS Templates
Creates states for variables
Alexandre Leroux -
r807:c2c9696a1972
parent child
Show More
@@ -40,4 +40,32 private:
40 StateData m_Data;
40 StateData m_Data;
41 };
41 };
42
42
43 /**
44 * State when a variable is fully loaded (i.e. the last request on the variable has been
45 * successfully completed)
46 */
47 class LoadedState : public AbstractVariableState {
48 public:
49 explicit LoadedState();
50 std::unique_ptr<IVariableState> clone() const override;
51 };
52
53 /**
54 * State when a variable is loading (i.e. there's pending requests for the variable)
55 */
56 class LoadingState : public AbstractVariableState {
57 public:
58 explicit LoadingState();
59 std::unique_ptr<IVariableState> clone() const override;
60 };
61
62 /**
63 * State when a variable is canceled (i.e. the last request on the variable has been canceled)
64 */
65 class CanceledState : public AbstractVariableState {
66 public:
67 explicit CanceledState();
68 std::unique_ptr<IVariableState> clone() const override;
69 };
70
43 #endif // SCIQLOP_VARIABLESTATES_H
71 #endif // SCIQLOP_VARIABLESTATES_H
@@ -8,3 +8,42 StateData AbstractVariableState::data() const
8 {
8 {
9 return m_Data;
9 return m_Data;
10 }
10 }
11
12 // /////////// //
13 // LoadedState //
14 // /////////// //
15
16 LoadedState::LoadedState() : AbstractVariableState{{{"color", "green"}}}
17 {
18 }
19
20 std::unique_ptr<IVariableState> LoadedState::clone() const
21 {
22 return std::make_unique<LoadedState>(*this);
23 }
24
25 // //////////// //
26 // LoadingState //
27 // //////////// //
28
29 LoadingState::LoadingState() : AbstractVariableState{{{"color", "blue"}}}
30 {
31 }
32
33 std::unique_ptr<IVariableState> LoadingState::clone() const
34 {
35 return std::make_unique<LoadingState>(*this);
36 }
37
38 // ///////////// //
39 // CanceledState //
40 // ///////////// //
41
42 CanceledState::CanceledState() : AbstractVariableState{{{"color", "red"}}}
43 {
44 }
45
46 std::unique_ptr<IVariableState> CanceledState::clone() const
47 {
48 return std::make_unique<CanceledState>(*this);
49 }
General Comments 0
You need to be logged in to leave comments. Login now