|
BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Common header for the lexer and the parser to share Symbol table for numeric variables, strings, arrays and functions. More...
#include <sym_table.h>

Public Types | |
| enum class | symtabtype { NUMBER =0 , STRING =1 , ARRAY =2 , FUNCTION =3 } |
| typedef double(* | function) (double) |
| typedef for function pointer | |
Public Member Functions | |
| Symtab (std::string s) | |
| Constructor with name. | |
| void | Set (Array *) |
| Set to Array value. | |
| void | Set (std::string) |
| Set to string. | |
| void | Set (double, bool reserved=false) |
| Set to double, optional argument to reserve name (only used for units for now) | |
| void | Set (function) |
| Set to function pointer. | |
| std::string | GetName () const |
| Get name. | |
| symtabtype | GetType () const |
| Get type. | |
| bool | IsReserved () const |
| Check if symbol is a reserved name. | |
| std::list< double > | GetArray () const |
| Get methods that check on type. | |
| std::string | GetString () const |
| Set to string. | |
| double | GetNumber () const |
| Set to double. | |
| function | GetFunction () const |
| Set to function pointer. | |
| void | Print () |
| Print method. | |
Private Attributes | |
| std::string | name |
| Name of parser symbol. | |
| bool | is_reserved |
| Flag is parser symbol is a reserved name. | |
| symtabtype | type |
| Enum type. | |
| function | funcptr |
| data | |
| double | value |
| data | |
| std::string | str |
| data | |
| std::list< double > | array |
| data | |
Friends | |
| class | Array |
| Symtabs and arrays are kind of interchangeable. | |
Common header for the lexer and the parser to share Symbol table for numeric variables, strings, arrays and functions.
Definition at line 33 of file sym_table.h.
| typedef double(* GMAD::Symtab::function) (double) |
typedef for function pointer
Definition at line 45 of file sym_table.h.
|
strong |
Definition at line 38 of file sym_table.h.
|
explicit |
Constructor with name.
Definition at line 28 of file sym_table.cc.
| std::list< double > Symtab::GetArray | ( | ) | const |
Get methods that check on type.
Definition at line 100 of file sym_table.cc.
| Symtab::function Symtab::GetFunction | ( | ) | const |
| std::string Symtab::GetName | ( | ) | const |
| double Symtab::GetNumber | ( | ) | const |
| std::string Symtab::GetString | ( | ) | const |
| Symtab::symtabtype Symtab::GetType | ( | ) | const |
| bool Symtab::IsReserved | ( | ) | const |
Check if symbol is a reserved name.
Definition at line 75 of file sym_table.cc.
References is_reserved.
| void Symtab::Print | ( | ) |
| void Symtab::Set | ( | Array * | a | ) |
Set to Array value.
Definition at line 37 of file sym_table.cc.
References array, GMAD::Array::data, and type.
Referenced by GMAD::Parser::add_func().

| void Symtab::Set | ( | double | a, |
| bool | reserved = false |
||
| ) |
Set to double, optional argument to reserve name (only used for units for now)
Definition at line 52 of file sym_table.cc.
References is_reserved, type, and value.
| void Symtab::Set | ( | Symtab::function | a | ) |
| void Symtab::Set | ( | std::string | a | ) |
|
friend |
Symtabs and arrays are kind of interchangeable.
Definition at line 36 of file sym_table.h.
|
private |
data
Definition at line 88 of file sym_table.h.
Referenced by GMAD::Array::Array(), GetArray(), Print(), and Set().
|
private |
|
private |
Flag is parser symbol is a reserved name.
Definition at line 81 of file sym_table.h.
Referenced by IsReserved(), and Set().
|
private |
Name of parser symbol.
Definition at line 79 of file sym_table.h.
|
private |
|
private |
Enum type.
Definition at line 83 of file sym_table.h.
Referenced by GetArray(), GetFunction(), GetNumber(), GetString(), GetType(), Print(), Set(), Set(), Set(), and Set().
|
private |