00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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