Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ShVariable.hpp

00001 // Sh: A GPU metaprogramming language. 00002 // 00003 // Copyright (c) 2003 University of Waterloo Computer Graphics Laboratory 00004 // Project administrator: Michael D. McCool 00005 // Authors: Zheng Qin, Stefanus Du Toit, Kevin Moule, Tiberiu S. Popa, 00006 // Michael D. McCool 00007 // 00008 // This software is provided 'as-is', without any express or implied 00009 // warranty. In no event will the authors be held liable for any damages 00010 // arising from the use of this software. 00011 // 00012 // Permission is granted to anyone to use this software for any purpose, 00013 // including commercial applications, and to alter it and redistribute it 00014 // freely, subject to the following restrictions: 00015 // 00016 // 1. The origin of this software must not be misrepresented; you must 00017 // not claim that you wrote the original software. If you use this 00018 // software in a product, an acknowledgment in the product documentation 00019 // would be appreciated but is not required. 00020 // 00021 // 2. Altered source versions must be plainly marked as such, and must 00022 // not be misrepresented as being the original software. 00023 // 00024 // 3. This notice may not be removed or altered from any source 00025 // distribution. 00027 #ifndef SHVARIABLE_HPP 00028 #define SHVARIABLE_HPP 00029 00030 #include "ShDllExport.hpp" 00031 #include "ShRefCount.hpp" 00032 #include "ShVariableNode.hpp" 00033 #include "ShSwizzle.hpp" 00034 #include "ShUtility.hpp" 00035 #include "ShMetaForwarder.hpp" 00036 00037 namespace SH { 00038 00039 class ShProgram; 00040 00047 class 00048 SH_DLLEXPORT ShVariable : public ShMetaForwarder { 00049 public: 00050 ShVariable(); 00051 ShVariable(const ShVariableNodePtr& node); 00052 ShVariable(const ShVariableNodePtr& node, const ShSwizzle& swizzle, bool neg); 00053 00054 ~ShVariable() {} 00055 00056 ShVariable& operator=(const ShProgram& prg); 00057 00058 bool null() const; 00059 00060 bool uniform() const; 00061 bool hasValues() const; 00062 00063 00064 int size() const; 00065 00066 00072 00073 00075 void range(ShVariableNode::ValueType low, ShVariableNode::ValueType high); 00077 ShVariableNode::ValueType lowBound() const; 00079 ShVariableNode::ValueType highBound() const; 00080 00082 00084 const ShSwizzle& swizzle() const; 00085 00087 const ShVariableNodePtr& node() const; 00088 00090 bool neg() const; 00091 00092 bool& neg(); 00093 00095 void getValues(ShVariableNode::ValueType dest[]) const; 00096 ShVariableNode::ValueType getValue(int index) const; 00097 00100 void setValues(ShVariableNode::ValueType values[]); 00101 void setValue(int index, ShVariableNode::ValueType value); 00102 00103 ShVariable operator()() const; 00104 ShVariable operator()(int) const; 00105 ShVariable operator()(int, int) const; 00106 ShVariable operator()(int, int, int) const; 00107 ShVariable operator()(int, int, int, int) const; 00108 ShVariable operator()(int size, int indices[]) const; 00109 00110 ShVariable operator-() const; 00111 00112 bool operator==(const ShVariable& other) const; 00113 bool operator!=(const ShVariable& other) const { return !((*this) == other); } 00114 00118 void clone(const ShVariable& other); 00119 00120 protected: 00121 00122 ShVariableNodePtr m_node; 00123 ShSwizzle m_swizzle; 00124 bool m_neg; 00125 00126 friend SH_DLLEXPORT std::ostream& operator<<(std::ostream& out, const ShVariable& shVariableToPrint); 00127 }; 00128 00129 } 00130 00131 #endif

Generated on Mon Oct 18 14:17:40 2004 for Sh by doxygen 1.3.7