32
* @brief Templated class that wraps a value and timestamp.
33
* @tparam T The contained value.
31
35
template<typename T>
34
Update(const T& value = T{}, const Clock::Timestamp& when = Clock::Timestamp{}) : value{value}, when{when}
39
* @brief Constructs a valid update with the given value and timestamp.
40
* @param [in] value The value delivered with this update.
41
* @param [in] when The timestamp when the value was measured.
43
inline Update(const T& value = T{},
44
const Clock::Timestamp& when = Clock::now())
45
: value{value}, when{when}
38
bool operator==(const Update<T>& rhs) const
50
* @brief operator == checks if two updates are equal.
51
* @param [in] rhs The update to check against.
52
* @return true iff this instance equals rhs.
54
inline bool operator==(const Update<T>& rhs) const
40
56
return value == rhs.value && when == rhs.when;
43
bool operator!=(const Update<T>& rhs) const
60
* @brief operator != checks if two updates are unequal.
61
* @param [in] rhs The update to check against.
62
* @return true iff this instance does not equal rhs.
64
inline bool operator!=(const Update<T>& rhs) const
45
66
return !(value == rhs.value && when == rhs.when);
69
/** The value delivered with this update. */
49
Clock::Timestamp when;
72
/** Time when the updated value was measured. */
73
Clock::Timestamp when = Clock::beginning_of_time();
77
* @brief Pretty-prints the update to the provided output stream.
78
* @param out The stream to write to.
79
* @param update The value to be printed.
52
81
template<typename T>
53
82
inline std::ostream& operator<<(std::ostream& out, const Update<T>& update)