Ocean
Loading...
Searching...
No Matches
Ocean::ScopedValueT< T, TValue > Class Template Reference

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

#include <ScopedValue.h>

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

T & target_
 Target value that will be changed at the end of the surrounding scope.
 
TValue delayed_
 Value that will be assigned at the end of the surrounding scope.
 

Detailed Description

template<typename T, typename TValue = T>
class Ocean::ScopedValueT< T, TValue >

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 (or object) to be set
TValueData type of the value to be used for the delayed (and immediate) assignment

Constructor & Destructor Documentation

◆ ScopedValueT() [1/5]

template<typename T , typename TValue >
Ocean::ScopedValueT< T, TValue >::ScopedValueT ( T &  target,
const TValue &  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 , typename TValue >
Ocean::ScopedValueT< T, TValue >::ScopedValueT ( T &  target,
TValue &&  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 , typename TValue >
Ocean::ScopedValueT< T, TValue >::ScopedValueT ( T &  target,
const TValue &  delayedValue,
const TValue &  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 , typename TValue >
Ocean::ScopedValueT< T, TValue >::ScopedValueT ( T &  target,
TValue &&  delayedValue,
TValue &&  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 , typename TValue >
Ocean::ScopedValueT< T, TValue >::~ScopedValueT ( )
inline

Destructs the scoped value object.

◆ ScopedValueT() [5/5]

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

Disabled copy constructor.

Parameters
valueThe value which would be copied

Member Function Documentation

◆ operator=()

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

Disabled copy operator.

Parameters
valueThe value which would be copied

◆ setDelayed() [1/2]

template<typename T , typename TValue >
void Ocean::ScopedValueT< T, TValue >::setDelayed ( const TValue &  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 , typename TValue >
void Ocean::ScopedValueT< T, TValue >::setDelayed ( TValue &&  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 , typename TValue >
void Ocean::ScopedValueT< T, TValue >::setImmediately ( const TValue &  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 , typename TValue >
void Ocean::ScopedValueT< T, TValue >::setImmediately ( TValue &&  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

◆ delayed_

template<typename T , typename TValue = T>
TValue Ocean::ScopedValueT< T, TValue >::delayed_
protected

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

◆ target_

template<typename T , typename TValue = T>
T& Ocean::ScopedValueT< T, TValue >::target_
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: