10#include <boost/noncopyable.hpp>
11#include <boost/shared_ptr.hpp>
31template<
typename ValueType>
39 : staging_(new ValueType()), current_(new ValueType()),
49 return (modified_ ? *staging_ : *current_);
56 *staging_ = new_value;
72 current_.reset(
new ValueType());
77 staging_.reset(
new ValueType());
93 operator const ValueType&()
const {
102 boost::shared_ptr<ValueType> staging_;
107 boost::shared_ptr<ValueType> current_;
This class implements set/commit mechanism for a single object.
void revert()
Reverts any modifications since last commit.
StagedValue & operator=(const ValueType &value)
Assignment operator.
void commit()
Commits a value.
void setValue(const ValueType &new_value)
Sets new value.
const ValueType & getValue() const
Retrieves current value.
void reset()
Resets value to defaults.
StagedValue()
Constructor.
Defines the logger used by the top-level component of kea-lfc.