Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
ScopedOverride::Holder< T > Class Template Reference

Type-accurate class that holds the temporary variable with the old value, the pointer to the variable and restores the previous state upon destruction. More...

Inheritance diagram for ScopedOverride::Holder< T >:
ScopedOverride::HolderBase

Public Member Functions

 Holder (T *variable, T new_value)
 

Private Attributes

T * variable_
 Points to the variable that needs resetting.
 
oldValue_
 old value to reset variable_ to when destroyed.
 

Detailed Description

template<class T>
class ScopedOverride::Holder< T >

Type-accurate class that holds the temporary variable with the old value, the pointer to the variable and restores the previous state upon destruction.

Definition at line 366 of file test_main.hxx.

Constructor & Destructor Documentation

◆ Holder()

template<class T >
ScopedOverride::Holder< T >::Holder ( T *  variable,
new_value 
)
inline
Parameters
variablewhat to set temporarily
new_valuewhat should be the new value of variable during this code block.

Definition at line 372 of file test_main.hxx.

◆ ~Holder()

template<class T >
ScopedOverride::Holder< T >::~Holder ( )
inline

Definition at line 379 of file test_main.hxx.

Member Data Documentation

◆ oldValue_

template<class T >
T ScopedOverride::Holder< T >::oldValue_
private

old value to reset variable_ to when destroyed.

Definition at line 388 of file test_main.hxx.

◆ variable_

template<class T >
T* ScopedOverride::Holder< T >::variable_
private

Points to the variable that needs resetting.

Definition at line 386 of file test_main.hxx.


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