📄 item.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_ITEM#define D_ITEM#ifndef STD_NS#define STD_NSusing namespace std;#endif#include <assert.h>#include <string>#include <list>class MLD_representation;class CNF_clause;class Affine_func;class Var_symbol;class Symbol_table;class Min_max_eps;class Cmd_options;class Expr;class Symbol;class Linear_item;class Globals;class Section;class Symbol;class Row_information;/** Superclass for all Items. For each section of the IMPLEMENTATION, * there is a subclass of Item. Instances of such a subclass correspond to * statements in that section. */class Item {public: Item(const Globals * glob); /** Translate the Item into MLD-matrices. (Note: Only very few * rows will be non-zero.) Each subclass has to * overwrite this function. */ virtual MLD_representation * translate_MLD() const = 0; virtual void semantic_checks() = 0; virtual string arg_range_check_matlab() const = 0; /** human readable representation, for debug only */ virtual string to_string() const; /** return an extra Item if needed */ virtual list < Item * > unroll(); /** set min, max and eps if needed warn if specified bounds are not as * tight as possible */ virtual void compute_minmaxeps() { } /** set group and subgroup */ void comp_group_numbers(); virtual ~Item() { }; virtual bool is_AD_item() const {return false;} virtual bool is_DA_item() const {return false;} /** generate matlab code to simulate this item */ virtual string matlab_simu() const = 0; void set_section(const Section * s) { section = s; } bool section_set() const {return section!=NULL;} virtual string get_ident() const { return string("base"); } virtual bool is_definition_item() const { return false; } void set_source_line(int l) { source_line = l; } void set_source(string s) { source = s; } string get_source() const { return source; } int get_source_line() const { return source_line; } /** return the source line number as a string */ string get_source_line_str() const; void set_unrolled_from(Item * i); int get_group() const { return group; } /** get all variables required to compute the lhs_var or to * check the constraint */ virtual list < const Var_symbol * > get_required_simu() const = 0; bool is_required_simu(const Var_symbol * s) const; static void add_required(list < const Var_symbol * > & required, const Expr * e); static void add_required(list < const Var_symbol * > & required, const Min_max_eps * mme);protected: const Globals * globals; /** The string (as read from the hysdel input file) with the * statement corresponding to this Item. */ string source; // string reconstruced_high_level_statement; // for later // string reconstruced_low_level_statement; // for later // string symbolic_relation; // for later /** The linenumber in the hysdel input file where the * statement can be found. */ int source_line; /** all Items from the same hysdel statement are in one group */ int group; /** sequence number for all item in same group */ int subgroup; const Item * unrolled_from; /** all the Symbols (params or vars) that appear in this Item (not * including the Symbol the Item defines, warn if this happens * outside update/automata) */ // list<const Symbol*> required; /** the section to which this item belongs */ const Section * section; /** builds the inequalities for a logic expression in CNF-form * subind_cnt is updated */ void cnf_to_mld(const CNF_clause * cnf, MLD_representation * mld, int * subind_cnt) const; /** creates aff <= 0 as a new inequality in mld subind_cnt is updated */ void aff_leq_zero_to_mld(const Affine_func * aff, MLD_representation * mld, int * subind_cnt) const; /** sets the coefficients of the affine function in the equality * defining lhs subind_cnt is updated */ void aff_to_mld_eq(const Var_symbol * lhs, const Affine_func * aff, MLD_representation * mld, int * subind_cnt) const; /** compute the minimum and the maximum the affine function can take */ Min_max_eps * compute_mme_from_aff(const Affine_func * aff) const; /** warn if user_min < auto_min or user_max > auto_max */ void check_mme_tight(const Min_max_eps * user_mme, const Min_max_eps * auto_mme) const; /** input: logic output: *upd_var, *upd_var_assign, * const_value uses: sym_tab */ void construct_logic_eq(const Expr * logic, const Symbol * * upd_var, Expr * * upd_var_assign, bool * const_value, Symbol_table * sym_tab) const; /** remove constant part from affine_expr and replace it with an * auxiliary variable which is set by the returned Linear_item * set the result in lin_expr (newly allocated) */ Linear_item * extract_const_from_aff(const Expr * affine_expr, Expr * * lin_expr) const; static bool is_required(list < const Var_symbol * > required, const Var_symbol * s); friend class Row_information;};#endif //D_ITEM
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -