@@ -19,40 +19,28 @@ namespace aos::cloudprotocol {
19
19
static constexpr auto cStateReason = cErrorMessageLen;
20
20
21
21
/* *
22
- * State acceptance .
22
+ * New state .
23
23
*/
24
- struct StateAcceptance {
25
- InstanceIdent mInstanceIdent ;
24
+ struct NewState : public InstanceIdent {
26
25
StaticString<crypto::cSHA2DigestSize> mChecksum ;
27
- StateResult mResult ;
28
- StaticString<cStateReason> mReason ;
26
+ StaticString<cStateLen> mState ;
29
27
30
28
/* *
31
- * Compares state acceptance .
29
+ * Compares new state .
32
30
*
33
- * @param acceptance state acceptance to compare with.
31
+ * @param state new state to compare with.
34
32
* @return bool.
35
33
*/
36
- bool operator ==(const StateAcceptance& acceptance ) const
34
+ bool operator ==(const NewState& state ) const
37
35
{
38
- return mInstanceIdent == acceptance.mInstanceIdent && mChecksum == acceptance.mChecksum
39
- && mResult == acceptance.mResult && mReason == acceptance.mReason ;
36
+ return InstanceIdent::operator ==(state) && mChecksum == state.mChecksum && mState == state.mState ;
40
37
}
41
-
42
- /* *
43
- * Compares state acceptance.
44
- *
45
- * @param acceptance state acceptance to compare with.
46
- * @return bool.
47
- */
48
- bool operator !=(const StateAcceptance& acceptance) const { return !operator ==(acceptance); }
49
38
};
50
39
51
40
/* *
52
41
* Update state.
53
42
*/
54
- struct UpdateState {
55
- InstanceIdent mInstanceIdent ;
43
+ struct UpdateState : public InstanceIdent {
56
44
StaticString<crypto::cSHA2DigestSize> mChecksum ;
57
45
StaticString<cStateLen> mState ;
58
46
@@ -64,7 +52,7 @@ struct UpdateState {
64
52
*/
65
53
bool operator ==(const UpdateState& state) const
66
54
{
67
- return mInstanceIdent == state. mInstanceIdent && mChecksum == state.mChecksum && mState == state.mState ;
55
+ return InstanceIdent:: operator ==( state) && mChecksum == state.mChecksum && mState == state.mState ;
68
56
}
69
57
70
58
/* *
@@ -77,23 +65,32 @@ struct UpdateState {
77
65
};
78
66
79
67
/* *
80
- * New state .
68
+ * State acceptance .
81
69
*/
82
- struct NewState {
83
- InstanceIdent mInstanceIdent ;
70
+ struct StateAcceptance : public InstanceIdent {
84
71
StaticString<crypto::cSHA2DigestSize> mChecksum ;
85
- StaticString<cStateLen> mState ;
72
+ StateResult mResult ;
73
+ StaticString<cStateReason> mReason ;
86
74
87
75
/* *
88
- * Compares new state.
76
+ * Compares state acceptance .
89
77
*
90
- * @param state new state to compare with.
78
+ * @param acceptance state acceptance to compare with.
91
79
* @return bool.
92
80
*/
93
- bool operator ==(const NewState& state ) const
81
+ bool operator ==(const StateAcceptance& acceptance ) const
94
82
{
95
- return mInstanceIdent == state.mInstanceIdent && mChecksum == state.mChecksum && mState == state.mState ;
83
+ return InstanceIdent::operator ==(acceptance) && mChecksum == acceptance.mChecksum
84
+ && mResult == acceptance.mResult && mReason == acceptance.mReason ;
96
85
}
86
+
87
+ /* *
88
+ * Compares state acceptance.
89
+ *
90
+ * @param acceptance state acceptance to compare with.
91
+ * @return bool.
92
+ */
93
+ bool operator !=(const StateAcceptance& acceptance) const { return !operator ==(acceptance); }
97
94
};
98
95
99
96
/* *
0 commit comments