49 explicit LockedValue(
const T& value) : is_locked_{false}, value_{value}{}
61 "LockedValue is already locked and cannot be assigned a new value.");
70 "LockedValue is already locked and cannot be set a new value.");
115 return value_ == value;
123 bool is_locked_ {
false};
Set of macros for Sparta assertions. Caught by the framework.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
Provides a wrapper around a value to ensure that once the value is frozen or locked,...
void lock()
Lock the LockedValue instance immediately.
bool isLocked() const
Query if LockedValue instance is locked.
void setAndLock(const T &value)
This method assigns a value to LockedValue class and immediately locks it.
LockedValue< T > & operator=(const LockedValue< T > &)=delete
Copy-Assignment of a LockedValue to another LockedValue is a deleted function.
LockedValue()
This is the LockedValue Default Constructor.
const value_type & getValue() const
Get the value of the underlying resource of the LockedValue.
value_type & getValue()
get the value of the underlying resource of the lockedvalue.
bool operator!=(const value_type &value) const
Overload the compare not equal operator for LockedValue class.
LockedValue(const T &value, const bool lock)
This is the LockedValue Constructor with initial value and lock as parameter.
bool operator==(const value_type &value) const
Overload the compare equal operator for LockedValue class.
T value_type
Convenient typedef for the value type.
LockedValue(const T &value)
This is the LockedValue Constructor with initial value as parameter.
Macros for handling exponential backoff.