The Original CHomP Software
|
Local variable guardian. More...
#include <localvar.h>
Public Member Functions | |
local_var (varType &_variable) | |
The constructor of a local variable guardian. More... | |
local_var (varType &_variable, const varType &_newValue) | |
The constructor of a local variable guardian which assigns a new value upon initialization. More... | |
~local_var () | |
The destructor of a local variable guardian. More... | |
Private Attributes | |
varType & | var |
Reference to the global variable. More... | |
const varType | value |
The original value of the variable which is going to be restored upon destruction of the guardian object. More... | |
Local variable guardian.
This template contains the definition of a class whose object remembers the previous value of a variable provided upon initialization, sets the new value, and restores the previous value upon destruction. This corresponds to certain extent to a local variable in Perl.
Definition at line 53 of file localvar.h.
|
inline |
The constructor of a local variable guardian.
Definition at line 79 of file localvar.h.
|
inline |
The constructor of a local variable guardian which assigns a new value upon initialization.
Definition at line 86 of file localvar.h.
|
inline |
The destructor of a local variable guardian.
Definition at line 94 of file localvar.h.
|
private |
The original value of the variable which is going to be restored upon destruction of the guardian object.
Definition at line 72 of file localvar.h.
|
private |
Reference to the global variable.
Definition at line 68 of file localvar.h.