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 VAREXPRESSION_H 00036 #define VAREXPRESSION_H 00037 00038 #include "expression.h" 00039 #include "bufferiterator.h" 00040 #include "operandexpression.h" 00041 00053 class VarExpression:public OperandExpression { 00054 00055 public: 00059 VarExpression(); 00060 00065 VarExpression(const char *_name); 00066 00072 VarExpression(const char *_name, bool _force); 00073 00079 VarExpression(EXP_TYPE _type, unsigned _id); 00080 00084 virtual ~ VarExpression(); 00085 00089 void scopeCheck(vector < unsigned >&def_vars, 00090 vector < unsigned >&introduced_vars, 00091 vector < unsigned >&violating_vars); 00092 00096 void replaceVarId(unsigned old_id, unsigned new_id); 00097 00101 void extractDependencies(vector < DependencySet * >*depset); 00102 00106 void print(OutputStream & dos) const; 00107 00111 void init(BufferNode * root); 00112 00116 void eval(OutputStream & eos, Environment * env, unsigned modus); 00117 00123 inline unsigned getId() { 00124 return id; 00125 } inline void setId(unsigned _id) { 00132 id = _id; 00133 } 00134 00140 VarExpression *clone(); 00141 00145 inline bool isSingleValued() { 00146 return true; 00147 } 00148 00152 void prepareOperand(OutputStream & eos, Environment * env, unsigned modus); 00153 00157 void unprepareOperand(); 00158 00162 virtual Value *getNextValue(); 00163 00164 protected: 00170 unsigned id; 00171 00172 private: 00179 BufferIterator * bit; 00180 }; 00181 00182 #endif // VAREXPRESSION_H