KSeExpr  4.0.4.0
Public Types | Public Member Functions | Private Attributes | List of all members
KSeExpr::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
 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...
 
ExprTypeoperator= (const ExprType &other)=default
 Assignment operator. More...
 
ExprTypeoperator= (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
ExprTypeNone ()
 Mutate this into a none type. More...
 
ExprTypeFP (int d)
 Mutate this into a floating point type of dimension d. More...
 
ExprTypeString ()
 Mutate this into a string type. More...
 
ExprTypeError ()
 Mutate this into an error type. More...
 
Basic lifetime mutator constructors
ExprTypeConstant ()
 Mutate this into a constant lifetime. More...
 
ExprTypeUniform ()
 Mutate this into a uniform lifetime. More...
 
ExprTypeVarying ()
 Mutate this into a varying lifetime. More...
 
ExprTypeLifeError ()
 Mutate this into a lifetime error. More...
 
Lifetime propagation and demotion
ExprTypesetLifetime (const ExprType &a)
 Assign the lifetime from type a to be my type. More...
 
ExprTypesetLifetime (const ExprType &a, const ExprType &b)
 Combine the lifetimes (min wins) of a and b and then assign them to this. More...
 
ExprTypesetLifetime (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...
 

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 23 of file ExprType.h.

Member Enumeration Documentation

◆ 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 35 of file ExprType.h.

◆ 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 27 of file ExprType.h.

Constructor & Destructor Documentation

◆ ExprType() [1/4]

KSeExpr::ExprType::ExprType ( )
default

Default constructor for a type (error and lifetime error)

◆ ~ExprType()

KSeExpr::ExprType::~ExprType ( )
default

Default destructor.

◆ ExprType() [2/4]

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

Fully specified type.

Definition at line 49 of file ExprType.h.

References _n, _type, and tFP.

◆ ExprType() [3/4]

KSeExpr::ExprType::ExprType ( const ExprType other)
inline

Copy constructor.

Definition at line 59 of file ExprType.h.

References _n, _type, and tFP.

◆ ExprType() [4/4]

KSeExpr::ExprType::ExprType ( ExprType &&  )
default

Default move constructor.

Member Function Documentation

◆ Constant()

ExprType& KSeExpr::ExprType::Constant ( )
inline

◆ dim()

int KSeExpr::ExprType::dim ( ) const
inline

◆ Error()

ExprType& KSeExpr::ExprType::Error ( )
inline

◆ FP()

ExprType& KSeExpr::ExprType::FP ( int  d)
inline

◆ isError()

bool KSeExpr::ExprType::isError ( ) const
inline

Definition at line 206 of file ExprType.h.

References tERROR, and type().

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

◆ isFP() [1/2]

bool KSeExpr::ExprType::isFP ( ) const
inline

◆ isFP() [2/2]

bool KSeExpr::ExprType::isFP ( int  d) const
inline

Definition at line 194 of file ExprType.h.

References _n, _type, and tFP.

◆ isLifeCompatible()

bool KSeExpr::ExprType::isLifeCompatible ( const ExprType o) const
inline

Definition at line 247 of file ExprType.h.

References lifetime().

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

◆ isLifetimeConstant()

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

◆ isLifetimeError()

bool KSeExpr::ExprType::isLifetimeError ( ) const
inline

Definition at line 242 of file ExprType.h.

References lifetime(), and ltERROR.

Referenced by isValid(), and toString().

◆ isLifetimeUniform()

bool KSeExpr::ExprType::isLifetimeUniform ( ) const
inline

Definition at line 234 of file ExprType.h.

References lifetime(), and ltUNIFORM.

Referenced by toString().

◆ isLifetimeVarying()

bool KSeExpr::ExprType::isLifetimeVarying ( ) const
inline

Definition at line 238 of file ExprType.h.

References lifetime(), and ltVARYING.

Referenced by toString().

◆ isNone()

bool KSeExpr::ExprType::isNone ( ) const
inline

Definition at line 214 of file ExprType.h.

References tNONE, and type().

Referenced by toString().

◆ isString()

bool KSeExpr::ExprType::isString ( ) const
inline

◆ isValid()

bool KSeExpr::ExprType::isValid ( ) const
inline

◆ isValue()

bool KSeExpr::ExprType::isValue ( ) const
inline

Definition at line 198 of file ExprType.h.

References _type, tFP, and tSTRING.

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

◆ LifeError()

ExprType& KSeExpr::ExprType::LifeError ( )
inline

Mutate this into a lifetime error.

Definition at line 140 of file ExprType.h.

References _lifetime, and ltERROR.

◆ lifetime()

Lifetime KSeExpr::ExprType::lifetime ( ) const
inline

◆ None()

ExprType& KSeExpr::ExprType::None ( )
inline

Mutate this into a none type.

Definition at line 90 of file ExprType.h.

References _n, _type, and tNONE.

◆ operator!=()

bool KSeExpr::ExprType::operator!= ( const ExprType other) const
inline

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

Definition at line 76 of file ExprType.h.

◆ operator=() [1/2]

ExprType& KSeExpr::ExprType::operator= ( const ExprType other)
default

Assignment operator.

◆ operator=() [2/2]

ExprType& KSeExpr::ExprType::operator= ( ExprType &&  )
default

◆ operator==()

bool KSeExpr::ExprType::operator== ( const ExprType other) const
inline

Returns true if this and other match type and dimension.

Definition at line 82 of file ExprType.h.

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

◆ setLifetime() [1/3]

ExprType& KSeExpr::ExprType::setLifetime ( const ExprType a)
inline

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

◆ setLifetime() [2/3]

ExprType& KSeExpr::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 157 of file ExprType.h.

References lifetime(), and setLifetime().

◆ setLifetime() [3/3]

ExprType& KSeExpr::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 164 of file ExprType.h.

References setLifetime().

◆ String()

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

◆ toString()

std::string KSeExpr::ExprType::toString ( ) const
inline

◆ type()

Type KSeExpr::ExprType::type ( ) const
inline

Definition at line 176 of file ExprType.h.

References _type.

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

◆ Uniform()

ExprType& KSeExpr::ExprType::Uniform ( )
inline

Mutate this into a uniform lifetime.

Definition at line 128 of file ExprType.h.

References _lifetime, and ltUNIFORM.

◆ valuesCompatible()

static bool KSeExpr::ExprType::valuesCompatible ( const ExprType a,
const ExprType b 
)
inlinestatic

◆ Varying()

ExprType& KSeExpr::ExprType::Varying ( )
inline

Member Data Documentation

◆ _lifetime

Lifetime KSeExpr::ExprType::_lifetime {ltERROR}
private

lifetime of type

Definition at line 289 of file ExprType.h.

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

◆ _n

int KSeExpr::ExprType::_n {1}
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().

◆ _type

Type KSeExpr::ExprType::_type {tERROR}
private

Class of type)

Definition at line 285 of file ExprType.h.

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


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