SeExpr

Public Types | Public Member Functions | Private Attributes | List of all members
SeExpr2::ExprType Class Reference

`#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...

## Detailed Description

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.

## Member Enumeration Documentation

## ◆ Lifetime

enum SeExpr2::ExprType::Lifetime

Lifetimes that are possible for type, note the order is from highest to lowest priority for promotion.

Enumerator
ltERROR | Error in lifetime (uniform data depending on varying etc.)
ltVARYING | Varying data (i.e. changes per evaluation point)
ltUNIFORM | Uniform data (i.e. changes only on grids or pixel tiles, depending on how expr used)
ltCONSTANT | Constant data (i.e. sub parts of the tree that need only be computed once)

Definition at line 50 of file ExprType.h.

## ◆ Type

enum SeExpr2::ExprType::Type

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.

## Constructor & Destructor Documentation

## ◆ ExprType() [1/3]

SeExpr2::ExprType::ExprType | ( |  | ) |
| inline

Default constructor for a type (error and lifetime error)

Definition at line 58 of file ExprType.h.

## ◆ ExprType() [2/3]

SeExpr2::ExprType::ExprType | ( | Type | type,
|  | int | n,
|  | Lifetime | lifetime
| ) |  |
| inline

Fully specified type.

Definition at line 61 of file ExprType.h.

References _n, _type, and tFP.

## ◆ ExprType() [3/3]

SeExpr2::ExprType::ExprType | ( | const ExprType & | other | ) |
| inline

Copy constructor.

Definition at line 67 of file ExprType.h.

References _n, _type, and tFP.

## Member Function Documentation

## ◆ Constant()

ExprType& SeExpr2::ExprType::Constant | ( |  | ) |
| 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().

## ◆ dim()

int SeExpr2::ExprType::dim | ( |  | ) | const
| 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().

## ◆ Error()

ExprType& SeExpr2::ExprType::Error | ( |  | ) |
| 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::ExprLocalFunctionNode::prep(), SeExpr2::ExprBlockNode::prep(), SeExpr2::CachedVoronoiFunc::prep(), SeExpr2::CurveFuncX::prep(), SeExpr2::CCurveFuncX::prep(), SeExpr2::GetVar::prep(), and SeExpr2::PrintFuncX::prep().

## ◆ FP()

ExprType& SeExpr2::ExprType::FP | ( | int | d | ) |
| 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().

## ◆ isError()

bool SeExpr2::ExprType::isError | ( |  | ) | const
| inline

Definition at line 168 of file ExprType.h.

References tERROR, and type().

Referenced by isValid(), SeExpr2::ExprVarNode::prep(), toString(), and SeExpr2::ExprLocalVarPhi::valid().

## ◆ isFP() [1/2]

bool SeExpr2::ExprType::isFP | ( |  | ) | const
| inline

Direct is predicate checks.

Definition at line 164 of file ExprType.h.

References _type, and tFP.

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().

## ◆ isFP() [2/2]

bool SeExpr2::ExprType::isFP | ( | int | d | ) | const
| inline

Definition at line 165 of file ExprType.h.

References _n, _type, and tFP.

## ◆ isLifeCompatible()

bool SeExpr2::ExprType::isLifeCompatible | ( | const ExprType & | o | ) | const
| inline

Definition at line 188 of file ExprType.h.

References lifetime().

Referenced by SeExpr2::ExprFuncNode::checkArg().

## ◆ isLifetimeConstant()

bool SeExpr2::ExprType::isLifetimeConstant | ( |  | ) | const
| 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().

## ◆ isLifetimeError()

bool SeExpr2::ExprType::isLifetimeError | ( |  | ) | const
| inline

Definition at line 186 of file ExprType.h.

References lifetime(), and ltERROR.

Referenced by isValid(), and toString().

## ◆ isLifetimeUniform()

bool SeExpr2::ExprType::isLifetimeUniform | ( |  | ) | const
| inline

Definition at line 184 of file ExprType.h.

References lifetime(), and ltUNIFORM.

Referenced by toString().

## ◆ isLifetimeVarying()

bool SeExpr2::ExprType::isLifetimeVarying | ( |  | ) | const
| inline

Definition at line 185 of file ExprType.h.

References lifetime(), and ltVARYING.

Referenced by toString().

## ◆ isNone()

bool SeExpr2::ExprType::isNone | ( |  | ) | const
| inline

Definition at line 170 of file ExprType.h.

References tNONE, and type().

Referenced by toString().

## ◆ isString()

bool SeExpr2::ExprType::isString | ( |  | ) | const
| 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::ExprBinaryOpNode::buildInterpreter(), SeExpr2::ExprLocalFunctionNode::buildInterpreterForCall(), SeExpr2::copyVarToPromotedPosition(), SeExpr2::DExpression::DExpression(), SeExpr2::DExpression::eval(), SeExpr2::ExprCondNode::prep(), and toString().

## ◆ isValid()

bool SeExpr2::ExprType::isValid | ( |  | ) | const
| 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().

## ◆ isValue()

bool SeExpr2::ExprType::isValue | ( |  | ) | const
| inline

Definition at line 166 of file ExprType.h.

References _type, tFP, and tSTRING.

Referenced by SeExpr2::ExprNode::checkIsValue().

## ◆ LifeError()

ExprType& SeExpr2::ExprType::LifeError | ( |  | ) |
| inline

Mutate this into a lifetime error.

Definition at line 127 of file ExprType.h.

References _lifetime, and ltERROR.

## ◆ lifetime()

Lifetime SeExpr2::ExprType::lifetime | ( |  | ) | const
| inline

Definition at line 161 of file ExprType.h.

References _lifetime.

Referenced by isLifeCompatible(), isLifetimeConstant(), isLifetimeError(), isLifetimeUniform(), isLifetimeVarying(), and operator==().

## ◆ None()

ExprType& SeExpr2::ExprType::None | ( |  | ) |
| inline

Mutate this into a none type.

Definition at line 84 of file ExprType.h.

References _n, _type, and tNONE.

## ◆ operator!=()

bool SeExpr2::ExprType::operator!= | ( | const ExprType & | other | ) | const
| inline

Returns true if this and other do not match on type and dimension.

Definition at line 73 of file ExprType.h.

## ◆ operator==()

bool SeExpr2::ExprType::operator== | ( | const ExprType & | other | ) | const
| inline

Returns true if this and other match type and dimension.

Definition at line 76 of file ExprType.h.

References dim(), lifetime(), and type().

## ◆ setLifetime() [1/3]

ExprType& SeExpr2::ExprType::setLifetime | ( | const ExprType & | a | ) |
| inline

Assign the lifetime from type a to be my type.

Definition at line 136 of file ExprType.h.

References _lifetime, and a.

Referenced by SeExpr2::ExprLocalVarPhi::ExprLocalVarPhi(), SeExpr2::ExprFuncStandard::prep(), SeExpr2::ExprCondNode::prep(), setLifetime(), and SeExpr2::ExprNode::setTypeWithChildLife().

## ◆ setLifetime() [2/3]

ExprType& SeExpr2::ExprType::setLifetime | ( | const ExprType & | a,
|  | const ExprType & | b
| ) |  |
| inline

Combine the lifetimes (min wins) of a and b and then assign them to this.

Definition at line 142 of file ExprType.h.

References a, b, and setLifetime().

## ◆ setLifetime() [3/3]

ExprType& SeExpr2::ExprType::setLifetime | ( | const ExprType & | a,
|  | const ExprType & | b,
|  | const ExprType & | c
| ) |  |
| 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 a, b, and setLifetime().

## ◆ String()

ExprType& SeExpr2::ExprType::String | ( |  | ) |
| 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().

## ◆ toString()

std::string SeExpr2::ExprType::toString | ( |  | ) | const
| 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().

## ◆ type()

Type SeExpr2::ExprType::type | ( |  | ) | const
| inline

Definition at line 159 of file ExprType.h.

References _type.

Referenced by isError(), isNone(), isString(), and operator==().

## ◆ Uniform()

ExprType& SeExpr2::ExprType::Uniform | ( |  | ) |
| inline

Mutate this into a uniform lifetime.

Definition at line 117 of file ExprType.h.

References _lifetime, and ltUNIFORM.

## ◆ valuesCompatible()

static bool SeExpr2::ExprType::valuesCompatible | ( | const ExprType & | a,
|  | const ExprType & | b
| ) |  |
| inline static

Checks if value types are compatible.

Definition at line 173 of file ExprType.h.

References a, b, and tFP.

Referenced by SeExpr2::ExprFuncNode::checkArg(), SeExpr2::ExprNode::checkTypesCompatible(), SeExpr2::ExprLocalVarPhi::ExprLocalVarPhi(), SeExpr2::Expression::prep(), and SeExpr2::ExprCondNode::prep().

## ◆ Varying()

ExprType& SeExpr2::ExprType::Varying | ( |  | ) |
| 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::CurveFuncX::prep(), SeExpr2::CCurveFuncX::prep(), SeExpr2::PrintFuncX::prep(), and SeExpr2::TypeVec().

## Member Data Documentation

## ◆ _lifetime

Lifetime SeExpr2::ExprType::_lifetime
| private

lifetime of type

Definition at line 226 of file ExprType.h.

Referenced by Constant(), LifeError(), lifetime(), setLifetime(), Uniform(), and Varying().

## ◆ _n

int SeExpr2::ExprType::_n
| 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(), and String().

## ◆ _type

Type SeExpr2::ExprType::_type
| private

Class of type)

Definition at line 222 of file ExprType.h.

Referenced by Error(), ExprType(), FP(), isFP(), isValue(), None(), String(), and type().

The documentation for this class was generated from the following file:

- /build/seexpr/src/SeExpr/src/SeExpr2/ExprType.h