Public Member Functions | Private Attributes | List of all members
cSetValueTemporarily< T > Class Template Reference

helper class to set value on construction and reset to previous value on destruction. (RAII-idiom) More...

#include <util.h>

Public Member Functions

 cSetValueTemporarily (T *_value_ptr, T new_value)
 CTOR: remember current value of _value_ptr and set it to new_value. More...
 
 ~cSetValueTemporarily ()
 DTOR: restore the remembered value. More...
 

Private Attributes

old_value
 
T * value_ptr
 

Detailed Description

template<typename T>
class cSetValueTemporarily< T >

helper class to set value on construction and reset to previous value on destruction. (RAII-idiom)

Definition at line 334 of file util.h.

Constructor & Destructor Documentation

◆ cSetValueTemporarily()

template<typename T >
cSetValueTemporarily< T >::cSetValueTemporarily ( T *  _value_ptr,
new_value 
)
inline

CTOR: remember current value of _value_ptr and set it to new_value.

Definition at line 340 of file util.h.

◆ ~cSetValueTemporarily()

template<typename T >
cSetValueTemporarily< T >::~cSetValueTemporarily ( )
inline

DTOR: restore the remembered value.

Definition at line 348 of file util.h.

Member Data Documentation

◆ old_value

template<typename T >
T cSetValueTemporarily< T >::old_value
private

Definition at line 337 of file util.h.

◆ value_ptr

template<typename T >
T* cSetValueTemporarily< T >::value_ptr
private

Definition at line 336 of file util.h.


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


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:59