25#define DECLARATION_PTR(CLASS_NAME) \
27 using CLASS_NAME##Ptr = SPtr<CLASS_NAME>
82 struct TypeDenoter : std::enable_shared_from_this<TypeDenoter> {
160 template<
typename T>
T*
as() {
return (
getType() == T::classType ?
static_cast<T*
>(
this) :
nullptr); }
163 template<
typename T>
const T*
as()
const {
return (
getType() == T::classType ?
static_cast<const T*
>(
this) :
nullptr); }
#define DECLARATION_PTR(CLASS_NAME)
Definition TypeDenoter.hpp:25
Basic string that uses framework's memory allocators.
Definition String.hpp:60
SPtr< Expression > ExpressionPtr
Definition Visitor.hpp:26
bool operator!=(const Identifier &lhs, const Identifier &rhs)
Definition Identifier.hpp:64
ImageLayoutFormat
Definition ASTEnums.hpp:642
SPtr< BaseTypeDenoter > BaseTypeDenoterPtr
Definition TypeDenoter.hpp:32
bool operator==(const Identifier &lhs, const Identifier &rhs)
Definition Identifier.hpp:60
SPtr< TypeDenoter > TypeDenoterPtr
Definition TypeDenoter.hpp:29
DataType
Definition ASTEnums.hpp:159
BufferType
Definition ASTEnums.hpp:492
SamplerType
Definition ASTEnums.hpp:571
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
std::int32_t Int32
Definition DataTypes.hpp:21
CiBasicString< char > CiString
Narrow case-insensitive string used for handling narrow encoded text (either locale specific ANSI or ...
Definition String.hpp:252
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition TypeDenoter.hpp:349
String getIdent() const override
TypeDenoterPtr getSubArray(const std::size_t numArrayIndices, const AST *ast=nullptr) override
bool isCastableTo(const TypeDenoter &targetType) const override
AliasTypeDenoter()=default
TypeDenoterPtr copy() const override
TypeDenoterPtr getSubObject(const String &ident, const AST *ast=nullptr) override
AliasTypeDenoter(AliasDeclaration *aliasDeclarationRef)
static const Types classType
Definition TypeDenoter.hpp:350
bool accumulateAlignedVectorSize(UInt32 &size, UInt32 &padding, UInt32 *offset=nullptr) const override
AliasTypeDenoter(const String &ident)
const TypeDenoter & getAliased() const override
TypeDenoterPtr getSub(const Expression *expression=nullptr) override
Returns a sub type denoter for the specified expression.
String toString() const override
String ident
Definition TypeDenoter.hpp:381
AST * symbolRef() const override
UInt32 numDimensions() const override
Types getType() const override
void setIdentIfAnonymous(const String &ident) override
bool equals(const TypeDenoter &rhs, const RawFlags &compareFlags=0) const override
AliasDeclaration * aliasDeclarationRef
Definition TypeDenoter.hpp:383
const TypeDenoterPtr & getAliasedTypeOrThrow(const AST *ast=nullptr) const
Definition TypeDenoter.hpp:387
bool isCastableTo(const TypeDenoter &targetType) const override
ArrayTypeDenoter(const TypeDenoterPtr &subTypeDenoter, const Vector< ArrayDimensionPtr > &arrayDimensions)
TypeDenoterPtr asArray(const Vector< ArrayDimensionPtr > &subArrayDimensions) override
TypeDenoter * fetchSubTypeDenoter() const override
String toString() const override
Types getType() const override
UInt32 numDimensions() const override
ArrayTypeDenoter()=default
Vector< int > getDimensionSizes() const
ArrayTypeDenoter(const TypeDenoterPtr &subTypeDenoter)
bool equalsDimensions(const ArrayTypeDenoter &rhs) const
bool equals(const TypeDenoter &rhs, const RawFlags &compareFlags=0) const override
void insertSubArray(const ArrayTypeDenoter &subArrayTypeDenoter)
bool accumulateAlignedVectorSize(UInt32 &size, UInt32 &padding, UInt32 *offset=nullptr) const override
TypeDenoterPtr copy() const override
TypeDenoterPtr getSubArray(const std::size_t numArrayIndices, const AST *ast=nullptr) override
ArrayTypeDenoter(const TypeDenoterPtr &subTypeDenoter, const Vector< ArrayDimensionPtr > &baseArrayDimensions, const Vector< ArrayDimensionPtr > &subArrayDimensions)
TypeDenoterPtr subTypeDenoter
Definition TypeDenoter.hpp:433
Vector< ArrayDimensionPtr > arrayDimensions
Definition TypeDenoter.hpp:434
static const Types classType
Definition TypeDenoter.hpp:388
Int32 numArrayElements() const
AST * symbolRef() const override
Definition TypeDenoter.hpp:238
DataType dataType
Definition TypeDenoter.hpp:255
bool isCastableTo(const TypeDenoter &targetType) const override
TypeDenoterPtr copy() const override
TypeDenoterPtr getSubObject(const String &ident, const AST *ast=nullptr) override
String toString() const override
VectorSpace vectorSpace
Definition TypeDenoter.hpp:256
static const Types classType
Definition TypeDenoter.hpp:239
BaseTypeDenoter(const DataType dataType)
BaseTypeDenoter()=default
bool accumulateAlignedVectorSize(UInt32 &size, UInt32 &padding, UInt32 *offset=nullptr) const override
TypeDenoterPtr getSubArray(const std::size_t numArrayIndices, const AST *ast=nullptr) override
bool equals(const TypeDenoter &rhs, const RawFlags &compareFlags=0) const override
Types getType() const override
Buffer type denoter with generic sub type and generic size.
Definition TypeDenoter.hpp:265
AST * symbolRef() const override
ImageLayoutFormat layoutFormat
Definition TypeDenoter.hpp:294
BufferDeclaration * bufferDeclarationRef
Definition TypeDenoter.hpp:293
BufferTypeDenoter()=default
TypeDenoterPtr copy() const override
BufferTypeDenoter(const BufferType bufferType)
Types getType() const override
TypeDenoterPtr genericTypeDenoter
Definition TypeDenoter.hpp:290
BufferTypeDenoter(BufferDeclaration *bufferDeclarationRef)
Int32 genericSize
Definition TypeDenoter.hpp:291
BufferType bufferType
Definition TypeDenoter.hpp:289
String toString() const override
TypeDenoterPtr getGenericTypeDenoter() const
bool equals(const TypeDenoter &rhs, const RawFlags &compareFlags=0) const override
TypeDenoterPtr getSubArray(const std::size_t numArrayIndices, const AST *ast=nullptr) override
TypeDenoter * fetchSubTypeDenoter() const override
static const Types classType
Definition TypeDenoter.hpp:266
TypeDenoterPtr getSubObject(const String &ident, const AST *ast=nullptr) override
Definition TypeDenoter.hpp:438
Types getType() const override
Vector< FunctionDeclaration * > funcDeclarationRefs
Definition TypeDenoter.hpp:456
String ident
Definition TypeDenoter.hpp:454
static const Types classType
Definition TypeDenoter.hpp:439
FunctionTypeDenoter()=default
TypeDenoterPtr copy() const override
bool isCastableTo(const TypeDenoter &targetType) const override
String toString() const override
String getIdent() const override
FunctionTypeDenoter(FunctionDeclaration *funcDeclarationRef)
bool equals(const TypeDenoter &rhs, const RawFlags &compareFlags=0) const override
FunctionTypeDenoter(const String &ident, const Vector< FunctionDeclaration * > &funcDeclarationRefs)
Definition TypeDenoter.hpp:227
bool isCastableTo(const TypeDenoter &targetType) const override
String toString() const override
static const Types classType
Definition TypeDenoter.hpp:228
TypeDenoterPtr copy() const override
Types getType() const override
Definition TypeDenoter.hpp:298
SamplerTypeDenoter(SamplerDeclaration *samplerDeclarationRef)
AST * symbolRef() const override
String toString() const override
SamplerTypeDenoter(const SamplerType samplerType)
SamplerTypeDenoter()=default
SamplerType samplerType
Definition TypeDenoter.hpp:313
SamplerDeclaration * samplerDeclarationRef
Definition TypeDenoter.hpp:314
Types getType() const override
bool equals(const TypeDenoter &rhs, const RawFlags &compareFlags=0) const override
TypeDenoterPtr copy() const override
static const Types classType
Definition TypeDenoter.hpp:299
Definition TypeDenoter.hpp:318
void setIdentIfAnonymous(const String &ident) override
StructTypeDenoter(const String &ident)
AST * symbolRef() const override
String ident
Definition TypeDenoter.hpp:343
String toString() const override
bool equals(const TypeDenoter &rhs, const RawFlags &compareFlags=0) const override
String getIdent() const override
static const Types classType
Definition TypeDenoter.hpp:319
StructTypeDenoter()=default
StructDeclaration * getStructDeclarationOrThrow(const AST *ast=nullptr) const
TypeDenoterPtr copy() const override
bool isCastableTo(const TypeDenoter &targetType) const override
TypeDenoterPtr getSubObject(const String &ident, const AST *ast=nullptr) override
StructTypeDenoter(StructDeclaration *structDeclarationRef)
Types getType() const override
bool accumulateAlignedVectorSize(UInt32 &size, UInt32 &padding, UInt32 *offset=nullptr) const override
StructDeclaration * structDeclarationRef
Definition TypeDenoter.hpp:345
Definition TypeDenoter.hpp:82
virtual Types getType() const =0
virtual TypeDenoterPtr asArray(const Vector< ArrayDimensionPtr > &arrayDimensions)
virtual bool accumulateAlignedVectorSize(UInt32 &size, UInt32 &padding, UInt32 *offset=nullptr) const
virtual TypeDenoterPtr copy() const =0
static TypeDenoterPtr findCommonTypeDenoter(const TypeDenoterPtr &lhsTypeDen, const TypeDenoterPtr &rhsTypeDen, bool useMinDimension=false)
virtual AST * symbolRef() const
virtual TypeDenoter * fetchSubTypeDenoter() const
const T * as() const
Definition TypeDenoter.hpp:163
static TypeDenoterPtr findCommonTypeDenoterFrom(const ExpressionPtr &lhsExpression, const ExpressionPtr &rhsExpression, bool useMinDimension=false, const AST *ast=nullptr)
static Int32 findVectorTruncation(const TypeDenoter &sourceTypeDen, const TypeDenoter &destTypeDen, int &sourceVecSize, int &destVecSize)
virtual String toString() const =0
@ IgnoreGenericSubType
Definition TypeDenoter.hpp:99
virtual UInt32 numDimensions() const
virtual bool isCastableTo(const TypeDenoter &targetType) const
static BaseTypeDenoterPtr makeBoolTypeWithDimensionOf(const TypeDenoter &typeDen)
virtual bool equals(const TypeDenoter &rhs, const RawFlags &compareFlags=0) const
virtual TypeDenoterPtr getSubObject(const String &ident, const AST *ast=nullptr)
Types
Definition TypeDenoter.hpp:84
virtual TypeDenoterPtr getSubArray(const std::size_t numArrayIndices, const AST *ast=nullptr)
virtual String getIdent() const
virtual void setIdentIfAnonymous(const String &ident)
virtual TypeDenoterPtr getSub(const Expression *expression=nullptr)
Returns a sub type denoter for the specified expression.
T * as()
Definition TypeDenoter.hpp:160
virtual const TypeDenoter & getAliased() const
Definition TypeDenoter.hpp:43
void set(const StringType &space)
static void copy(TypeDenoter *dstTypeDen, const TypeDenoter *srcTypeDen)
StringType dst
Definition TypeDenoter.hpp:75
VectorSpace(const StringType &space)
static VectorSpace findCommonVectorSpace(const Vector< ExpressionPtr > &expressionList, bool ignoreUnspecified=false, const AST *ast=nullptr)
StringType src
Definition TypeDenoter.hpp:74
void set(const StringType &srcSpace, const StringType &dstSpace)
bool isChangeOfBasis() const
VectorSpace(const StringType &src, const StringType &dst)
bool isAssignableTo(const VectorSpace &rhs) const
Definition TypeDenoter.hpp:215
static const Types classType
Definition TypeDenoter.hpp:216
TypeDenoterPtr copy() const override
String toString() const override
Types getType() const override
bool isCastableTo(const TypeDenoter &targetType) const override