SeExpr
|
#include <ExprType.h>
Public Types | |
enum | Type { tERROR = 0, tFP, tSTRING, tNONE } |
Possible types. More... | |
enum | Lifetime { ltERROR = 0, ltVARYING, ltUNIFORM, ltCONSTANT } |
Lifetimes that are possible for type, note the order is from highest to lowest priority for promotion. More... | |
Public Member Functions | |
ExprType () | |
Default constructor for a type (error and lifetime error) More... | |
ExprType (Type type, int n, Lifetime lifetime) | |
Fully specified type. More... | |
ExprType (const ExprType &other) | |
Copy constructor. More... | |
bool | operator!= (const ExprType &other) const |
Returns true if this and other do not match on type and dimension. More... | |
bool | operator== (const ExprType &other) const |
Returns true if this and other match type and dimension. More... | |
bool | isLifetimeConstant () const |
validity check: type is not an error More... | |
bool | isLifetimeUniform () const |
bool | isLifetimeVarying () const |
bool | isLifetimeError () const |
bool | isLifeCompatible (const ExprType &o) const |
std::string | toString () const |
Stringify the type into a printable string. More... | |
Basic type mutator constructors | |
ExprType & | None () |
Mutate this into a none type. More... | |
ExprType & | FP (int d) |
Mutate this into a floating point type of dimension d. More... | |
ExprType & | String () |
Mutate this into a string type. More... | |
ExprType & | Error () |
Mutate this into an error type. More... | |
Basic lifetime mutator constructors | |
ExprType & | Constant () |
Mutate this into a constant lifetime. More... | |
ExprType & | Uniform () |
Mutate this into a uniform lifetime. More... | |
ExprType & | Varying () |
Mutate this into a varying lifetime. More... | |
ExprType & | LifeError () |
Mutate this into a lifetime error. More... | |
Lifetime propagation and demotion | |
ExprType & | setLifetime (const ExprType &a) |
Assign the lifetime from type a to be my type. More... | |
ExprType & | setLifetime (const ExprType &a, const ExprType &b) |
Combine the lifetimes (min wins) of a and b and then assign them to this. More... | |
ExprType & | setLifetime (const ExprType &a, const ExprType &b, const ExprType &c) |
Combine the lifetimes (min wins) of a and b and then assign them to this. More... | |
Private Attributes | |
Type | _type |
Class of type) More... | |
int | _n |
Dimension of type _n==1 ignored if _type != FP. More... | |
Lifetime | _lifetime |
lifetime of type More... | |
Accessors and predicates | |
Type | type () const |
int | dim () const |
Lifetime | lifetime () const |
bool | isFP () const |
Direct is predicate checks. More... | |
bool | isFP (int d) const |
bool | isValue () const |
bool | isValid () const |
bool | isError () const |
bool | isString () const |
bool | isNone () const |
static bool | valuesCompatible (const ExprType &a, const ExprType &b) |
Checks if value types are compatible. More... | |
Describes an allowable type in the SeExpr parse tree There are four classes of types in SeExpr: tERROR, tFP, tSTRING, tNONE. These can be further modified by the lifetime modifier ltERROR, ltVARYING, ltUNIFORM, ltCONSTANT Typically a user constructs a type by doing something like this to get a 3-vector Float
ExprType().FP(3).Varying() // make varying ExprType().FP(3).Uniform() // make uniform
Definition at line 39 of file ExprType.h.
Lifetimes that are possible for type, note the order is from highest to lowest priority for promotion.
Definition at line 50 of file ExprType.h.
Possible types.
Enumerator | |
---|---|
tERROR |
Error type (bad things happened here or upstream in tree) |
tFP |
Floating point type (this combines with _d member to make vectors) |
tSTRING |
String type. |
tNONE |
Definition at line 42 of file ExprType.h.
|
inline |
Default constructor for a type (error and lifetime error)
Definition at line 58 of file ExprType.h.
|
inline |
|
inline |
Mutate this into a constant lifetime.
Definition at line 112 of file ExprType.h.
References _lifetime, and ltCONSTANT.
Referenced by BasicExpression::DummyFuncX::prep(), SeExpr2::ExprNumNode::prep(), SeExpr2::ExprStrNode::prep(), SeExpr2::PrintFuncX::prep(), and SeExpr2::ExprNode::setTypeWithChildLife().
|
inline |
Definition at line 160 of file ExprType.h.
References _n.
Referenced by SeExpr2::Expressions::addExternalVariable(), SeExpr2::ExprLocalVar::buildInterpreter(), SeExpr2::ExprFuncSimple::buildInterpreter(), SeExpr2::ExprFuncStandard::buildInterpreter(), SeExpr2::ExprAssignNode::buildInterpreter(), SeExpr2::ExprUnaryOpNode::buildInterpreter(), SeExpr2::ExprSubscriptNode::buildInterpreter(), SeExpr2::ExprBinaryOpNode::buildInterpreter(), SeExpr2::ExprVarNode::buildInterpreter(), SeExpr2::ExprLocalFunctionNode::buildInterpreterForCall(), SeExpr2::ExprFuncNode::checkArg(), SeExpr2::copyVarToPromotedPosition(), SeExpr2::DExpression::DExpression(), SeExpr2::GlobalFP::eval(), SeExpr2::GetVar::evalConstant(), SeExpr2::Expression::evalMultiple(), SeExpr2::GlobalFP::isVec(), operator==(), SeExpr2::ExprNode::prep(), SeExpr2::ExprFuncStandard::prep(), SeExpr2::Expression::prep(), SeExpr2::ExprVecNode::prep(), SeExpr2::VarBlockCreator::registerVariable(), and toString().
|
inline |
Mutate this into an error type.
Definition at line 102 of file ExprType.h.
References _n, _type, and tERROR.
Referenced by SeExpr2::RandFuncX::prep(), BasicExpression::DummyFuncX::prep(), SeExpr2::MapFuncX::prep(), SeExpr2::TriplanarFuncX::prep(), SeExpr2::ExprFuncStandard::prep(), SeExpr2::Expression::prep(), SeExpr2::ExprPrototypeNode::prep(), SeExpr2::ExprLocalFunctionNode::prep(), SeExpr2::ExprBlockNode::prep(), SeExpr2::CachedVoronoiFunc::prep(), SeExpr2::CurveFuncX::prep(), SeExpr2::CCurveFuncX::prep(), SeExpr2::GetVar::prep(), and SeExpr2::PrintFuncX::prep().
|
inline |
Mutate this into a floating point type of dimension d.
Definition at line 90 of file ExprType.h.
References _n, _type, and tFP.
Referenced by main(), SeExpr2::RandFuncX::prep(), BasicExpression::DummyFuncX::prep(), SeExpr2::MapFuncX::prep(), SeExpr2::TriplanarFuncX::prep(), SeExpr2::ExprFuncStandard::prep(), SeExpr2::ExprNumNode::prep(), SeExpr2::CurveFuncX::prep(), SeExpr2::CCurveFuncX::prep(), SeExpr2::PrintFuncX::prep(), and SeExpr2::TypeVec().
|
inline |
Definition at line 168 of file ExprType.h.
References tERROR, and type().
Referenced by isValid(), SeExpr2::ExprVarNode::prep(), toString(), and SeExpr2::ExprLocalVarPhi::valid().
|
inline |
Direct is predicate checks.
Definition at line 164 of file ExprType.h.
Referenced by SeExpr2::Expressions::addExternalVariable(), SeExpr2::ExprLocalVar::buildInterpreter(), SeExpr2::ExprFuncSimple::buildInterpreter(), SeExpr2::ExprFuncStandard::buildInterpreter(), SeExpr2::ExprAssignNode::buildInterpreter(), SeExpr2::ExprVarNode::buildInterpreter(), SeExpr2::ExprLocalFunctionNode::buildInterpreterForCall(), SeExpr2::ExprFuncNode::checkArg(), SeExpr2::ExprNode::checkIsFP(), SeExpr2::copyVarToPromotedPosition(), SeExpr2::DExpression::DExpression(), SeExpr2::DExpression::eval(), SeExpr2::GetVar::evalConstant(), SeExpr2::ExprLocalVarPhi::ExprLocalVarPhi(), SeExpr2::ExprNode::prep(), SeExpr2::Expression::prep(), SeExpr2::ExprLocalFunctionNode::prep(), SeExpr2::ExprCondNode::prep(), SeExpr2::ExprBinaryOpNode::prep(), and toString().
|
inline |
Definition at line 165 of file ExprType.h.
|
inline |
Definition at line 188 of file ExprType.h.
References lifetime().
Referenced by SeExpr2::ExprFuncNode::checkArg().
|
inline |
validity check: type is not an error
Definition at line 183 of file ExprType.h.
References lifetime(), and ltCONSTANT.
Referenced by SeExpr2::Expression::isConstant(), and toString().
|
inline |
Definition at line 186 of file ExprType.h.
References lifetime(), and ltERROR.
Referenced by isValid(), and toString().
|
inline |
Definition at line 184 of file ExprType.h.
References lifetime(), and ltUNIFORM.
Referenced by toString().
|
inline |
Definition at line 185 of file ExprType.h.
References lifetime(), and ltVARYING.
Referenced by toString().
|
inline |
|
inline |
Definition at line 169 of file ExprType.h.
References tSTRING, and type().
Referenced by SeExpr2::Expressions::addExternalVariable(), SeExpr2::ExprLocalVar::buildInterpreter(), SeExpr2::ExprFuncSimple::buildInterpreter(), SeExpr2::ExprAssignNode::buildInterpreter(), SeExpr2::ExprLocalFunctionNode::buildInterpreterForCall(), SeExpr2::copyVarToPromotedPosition(), SeExpr2::DExpression::DExpression(), SeExpr2::DExpression::eval(), SeExpr2::ExprCondNode::prep(), toString(), and valuesCompatible().
|
inline |
Definition at line 167 of file ExprType.h.
References isError(), and isLifetimeError().
Referenced by SeExpr2::ExprNode::prep(), SeExpr2::ExprModuleNode::prep(), SeExpr2::ExprPrototypeNode::prep(), SeExpr2::ExprLocalFunctionNode::prep(), SeExpr2::ExprBlockNode::prep(), SeExpr2::ExprIfThenElseNode::prep(), SeExpr2::ExprAssignNode::prep(), SeExpr2::ExprCompareEqNode::prep(), and SeExpr2::ExprCompareNode::prep().
|
inline |
Definition at line 166 of file ExprType.h.
References _type, tFP, and tSTRING.
Referenced by SeExpr2::ExprNode::checkIsValue().
|
inline |
Mutate this into a lifetime error.
Definition at line 127 of file ExprType.h.
|
inline |
Definition at line 161 of file ExprType.h.
References _lifetime.
Referenced by isLifeCompatible(), isLifetimeConstant(), isLifetimeError(), isLifetimeUniform(), isLifetimeVarying(), operator==(), and setLifetime().
|
inline |
Mutate this into a none type.
Definition at line 84 of file ExprType.h.
References _n, _type, and tNONE.
Referenced by SeExpr2::ExprLocalFunctionNode::prep().
|
inline |
Returns true if this and other do not match on type and dimension.
Definition at line 73 of file ExprType.h.
|
inline |
Returns true if this and other match type and dimension.
Definition at line 76 of file ExprType.h.
References dim(), lifetime(), and type().
Assign the lifetime from type a to be my type.
Definition at line 136 of file ExprType.h.
References _lifetime, and lifetime().
Referenced by SeExpr2::ExprLocalVarPhi::ExprLocalVarPhi(), SeExpr2::ExprFuncStandard::prep(), SeExpr2::ExprCondNode::prep(), setLifetime(), and SeExpr2::ExprNode::setTypeWithChildLife().
Combine the lifetimes (min wins) of a and b and then assign them to this.
Definition at line 142 of file ExprType.h.
References lifetime(), and setLifetime().
|
inline |
Combine the lifetimes (min wins) of a and b and then assign them to this.
Definition at line 148 of file ExprType.h.
References setLifetime().
|
inline |
Mutate this into a string type.
Definition at line 96 of file ExprType.h.
References _n, _type, and tSTRING.
Referenced by SeExpr2::ExprStrNode::prep().
|
inline |
Stringify the type into a printable string.
Definition at line 191 of file ExprType.h.
References dim(), isError(), isFP(), isLifetimeConstant(), isLifetimeError(), isLifetimeUniform(), isLifetimeVarying(), isNone(), and isString().
Referenced by SeExpr2::ExprFuncNode::checkArg(), SeExpr2::ExprNode::checkTypesCompatible(), SeExpr2::Expression::debugPrintParseTree(), SeExpr2::TypePrintExaminer::examine(), main(), SeExpr2::Expression::prep(), SeExpr2::ExprLocalFunctionNode::prep(), and SeExpr2::ExprAssignNode::prep().
|
inline |
Definition at line 159 of file ExprType.h.
References _type.
Referenced by isError(), isNone(), isString(), and operator==().
|
inline |
Mutate this into a uniform lifetime.
Definition at line 117 of file ExprType.h.
|
inlinestatic |
Checks if value types are compatible.
Definition at line 173 of file ExprType.h.
References _n, _type, isString(), and tFP.
Referenced by SeExpr2::ExprFuncNode::checkArg(), SeExpr2::ExprNode::checkTypesCompatible(), SeExpr2::ExprLocalVarPhi::ExprLocalVarPhi(), SeExpr2::Expression::prep(), and SeExpr2::ExprCondNode::prep().
|
inline |
Mutate this into a varying lifetime.
Definition at line 122 of file ExprType.h.
References _lifetime, and ltVARYING.
Referenced by main(), SeExpr2::RandFuncX::prep(), BasicExpression::DummyFuncX::prep(), SeExpr2::MapFuncX::prep(), SeExpr2::TriplanarFuncX::prep(), SeExpr2::ExprLocalFunctionNode::prep(), SeExpr2::CurveFuncX::prep(), SeExpr2::CCurveFuncX::prep(), SeExpr2::PrintFuncX::prep(), and SeExpr2::TypeVec().
|
private |
lifetime of type
Definition at line 226 of file ExprType.h.
Referenced by Constant(), LifeError(), lifetime(), setLifetime(), Uniform(), and Varying().
|
private |
Dimension of type _n==1 ignored if _type != FP.
Definition at line 224 of file ExprType.h.
Referenced by dim(), Error(), ExprType(), FP(), isFP(), None(), String(), and valuesCompatible().
|
private |
Class of type)
Definition at line 222 of file ExprType.h.
Referenced by Error(), ExprType(), FP(), isFP(), isValue(), None(), String(), type(), and valuesCompatible().