![]() |
Kea 2.7.3
|
This class implements set/commit mechanism for a single object. More...
#include <staged_value.h>
Public Member Functions | |
StagedValue () | |
Constructor. | |
void | commit () |
Commits a value. | |
const ValueType & | getValue () const |
Retrieves current value. | |
operator const ValueType & () const | |
Conversion operator to value type. | |
StagedValue & | operator= (const ValueType &value) |
Assignment operator. | |
void | reset () |
Resets value to defaults. | |
void | revert () |
Reverts any modifications since last commit. | |
void | setValue (const ValueType &new_value) |
Sets new value. | |
This class implements set/commit mechanism for a single object.
In some cases it is desired to set value for an object while keeping ability to revert to an original value under certain conditions. This is often desired for objects holding some part of application's configuration. Configuration is usually a multi-step process and may fail on almost any stage. If this happens, the last good configuration should be used. This implies that some of the state of some of the objects needs to be reverted.
This class implements a mechanism for setting and committing a value. Until the new value has been committed it is possible to revert to an original value.
ValueType | Type of the value represented by this class. |
Definition at line 32 of file staged_value.h.
|
inline |
|
inline |
Commits a value.
Definition at line 61 of file staged_value.h.
References isc::util::StagedValue< ValueType >::revert().
|
inline |
Retrieves current value.
If the value hasn't been modified since last commit, reset or revert operation, a committed value is returned. If the value has been modified, the modified value is returned.
Definition at line 48 of file staged_value.h.
Referenced by isc::util::StagedValue< isc::dhcp::OptionDefSpaceContainer >::operator const isc::dhcp::OptionDefSpaceContainer &().
|
inline |
Conversion operator to value type.
Definition at line 93 of file staged_value.h.
|
inline |
Assignment operator.
value | New value to be assigned. |
Definition at line 85 of file staged_value.h.
References isc::util::StagedValue< ValueType >::setValue().
|
inline |
Resets value to defaults.
Definition at line 70 of file staged_value.h.
References isc::util::StagedValue< ValueType >::revert().
|
inline |
Reverts any modifications since last commit.
Definition at line 76 of file staged_value.h.
Referenced by isc::util::StagedValue< ValueType >::commit(), and isc::util::StagedValue< ValueType >::reset().
|
inline |
Sets new value.
new_value | New value to be assigned. |
Definition at line 55 of file staged_value.h.
Referenced by isc::util::StagedValue< ValueType >::operator=().