Template Class LoggedValue

Class Documentation

template<typename T>
class LoggedValue

The LoggedValue class is a container of a variable that automatically register/unregister to a Channel when created/destroyed.

Setting and getting values is thread-safe.

Public Functions

inline LoggedValue()
inline ~LoggedValue()
LoggedValue(LoggedValue const &other) = delete
LoggedValue &operator=(LoggedValue const &other) = delete
LoggedValue(LoggedValue &&other) = default
LoggedValue &operator=(LoggedValue &&other) = default
inline void set(const T &value, bool auto_enable = true)

set the value of the variable.

Parameters:
  • value – new value

  • auto_enable – if true and the current instance is disabled, call setEnabled(true)

inline T get()

get the stored value.

inline LockedRef<T, Mutex> getLockedReference()
inline void setEnabled(bool enabled)

Disabling a LoggedValue means that we will not record it in the snapshot.

inline bool isEnabled() const

Protected Functions

inline LoggedValue(const std::shared_ptr<LogChannel> &channel, const std::string &name, T initial_value)

Protected Attributes

friend LogChannel