⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expr.h

📁 由matlab开发的hybrid系统的描述语言
💻 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_EXPR#define D_EXPR#ifndef STD_NS#define STD_NSusing namespace std;#endif#include <string>#include <list>class CNF_clause;class Affine_func;class Symbol;class Number;class Item;class Globals;/** describes an Expression. The structure corresponds to the parse tree * of the expression. Note that also simple constants are expressions. */class Expr {public:	Expr(const Globals * glob) { globals = glob; }	Expr(const Expr * e) { globals = e->globals; }	virtual ~Expr() { }	/** returns a copy of the Item. copying is done deep, i.e. children	 * are cloned recursively */	virtual Expr * clone() const = 0;	/** produce and collect all the Items this Expression wants to unroll */	virtual list < Item * > unroll() = 0;	/** translate the expression into CNF-representation.	 * Raises an error if not is_logic(). */	virtual CNF_clause * compute_CNF() const = 0;	/** checks whether the expression is a logic expression (i.e.	 * whether the expression is either true or false). */	virtual bool is_logic() const = 0;	/** translate the expression into the affine-representation. The	 * variables are real state, input or auxiliary variables.<BR>	 * Raises an error if not is_affine(). */	virtual Affine_func * compute_affine() const {		assert(0);		return 0;	};	/** check if expression can be transformed into an Affine_func. */	virtual bool is_affine() const {		assert(0);		return 0;	}	/** returns true iff value does not contain any symbolic parameters */	virtual bool is_symbolic() const = 0;	/** instanceof Variable_expr */	virtual bool is_variable_expr() const { return false; }	virtual bool is_parameter_expr() const { return false; }	virtual bool is_unary_expr() const { return false; }	virtual bool is_binary_expr() const { return false; }	/** returns true if the expression does not contain any variables. */	virtual bool is_const() const = 0;	/** write the expression in Matlab-readable form. */	virtual string to_matlab() const {		assert(0);		return 0;	}	/** returns true if the expression is a real value (i.e. contains	 * no logic variables\operations). */	virtual bool is_real() const = 0;	/** check whether the Expression is semantically correct, i.e.	 * whether all logic/real operators have logic/real arguments,	 * no OUTPUT var used */	virtual void semantic_checks() = 0;	/** perform argument range checks: For numeric arguments do it	 * immediately, for symbolic arguments produce matlab code */	virtual string arg_range_check_matlab() const = 0;	/** return true, iff the expression can by represented as a	 * Number, i.e. it contains no variables and no symbolic parameters. */	virtual bool is_number() const = 0;	virtual bool is_neg_expr() const {return false;}	/** if is_number, evaluate the expression by executing the	 * operations (evalf in Maple)  */	virtual Number * compute_number() const = 0;	/** does the job of "instanceof Not_expr", needed by DA_item */	virtual bool is_not_expr() const { return false; }	void set_source(string s) { source = s; }	void set_source_line(int i) { source_line = i; }	string get_source() const { return source; }	int get_source_line() const { return source_line; }	const Globals * get_globals() const { return globals; }	virtual void simplify()=0;		/** return simplified input, delete in */	static Expr* simpl(Expr *in);	bool is_one() const;	bool is_zero() const;protected:	virtual Expr * shallow_copy() const = 0;	const Globals * globals;	string source;	int source_line;};#endif //D_EXPR

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -