8#ifndef META_OCEAN_BASE_SCOPED_VALUE_H
9#define META_OCEAN_BASE_SCOPED_VALUE_H
22template <
typename T,
typename TValue = T>
32 inline ScopedValueT(T& target,
const TValue& delayedValue);
47 inline ScopedValueT(T& target,
const TValue& delayedValue,
const TValue& immediateValue);
55 inline ScopedValueT(T& target, TValue&& delayedValue, TValue&& immediateValue);
109template <
typename T,
typename TValue>
112 delayed_(delayedValue)
117template <
typename T,
typename TValue>
120 delayed_(std::move(delayedValue))
125template <
typename T,
typename TValue>
128 delayed_(delayedValue)
130 target = immediateValue;
133template <
typename T,
typename TValue>
136 delayed_(std::move(delayedValue))
138 target = std::move(immediateValue);
141template <
typename T,
typename TValue>
147template <
typename T,
typename TValue>
153template <
typename T,
typename TValue>
156 delayed_ = std::move(value);
159template <
typename T,
typename TValue>
165template <
typename T,
typename TValue>
168 target_ = std::move(value);
This class implements a scoped value that allows to change a specified value at the end of a scope.
Definition ScopedValue.h:24
ScopedValueT(const ScopedValueT< T > &value)=delete
Disabled copy constructor.
ScopedValueT(T &target, const TValue &delayedValue)
Creates a new scoped value object.
Definition ScopedValue.h:110
ScopedValueT & operator=(const ScopedValueT< T > &value)=delete
Disabled copy operator.
~ScopedValueT()
Destructs the scoped value object.
Definition ScopedValue.h:142
void setDelayed(const TValue &value)
Changes the value that will be assigned at the end of the surrounding scope.
Definition ScopedValue.h:148
TValue delayed_
Value that will be assigned at the end of the surrounding scope.
Definition ScopedValue.h:106
void setImmediately(const TValue &value)
Immediately changes the target value, the modification is not applied at the end of the surrounding s...
Definition ScopedValue.h:160
T & target_
Target value that will be changed at the end of the surrounding scope.
Definition ScopedValue.h:103
The namespace covering the entire Ocean framework.
Definition Accessor.h:15