00001 00002 /* 00003 | Author: Michael Schmidt; 00004 | Gunnar Jehl 00005 | 00006 | ************************* SOFTWARE LICENSE AGREEMENT *********************** 00007 | This source code is published under the BSD License. 00008 | 00009 | See file 'LICENSE.txt' that comes with this distribution or 00010 | http://dbis.informatik.uni-freiburg.de/index.php?project=GCX/license.php 00011 | for the full license agreement. 00012 | 00013 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00014 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00016 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00017 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00018 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00019 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00020 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00021 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00022 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00023 | POSSIBILITY OF SUCH DAMAGE. 00024 | **************************************************************************** 00025 */ 00026 00035 #ifndef EXPRESSION_H 00036 #define EXPRESSION_H 00037 00038 #include <vector> 00039 #include "environment.h" 00040 #include "typeenums.h" 00041 #include "fsamap.h" 00042 #include "runtimeexception.h" 00043 00052 #define EVAL_QUERY 0 00053 00062 #define EVAL_QUERY_SILENT 1 00063 00075 #define EVAL_SIGNOFF 2 00076 00077 // forward declarations 00078 class PathEnvironment; 00079 class SignOffExpression; 00080 class DependencySet; 00081 class ParVarMap; 00082 class OutputStream; 00083 00092 class Expression { 00093 00094 public: 00099 Expression(EXP_TYPE _type); 00100 00104 virtual ~ Expression(); 00105 00116 virtual void scopeCheck(vector < unsigned >&def_vars, 00117 vector < unsigned >&introduced_vars, 00118 vector < unsigned >&violating_vars); 00119 00128 virtual void replaceVarId(unsigned old_id, unsigned new_id); 00129 00136 virtual void mergeSequences(); 00137 00146 virtual void extractFSAMap(FSAMap * fsamap, unsigned parent_var); 00147 00155 virtual void extractParVarMap(ParVarMap * parvarmap); 00156 00164 virtual void extractDependencies(vector < DependencySet * >*depset); 00165 00173 virtual Expression *placeSignOffs(vector < SignOffExpression * >&signoffs); 00174 00181 virtual void rewriteWhereExps(); 00182 00188 virtual void rewriteEmptyFuncts(); 00189 00195 virtual void rewriteVarstepCondExps(); 00196 00202 virtual void rewriteAggregateFuncts(); 00203 00210 virtual void rewriteVarsteps(); 00211 00218 virtual void print(OutputStream & dos) const = 0; 00219 00227 virtual void init(BufferNode * root); 00228 00242 virtual void eval(OutputStream & eos, Environment * env, unsigned modus); 00243 00249 inline const EXP_TYPE getType() { 00250 return type; 00251 } inline void setType(EXP_TYPE _type) { 00258 type = _type; 00259 } 00260 00269 virtual bool containsDirectOutput(); 00270 00271 protected: 00276 TagMap * tagmap; 00277 00282 EXP_TYPE type; 00283 }; 00284 00285 #endif // EXPRESSION_H