Local variable guardian. More...
#include <localvar.h>
Public Member Functions | |
local_var (varType &_variable) | |
The constructor of a local variable guardian. | |
local_var (varType &_variable, const varType &_newValue) | |
The constructor of a local variable guardian which assigns a new value upon initialization. | |
~local_var () | |
The destructor of a local variable guardian. | |
Private Attributes | |
varType & | var |
Reference to the global variable. | |
const varType | value |
The original value of the variable which is going to be restored upon destruction of the guardian object. |
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 54 of file localvar.h.
chomp::homology::local_var< varType >::local_var | ( | varType & | _variable | ) | [inline] |
The constructor of a local variable guardian.
Definition at line 80 of file localvar.h.
chomp::homology::local_var< varType >::local_var | ( | varType & | _variable, | |
const varType & | _newValue | |||
) | [inline] |
The constructor of a local variable guardian which assigns a new value upon initialization.
Definition at line 87 of file localvar.h.
chomp::homology::local_var< varType >::~local_var | ( | ) | [inline] |
The destructor of a local variable guardian.
Definition at line 95 of file localvar.h.
References chomp::homology::local_var< varType >::value, and chomp::homology::local_var< varType >::var.
const varType chomp::homology::local_var< varType >::value [private] |
The original value of the variable which is going to be restored upon destruction of the guardian object.
Definition at line 73 of file localvar.h.
Referenced by chomp::homology::local_var< varType >::~local_var().
varType& chomp::homology::local_var< varType >::var [private] |
Reference to the global variable.
Definition at line 69 of file localvar.h.
Referenced by chomp::homology::local_var< varType >::~local_var().