00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: UnknownExpression.hpp,v 1.7 2007/08/02 23:11:55 delpinux Exp $ 00019 00020 #ifndef UNKNOWN_EXPRESSION_HPP 00021 #define UNKNOWN_EXPRESSION_HPP 00022 00023 #include <Expression.hpp> 00024 #include <ScalarDiscretizationTypeBase.hpp> 00025 00026 #include <string> 00027 00028 class UnknownExpression 00029 : public Expression 00030 { 00031 public: 00032 enum Type { 00033 declaration, 00034 existingFunction 00035 }; 00036 00037 private: 00038 virtual void __preExecute() = 0; 00039 00040 std::ostream& put(std::ostream& os) const 00041 { 00042 os << __name << ':' << ScalarDiscretizationTypeBase::name(__discretizationType); 00043 return os; 00044 } 00045 00046 protected: 00047 const Type __type; 00048 00049 const std::string __name; 00050 ScalarDiscretizationTypeBase::Type __discretizationType; 00051 00052 public: 00053 void setDiscretizationType(const ScalarDiscretizationTypeBase::Type& type) 00054 { 00055 __discretizationType = type; 00056 } 00057 00058 const std::string& name() const 00059 { 00060 return __name; 00061 } 00062 00063 const ScalarDiscretizationTypeBase::Type& discretizationType() const 00064 { 00065 return __discretizationType; 00066 } 00067 00068 void execute() 00069 { 00070 this->__preExecute(); 00071 } 00072 00073 UnknownExpression(const Type& type, 00074 const std::string& name, 00075 const ScalarDiscretizationTypeBase::Type& discretization) 00076 : Expression(Expression::unknown), 00077 __type(type), 00078 __name(name), 00079 __discretizationType(discretization) 00080 { 00081 ; 00082 } 00083 00084 virtual ~UnknownExpression() 00085 { 00086 ; 00087 } 00088 }; 00089 00090 #endif // UNKNOWN_EXPRESSION_HPP
1.5.6