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: SceneExpression.hpp,v 1.4 2007/02/08 23:19:38 delpinux Exp $ 00019 00020 #ifndef SCENE_EXPRESSION_HPP 00021 #define SCENE_EXPRESSION_HPP 00022 00023 #include <Expression.hpp> 00024 #include <StringExpression.hpp> 00025 #include <Variable.hpp> 00026 00034 class Scene; 00035 class SceneExpression 00036 : public Expression 00037 { 00038 protected: 00039 ReferenceCounting<Scene> __scene; 00040 00041 public: 00042 enum SceneType { 00043 undefined, 00044 povray, 00045 transform, 00046 variable 00047 }; 00048 00049 private: 00050 SceneExpression::SceneType __sceneType; 00051 00052 public: 00053 ReferenceCounting<Scene> scene() const; 00054 00055 const SceneExpression::SceneType& sceneType() const 00056 { 00057 return __sceneType; 00058 } 00059 00060 SceneExpression(const SceneExpression& e); 00061 00062 SceneExpression(ReferenceCounting<Scene> m, 00063 const SceneExpression::SceneType& t); 00064 00065 virtual ~SceneExpression(); 00066 }; 00067 00075 class SceneExpressionPOVRay 00076 : public SceneExpression 00077 { 00078 private: 00079 ReferenceCounting<StringExpression> __filename; 00080 00081 std::ostream& put(std::ostream& os) const; 00082 00083 public: 00084 void execute(); 00085 00086 SceneExpressionPOVRay(ReferenceCounting<StringExpression> s); 00087 00088 SceneExpressionPOVRay(const SceneExpressionPOVRay& m); 00089 00090 ~SceneExpressionPOVRay(); 00091 }; 00092 00093 class SceneExpressionVariable 00094 : public SceneExpression 00095 { 00096 private: 00097 const std::string __sceneName; 00098 ReferenceCounting<SceneVariable> __sceneVariable; 00099 00100 std::ostream& put(std::ostream& os) const 00101 { 00102 os << __sceneVariable->name() << ": " << (*__sceneVariable->expression()); 00103 return os; 00104 } 00105 00106 public: 00107 void execute(); 00108 00109 SceneExpressionVariable(const std::string& sceneName); 00110 00111 SceneExpressionVariable(const SceneExpressionVariable& e); 00112 00113 ~SceneExpressionVariable(); 00114 }; 00115 00116 class FieldExpression; 00117 class SceneExpressionTransform 00118 : public SceneExpression 00119 { 00120 private: 00121 ReferenceCounting<SceneExpression> __sceneExpression; 00122 ReferenceCounting<FieldExpression> __fieldExpression; 00123 00124 std::ostream& put(std::ostream& os) const; 00125 00126 public: 00127 void execute(); 00128 00129 SceneExpressionTransform(const SceneExpressionTransform& s); 00130 00131 SceneExpressionTransform(ReferenceCounting<SceneExpression> sceneExpression, 00132 ReferenceCounting<FieldExpression> fieldExpression); 00133 00134 ~SceneExpressionTransform(); 00135 }; 00136 00137 class SceneExpressionUndefined 00138 : public SceneExpression 00139 { 00140 private: 00141 std::ostream& put(std::ostream& os) const 00142 { 00143 os << "undefined scene"; 00144 return os; 00145 } 00146 00147 public: 00148 00149 void execute() 00150 { 00151 ; 00152 } 00153 00154 SceneExpressionUndefined(); 00155 00156 SceneExpressionUndefined(const SceneExpressionUndefined& m); 00157 00158 ~SceneExpressionUndefined(); 00159 }; 00160 00161 #endif // SCENE_EXPRESSION_HPP
1.5.6