00001 /* @HEADER@ */ 00002 // ************************************************************************ 00003 // 00004 // Sundance 00005 // Copyright (2005) Sandia Corporation 00006 // 00007 // Copyright (year first published) Sandia Corporation. Under the terms 00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 00009 // retains certain rights in this software. 00010 // 00011 // This library is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as 00013 // published by the Free Software Foundation; either version 2.1 of the 00014 // License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, but 00017 // WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 // Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public 00022 // License along with this library; if not, write to the Free Software 00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00024 // USA 00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 00026 // Sandia National Laboratories, Livermore, California, USA 00027 // 00028 // ************************************************************************ 00029 /* @HEADER@ */ 00030 00031 #ifndef SUNDANCE_EXPRBASE_H 00032 #define SUNDANCE_EXPRBASE_H 00033 00034 00035 #include "SundanceDefs.hpp" 00036 #include "PlayaExceptions.hpp" 00037 #include "SundanceSet.hpp" 00038 #include "Teuchos_XMLObject.hpp" 00039 #include "Teuchos_RefCountPtrDecl.hpp" 00040 #include "PlayaHandleable.hpp" 00041 00042 00043 00044 namespace Sundance 00045 { 00046 using namespace Sundance; 00047 using namespace Teuchos; 00048 00049 00050 00051 00052 00053 /** */ 00054 class ExprBase : public Playa::Handleable<ExprBase> 00055 { 00056 public: 00057 /** empty ctor */ 00058 ExprBase(); 00059 00060 /** virtual destructor */ 00061 virtual ~ExprBase() {;} 00062 00063 /** Write a simple text description suitable 00064 * for output to a terminal */ 00065 virtual std::ostream& toText(std::ostream& os, bool paren) const = 0 ; 00066 00067 /** Append to the set of func IDs present in this expression. 00068 * Base class does nothing */ 00069 virtual void accumulateFuncSet(Set<int>& funcIDs, 00070 const Set<int>& activeSet) const {;} 00071 00072 /** Indicate whether this expression contains any test 00073 * functions. Default is to return false. This will be 00074 * overridden by TestFuncElement and ExprWithChildren. */ 00075 virtual bool hasTestFunctions() const {return false;} 00076 /** 00077 * Indicate whether the expression contains unknown functions */ 00078 virtual bool hasUnkFunctions() const {return false;} 00079 00080 /** */ 00081 std::string toString() const ; 00082 00083 /** Write in XML */ 00084 virtual XMLObject toXML() const = 0 ; 00085 00086 /** Return a descriptive name for the expression subtype */ 00087 virtual std::string typeName() const ; 00088 00089 protected: 00090 }; 00091 00092 00093 00094 } 00095 00096 #endif