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
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
 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

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.

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

SeExpr2::ExprType::ExprType ( )
inline

Default constructor for a type (error and lifetime error)

Definition at line 58 of file ExprType.h.

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.

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

ExprType& SeExpr2::ExprType::Constant ( )
inline
int SeExpr2::ExprType::dim ( ) const
inline
ExprType& SeExpr2::ExprType::Error ( )
inline
ExprType& SeExpr2::ExprType::FP ( int  d)
inline
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().

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

Definition at line 165 of file ExprType.h.

References _n, _type, and tFP.

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

Definition at line 188 of file ExprType.h.

References lifetime().

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

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

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

Definition at line 186 of file ExprType.h.

References lifetime(), and ltERROR.

Referenced by isValid(), and toString().

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

Definition at line 184 of file ExprType.h.

References lifetime(), and ltUNIFORM.

Referenced by toString().

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

Definition at line 185 of file ExprType.h.

References lifetime(), and ltVARYING.

Referenced by toString().

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

Definition at line 170 of file ExprType.h.

References tNONE, and type().

Referenced by toString().

bool SeExpr2::ExprType::isString ( ) const
inline
bool SeExpr2::ExprType::isValid ( ) const
inline
bool SeExpr2::ExprType::isValue ( ) const
inline

Definition at line 166 of file ExprType.h.

References _type, tFP, and tSTRING.

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

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

Mutate this into a lifetime error.

Definition at line 127 of file ExprType.h.

References _lifetime, and ltERROR.

Lifetime SeExpr2::ExprType::lifetime ( ) const
inline
ExprType& SeExpr2::ExprType::None ( )
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().

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.

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

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

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

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

std::string SeExpr2::ExprType::toString ( ) const
inline
Type SeExpr2::ExprType::type ( ) const
inline

Definition at line 159 of file ExprType.h.

References _type.

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

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

Mutate this into a uniform lifetime.

Definition at line 117 of file ExprType.h.

References _lifetime, and ltUNIFORM.

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

Member Data Documentation

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

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(), String(), and valuesCompatible().

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(), type(), and valuesCompatible().


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