summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhdanovP <pzhdanov@luxoft.com>2018-08-28 17:40:10 +0300
committerZhdanovP <pzhdanov@luxoft.com>2018-08-28 17:40:10 +0300
commit7230ce5bdbf059ecc86178e7b3b638af3f8cfde0 (patch)
tree6c16686e6f59360f4ec77ca1a6620536c6fb6b6b
parent28648f6012e225f3aa36e3a8263f9c8301ba3283 (diff)
downloadsdl_core-fix/Set_initialize_state_for_the_Interger_type.tar.gz
Set initialize state for the Interger typefix/Set_initialize_state_for_the_Interger_type
The default constructor of Interger class assigns the min value for the wrapped variable, hoowever it keeps the initialize state us `Uninitialized`. So in case when latter user apply such operations as `++`, `+=` the value will be changed but the state is not. The commit adds ability to change initialize state for the class after mentioned operations. So user does not have to call additionaly `initialize` method.
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_inl.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
index b6b47c2ed8..26e2bded7a 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
@@ -186,12 +186,14 @@ Integer<T, minval, maxval>& Integer<T, minval, maxval>::operator=(
template <typename T, T minval, T maxval>
Integer<T, minval, maxval>& Integer<T, minval, maxval>::operator++() {
++value_;
+ value_state_ = range_.Includes(value_) ? kValid : kInvalid;
return *this;
}
template <typename T, T minval, T maxval>
Integer<T, minval, maxval>& Integer<T, minval, maxval>::operator+=(int value) {
value_ += value;
+ value_state_ = range_.Includes(value_) ? kValid : kInvalid;
return *this;
}