Bridge++
Ver. 2.0.2
evalexpr_symbol.h
Go to the documentation of this file.
1
14
#ifndef EVALEXPR_SYMBOL_INCLUDED
15
#define EVALEXPR_SYMBOL_INCLUDED
16
17
#include <map>
18
#include <string>
19
#include "
IO/bridgeIO.h
"
20
21
typedef
double (*
function_t
)(double);
22
23
class
SymbolTable
24
{
25
private
:
26
27
enum
ValueType
{
VARIABLE
,
FUNCTION
, };
28
29
struct
SymbolRecord
30
{
31
ValueType
type
;
32
union
33
{
34
double
val
;
35
function_t
fptr
;
36
}
37
value
;
38
};
39
40
typedef
std::map<std::string, SymbolRecord>
SymbolMap_t
;
41
42
SymbolMap_t
table
;
43
44
public
:
45
46
bool
find_symbol
(
const
std::string& name);
47
48
bool
put_symbol
(
const
std::string& name,
const
double
value);
49
bool
put_symbol
(
const
std::string& name,
const
function_t
tptr);
50
51
double
get_symbol_value
(
const
std::string& name)
const
;
52
function_t
get_symbol_function
(
const
std::string& name)
const
;
53
54
void
print
()
const
;
55
};
56
#endif
bridgeIO.h
SymbolTable::FUNCTION
@ FUNCTION
Definition:
evalexpr_symbol.h:27
SymbolTable::get_symbol_value
double get_symbol_value(const std::string &name) const
Definition:
evalexpr_symbol.cpp:58
SymbolTable::put_symbol
bool put_symbol(const std::string &name, const double value)
Definition:
evalexpr_symbol.cpp:26
SymbolTable::print
void print() const
Definition:
evalexpr_symbol.cpp:86
SymbolTable::SymbolRecord::value
union SymbolTable::SymbolRecord::@1 value
function_t
double(* function_t)(double)
Definition:
evalexpr_symbol.h:21
SymbolTable::SymbolRecord::fptr
function_t fptr
Definition:
evalexpr_symbol.h:35
SymbolTable::table
SymbolMap_t table
Definition:
evalexpr_symbol.h:42
SymbolTable::ValueType
ValueType
Definition:
evalexpr_symbol.h:27
SymbolTable::SymbolRecord::val
double val
Definition:
evalexpr_symbol.h:34
SymbolTable::SymbolRecord::type
ValueType type
Definition:
evalexpr_symbol.h:31
SymbolTable
Definition:
evalexpr_symbol.h:23
SymbolTable::SymbolRecord
Definition:
evalexpr_symbol.h:29
SymbolTable::find_symbol
bool find_symbol(const std::string &name)
Definition:
evalexpr_symbol.cpp:19
SymbolTable::get_symbol_function
function_t get_symbol_function(const std::string &name) const
Definition:
evalexpr_symbol.cpp:72
SymbolTable::VARIABLE
@ VARIABLE
Definition:
evalexpr_symbol.h:27
SymbolTable::SymbolMap_t
std::map< std::string, SymbolRecord > SymbolMap_t
Definition:
evalexpr_symbol.h:40
src
lib
Tools
evalexpr_symbol.h
Generated on Sat Feb 10 2024 14:20:00 for Bridge++ by
1.8.17