📄 symbol_table.h
字号:
/* HYSDEL Copyright (C) 1999-2002 Fabio D. Torrisi This file is part of HYSDEL. HYSDEL is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. HYSDEL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA CONTACT INFORMATION =================== Fabio D. Torrisi ETH Zentrum Physikstrasse. 3 ETL, CH-8032 Zurich Switzerland mailto:torrisi@aut.ee.ethz.ch (preferred)*/#ifndef D_SYMBOL_TABLE#define D_SYMBOL_TABLE#include <string>#include <map>#ifndef STD_NS#define STD_NSusing namespace std;#endif#include "OO_consts.h"#include "Default_symbol.h"class Min_max_eps;class Expr;class Globals;class Symbol;class Var_symbol;class Param_symbol;class Item;class Definition_item;class Symbol_table {public: Symbol_table(const Globals * glob); ~Symbol_table(); const Symbol * create_symbol(Symb_kind kind, Symb_type type, string name); /** this function is called when a Symbol has to be created without * it being declared with a name in the hysdel source. This may * happen in the DA_item. The name of the symbol is * automatically created. */ const Symbol * create_additional(Symb_kind kind, Symb_type type); const Symbol * find_symbol(string name) const; void remove(const Default_symbol * sym) { remove(sym->get_name()); } void remove(string name); /** return the number of Symbols with the kind and type specifievard */ int count_symbols(Symb_kind kind, Symb_type type) const; void semantic_checks(); void symb_set_declared(const Symbol * s, int line_no); void symb_set_used(const Symbol * s, int line_no); void symb_set_defined(const Var_symbol * s, const Definition_item * i); void symb_set_value(const Param_symbol * s, Expr * v); void symb_set_minmaxeps(const Symbol * s, Min_max_eps * m); void symb_compute_minmax(const Var_symbol * s, const Item * originator, list < const Symbol * > l); int symb_find_computable_order(const Var_symbol * s, list < const Var_symbol * > l); void find_computable_order(); string to_matlab(string prefix) const; string matlab_simu_header(string fun_name) const; string matlab_simu() const; string init_bounds_vector(string prefix) const; bool matlab_simulateable() const { return all_computable; } string initialize_nonsymb_params_matlab() const; /** returns the matlab structure containing the parameters */ string param_prefix() const; /** produce matlab code to check that all symbolic parameters are * defined in the params structure */ string matlab_symb_param_exist_check() const; /** initialize all symbolic parameters as matlab symbols (using symbolic toolbox) */ string symbs_as_matalb_symbolic() const; /** the returned string is a matlab function checking whether a value is within an interval */ string matlab_within() const; list<const Var_symbol*> get_variables() const;private: /** print number of variables of each kind/type */ string summary(string prefix) const; const Globals * globals; bool all_computable; /** add symbols like pi, MLD_epsilon */ void add_default_symbols(); /** @supplierCardinality 0..* * @associates <{Symbol}> * @directed */ // better: hash_map // careful here: this might mean that the map is built on // some pointer and not on char* ??? map < string, Symbol * > symbols; typedef map < string, Symbol * >::iterator symbols_iter; typedef map < string, Symbol * >::const_iterator const_symbols_iter; /** number of variables created, order (from 0 to 7): * state_c, state_d, input_c, intpu_d, unused, unused, * output_c, output_d */ int var_count[8]; int param_count; /** number of variables created with create_additional */ int additional_count;};#endif //D_SYMBOL_TABLE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -