KSeExpr
4.0.4.0
|
#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 | |
Default constructor for a type (error and lifetime error) More... | |
~ExprType ()=default | |
Default destructor. More... | |
ExprType (Type type, int n, Lifetime lifetime) | |
Fully specified type. More... | |
ExprType (const ExprType &other) | |
Copy constructor. More... | |
ExprType (ExprType &&)=default | |
Default move constructor. More... | |
ExprType & | operator= (const ExprType &other)=default |
Assignment operator. More... | |
ExprType & | operator= (ExprType &&)=default |
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 {tERROR} |
Class of type) More... | |
int | _n {1} |
Dimension of type _n==1 ignored if _type != FP. More... | |
Lifetime | _lifetime {ltERROR} |
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 23 of file ExprType.h.
Lifetimes that are possible for type, note the order is from highest to lowest priority for promotion.
Definition at line 35 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 27 of file ExprType.h.
|
default |
Default constructor for a type (error and lifetime error)
|
default |
Default destructor.
|
inline |
|
default |
Default move constructor.
|
inline |
Mutate this into a constant lifetime.
Definition at line 122 of file ExprType.h.
References _lifetime, and ltCONSTANT.
Referenced by KSeExpr::ExprNumNode::prep(), KSeExpr::ExprStrNode::prep(), KSeExpr::PrintFuncX::prep(), KSeExpr::SPrintFuncX::prep(), BasicExpression::DummyFuncX::prep(), and KSeExpr::ExprNode::setTypeWithChildLife().
|
inline |
Definition at line 180 of file ExprType.h.
References _n.
Referenced by KSeExpr::Expressions::addExternalVariable(), KSeExpr::ExprFuncStandard::buildInterpreter(), KSeExpr::ExprFuncSimple::buildInterpreter(), KSeExpr::ExprLocalVar::buildInterpreter(), KSeExpr::ExprAssignNode::buildInterpreter(), KSeExpr::ExprUnaryOpNode::buildInterpreter(), KSeExpr::ExprSubscriptNode::buildInterpreter(), KSeExpr::ExprBinaryOpNode::buildInterpreter(), KSeExpr::ExprVarNode::buildInterpreter(), KSeExpr::ExprLocalFunctionNode::buildInterpreterForCall(), KSeExpr::ExprFuncNode::checkArg(), KSeExpr::copyVarToPromotedPosition(), KSeExpr::DExpression::DExpression(), KSeExpr::GlobalFP::eval(), KSeExpr::GetVar::evalConstant(), KSeExpr::Expression::evalMultiple(), KSeExpr::GlobalFP::isVec(), operator==(), KSeExpr::Expression::prep(), KSeExpr::ExprNode::prep(), KSeExpr::ExprVecNode::prep(), KSeExpr::ExprFuncStandard::prep(), KSeExpr::VarBlockCreator::registerVariable(), and toString().
|
inline |
Mutate this into an error type.
Definition at line 111 of file ExprType.h.
References _n, _type, and tERROR.
Referenced by KSeExpr::Expression::prep(), KSeExpr::ExprLocalFunctionNode::prep(), KSeExpr::ExprFuncStandard::prep(), KSeExpr::GetVar::prep(), KSeExpr::MapFuncX::prep(), KSeExpr::TriplanarFuncX::prep(), KSeExpr::RandFuncX::prep(), KSeExpr::CachedVoronoiFunc::prep(), KSeExpr::CurveFuncX::prep(), KSeExpr::CCurveFuncX::prep(), KSeExpr::PrintFuncX::prep(), KSeExpr::SPrintFuncX::prep(), and BasicExpression::DummyFuncX::prep().
|
inline |
Mutate this into a floating point type of dimension d.
Definition at line 97 of file ExprType.h.
References _n, _type, and tFP.
Referenced by main(), KSeExpr::ExprNumNode::prep(), KSeExpr::ExprFuncStandard::prep(), KSeExpr::MapFuncX::prep(), KSeExpr::TriplanarFuncX::prep(), KSeExpr::RandFuncX::prep(), KSeExpr::CachedVoronoiFunc::prep(), KSeExpr::CurveFuncX::prep(), KSeExpr::CCurveFuncX::prep(), KSeExpr::PrintFuncX::prep(), BasicExpression::DummyFuncX::prep(), and KSeExpr::TypeVec().
|
inline |
Definition at line 206 of file ExprType.h.
References tERROR, and type().
Referenced by isValid(), KSeExpr::ExprVarNode::prep(), toString(), and KSeExpr::ExprLocalVarPhi::valid().
|
inline |
Direct is predicate checks.
Definition at line 190 of file ExprType.h.
Referenced by KSeExpr::Expressions::addExternalVariable(), KSeExpr::ExprFuncStandard::buildInterpreter(), KSeExpr::ExprFuncSimple::buildInterpreter(), KSeExpr::ExprLocalVar::buildInterpreter(), KSeExpr::ExprAssignNode::buildInterpreter(), KSeExpr::ExprVarNode::buildInterpreter(), KSeExpr::ExprLocalFunctionNode::buildInterpreterForCall(), KSeExpr::ExprFuncNode::checkArg(), KSeExpr::ExprNode::checkIsFP(), KSeExpr::copyVarToPromotedPosition(), KSeExpr::DExpression::DExpression(), KSeExpr::DExpression::eval(), KSeExpr::GetVar::evalConstant(), KSeExpr::ExprLocalVarPhi::ExprLocalVarPhi(), KSeExpr::Expression::prep(), KSeExpr::ExprNode::prep(), KSeExpr::ExprLocalFunctionNode::prep(), KSeExpr::ExprCondNode::prep(), KSeExpr::ExprBinaryOpNode::prep(), and toString().
|
inline |
Definition at line 194 of file ExprType.h.
|
inline |
Definition at line 247 of file ExprType.h.
References lifetime().
Referenced by KSeExpr::ExprFuncNode::checkArg().
|
inline |
validity check: type is not an error
Definition at line 230 of file ExprType.h.
References lifetime(), and ltCONSTANT.
Referenced by KSeExpr::Expression::isConstant(), and toString().
|
inline |
Definition at line 242 of file ExprType.h.
References lifetime(), and ltERROR.
Referenced by isValid(), and toString().
|
inline |
Definition at line 234 of file ExprType.h.
References lifetime(), and ltUNIFORM.
Referenced by toString().
|
inline |
Definition at line 238 of file ExprType.h.
References lifetime(), and ltVARYING.
Referenced by toString().
|
inline |
|
inline |
Definition at line 210 of file ExprType.h.
References tSTRING, and type().
Referenced by KSeExpr::Expressions::addExternalVariable(), KSeExpr::ExprFuncSimple::buildInterpreter(), KSeExpr::ExprLocalVar::buildInterpreter(), KSeExpr::ExprAssignNode::buildInterpreter(), KSeExpr::ExprBinaryOpNode::buildInterpreter(), KSeExpr::ExprLocalFunctionNode::buildInterpreterForCall(), KSeExpr::copyVarToPromotedPosition(), KSeExpr::DExpression::DExpression(), KSeExpr::DExpression::eval(), KSeExpr::ExprCondNode::prep(), toString(), and valuesCompatible().
|
inline |
Definition at line 202 of file ExprType.h.
References isError(), and isLifetimeError().
Referenced by KSeExpr::Expression::prep(), KSeExpr::ExprNode::prep(), KSeExpr::ExprModuleNode::prep(), KSeExpr::ExprPrototypeNode::prep(), KSeExpr::ExprLocalFunctionNode::prep(), KSeExpr::ExprBlockNode::prep(), KSeExpr::ExprIfThenElseNode::prep(), KSeExpr::ExprAssignNode::prep(), KSeExpr::ExprCompareEqNode::prep(), KSeExpr::ExprCompareNode::prep(), and KSeExpr::GetVar::prep().
|
inline |
Definition at line 198 of file ExprType.h.
References _type, tFP, and tSTRING.
Referenced by KSeExpr::ExprNode::checkIsValue().
|
inline |
Mutate this into a lifetime error.
Definition at line 140 of file ExprType.h.
|
inline |
Definition at line 184 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 90 of file ExprType.h.
|
inline |
Returns true if this and other do not match on type and dimension.
Definition at line 76 of file ExprType.h.
|
inline |
Returns true if this and other match type and dimension.
Definition at line 82 of file ExprType.h.
References dim(), lifetime(), and type().
Assign the lifetime from type a to be my type.
Definition at line 150 of file ExprType.h.
References _lifetime, and lifetime().
Referenced by KSeExpr::ExprCondNode::prep(), KSeExpr::ExprFuncStandard::prep(), setLifetime(), and KSeExpr::ExprNode::setTypeWithChildLife().
Combine the lifetimes (min wins) of a and b and then assign them to this.
Definition at line 157 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 164 of file ExprType.h.
References setLifetime().
|
inline |
Mutate this into a string type.
Definition at line 104 of file ExprType.h.
References _n, _type, and tSTRING.
Referenced by KSeExpr::ExprStrNode::prep(), and KSeExpr::SPrintFuncX::prep().
|
inline |
Stringify the type into a printable string.
Definition at line 253 of file ExprType.h.
References dim(), isError(), isFP(), isLifetimeConstant(), isLifetimeError(), isLifetimeUniform(), isLifetimeVarying(), isNone(), and isString().
Referenced by KSeExpr::ExprFuncNode::checkArg(), KSeExpr::ExprNode::checkTypesCompatible(), KSeExpr::Expression::debugPrintParseTree(), KSeExpr::TypePrintExaminer::examine(), main(), KSeExpr::Expression::prep(), and KSeExpr::ExprLocalFunctionNode::prep().
|
inline |
Definition at line 176 of file ExprType.h.
References _type.
Referenced by isError(), isNone(), isString(), and operator==().
|
inline |
Mutate this into a uniform lifetime.
Definition at line 128 of file ExprType.h.
|
inlinestatic |
Checks if value types are compatible.
Definition at line 220 of file ExprType.h.
References _n, _type, isString(), and tFP.
Referenced by KSeExpr::ExprFuncNode::checkArg(), KSeExpr::ExprNode::checkTypesCompatible(), KSeExpr::ExprLocalVarPhi::ExprLocalVarPhi(), KSeExpr::Expression::prep(), and KSeExpr::ExprCondNode::prep().
|
inline |
Mutate this into a varying lifetime.
Definition at line 134 of file ExprType.h.
References _lifetime, and ltVARYING.
Referenced by main(), KSeExpr::MapFuncX::prep(), KSeExpr::TriplanarFuncX::prep(), KSeExpr::RandFuncX::prep(), KSeExpr::CachedVoronoiFunc::prep(), KSeExpr::CurveFuncX::prep(), KSeExpr::CCurveFuncX::prep(), BasicExpression::DummyFuncX::prep(), and KSeExpr::TypeVec().
lifetime of type
Definition at line 289 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 287 of file ExprType.h.
Referenced by dim(), Error(), ExprType(), FP(), isFP(), None(), String(), and valuesCompatible().
Class of type)
Definition at line 285 of file ExprType.h.
Referenced by Error(), ExprType(), FP(), isFP(), isValue(), None(), String(), type(), and valuesCompatible().