variables.cpp File Reference

#include <map>
#include "variables.hpp"

Go to the source code of this file.

Functions

double get_variable (std::string const &name)
void set_variable (std::string const &name, double value)

Variables

std::map
< std::string,
double > 
variables
initializer init


Function Documentation

double get_variable ( std::string const &  name  ) 

Get the value of a variable.

Parameters:
name The variable name
Returns:
The value of variable name or 0.0 if the variable is undefined.

Definition at line 18 of file variables.cpp.

Referenced by parser::get_primary().

00019 {
00020   return variables[name];
00021 }

void set_variable ( std::string const &  name,
double  value 
)

Set the value of a variable.

Parameters:
name The variable name
value The value. if the variable is already defined, changes its value.

Definition at line 23 of file variables.cpp.

Referenced by parser::get_expr().

00024 {
00025   variables[name] = value;
00026 }


Variable Documentation

initializer init [static]

Definition at line 15 of file variables.cpp.

std::map<std::string, double> variables [static]

Definition at line 6 of file variables.cpp.

Referenced by get_variable(), and set_variable().


Generated on Sun Nov 30 10:04:49 2008 for Calculator by  doxygen 1.5.3