Ocean
Ocean::ScopedValueT< T > Class Template Reference

This class implements a scoped value that allows to change a specified value at the end of a scope. More...

Public Member Functions

 ScopedValueT (T &target, const T &delayedValue)
 Creates a new scoped value object. More...
 
 ScopedValueT (T &target, T &&delayedValue)
 Creates a new scoped value object. More...
 
 ScopedValueT (T &target, const T &delayedValue, const T &immediateValue)
 Creates a new scoped value object. More...
 
 ScopedValueT (T &target, T &&delayedValue, T &&immediateValue)
 Creates a new scoped value object. More...
 
 ~ScopedValueT ()
 Destructs the scoped value object. More...
 
void setDelayed (const T &value)
 Changes the value that will be assigned at the end of the surrounding scope. More...
 
void setDelayed (T &&value)
 Changes the value that will be assigned at the end of the surrounding scope. More...
 
void setImmediately (const T &value)
 Immediately changes the target value, the modification is not applied at the end of the surrounding scope. More...
 
void setImmediately (T &&value)
 Immediately changes the target value, the modification is not applied at the end of the surrounding scope. More...
 

Protected Member Functions

 ScopedValueT (const ScopedValueT< T > &value)=delete
 Disabled copy constructor. More...
 
ScopedValueToperator= (const ScopedValueT< T > &value)=delete
 Disabled copy operator. More...
 

Protected Attributes

T & valueTarget
 Target value that will be changed at the end of the surrounding scope. More...
 
valueDelayed
 Value that will be assigned at the end of the surrounding scope. More...
 

Detailed Description

template<typename T>
class Ocean::ScopedValueT< T >

This class implements a scoped value that allows to change a specified value at the end of a scope.

Template Parameters
TData type of the value to be set

Constructor & Destructor Documentation

◆ ScopedValueT() [1/5]

template<typename T >
Ocean::ScopedValueT< T >::ScopedValueT ( T &  target,
const T &  delayedValue 
)
inline

Creates a new scoped value object.

Parameters
targetThe target value that will be changed at the end of the surrounding scope
delayedValueValue that will be assigned at the end of the surrounding scope

◆ ScopedValueT() [2/5]

template<typename T >
Ocean::ScopedValueT< T >::ScopedValueT ( T &  target,
T &&  delayedValue 
)
inline

Creates a new scoped value object.

Parameters
targetThe target value that will be changed at the end of the surrounding scope
delayedValueValue that will be assigned at the end of the surrounding scope

◆ ScopedValueT() [3/5]

template<typename T >
Ocean::ScopedValueT< T >::ScopedValueT ( T &  target,
const T &  delayedValue,
const T &  immediateValue 
)
inline

Creates a new scoped value object.

Parameters
targetThe target value that will be changed at the end of the surrounding scope
delayedValueValue that will be assigned at the end of the surrounding scope
immediateValueValue that will be assigned directly inside the constructor

◆ ScopedValueT() [4/5]

template<typename T >
Ocean::ScopedValueT< T >::ScopedValueT ( T &  target,
T &&  delayedValue,
T &&  immediateValue 
)
inline

Creates a new scoped value object.

Parameters
targetThe target value that will be changed at the end of the surrounding scope
delayedValueValue that will be assigned at the end of the surrounding scope
immediateValueValue that will be assigned directly inside the constructor

◆ ~ScopedValueT()

template<typename T >
Ocean::ScopedValueT< T >::~ScopedValueT
inline

Destructs the scoped value object.

◆ ScopedValueT() [5/5]

template<typename T >
Ocean::ScopedValueT< T >::ScopedValueT ( const ScopedValueT< T > &  value)
protecteddelete

Disabled copy constructor.

Parameters
valueThe value which would be copied

Member Function Documentation

◆ operator=()

template<typename T >
ScopedValueT& Ocean::ScopedValueT< T >::operator= ( const ScopedValueT< T > &  value)
protecteddelete

Disabled copy operator.

Parameters
valueThe value which would be copied

◆ setDelayed() [1/2]

template<typename T >
void Ocean::ScopedValueT< T >::setDelayed ( const T &  value)
inline

Changes the value that will be assigned at the end of the surrounding scope.

Parameters
valueThe value to be changed

◆ setDelayed() [2/2]

template<typename T >
void Ocean::ScopedValueT< T >::setDelayed ( T &&  value)
inline

Changes the value that will be assigned at the end of the surrounding scope.

Parameters
valueThe value to be changed

◆ setImmediately() [1/2]

template<typename T >
void Ocean::ScopedValueT< T >::setImmediately ( const T &  value)
inline

Immediately changes the target value, the modification is not applied at the end of the surrounding scope.

Parameters
valueThe value to be changed

◆ setImmediately() [2/2]

template<typename T >
void Ocean::ScopedValueT< T >::setImmediately ( T &&  value)
inline

Immediately changes the target value, the modification is not applied at the end of the surrounding scope.

Parameters
valueThe value to be changed

Field Documentation

◆ valueDelayed

template<typename T >
T Ocean::ScopedValueT< T >::valueDelayed
protected

Value that will be assigned at the end of the surrounding scope.

◆ valueTarget

template<typename T >
T& Ocean::ScopedValueT< T >::valueTarget
protected

Target value that will be changed at the end of the surrounding scope.


The documentation for this class was generated from the following file: