Class Declaration

Class Documentation

class Declaration

Represents a single forward-declared member in an aggregate type such as a struct.

The Declaration class is used to represent the declaration of, for example, the members in a struct. In the following struct declaration, float x;, float y; and float z; are declarations: struct Position { float x; float y; float z; }

Since structs can contain other structs as members, a Declaration construct could also represent a nested struct.

The struct definition above could be constructed in code as follows (Declaration declX(kFloat, "x"); structDef.AddMember(&declX);

See also

Struct): Struct structDef;

Declaration declY(kFloat, "y"); structDef.AddMember(&declY);

Declaration declZ(kFloat, "z"); structDef.AddMember(&declX);

Public Functions

Declaration()

Default constructor initializes all variables to zero/unknown/none.

Declaration(Declaration const &other)
Declaration(Declaration &&other)
Declaration &operator=(Declaration const &other)
Declaration(introspection::Type type, char const *name)

Scalar constructor will initialize cardinality to 1.

Parameters
  • type -- Element Type

  • name -- Name of element.

Declaration(introspection::Type type, char const *name, char const *typeAlias)
Declaration(introspection::Type type, char const *name, char const *typeAlias, uint64_t vectorSize)
Declaration(introspection::Type type, char const *name, char const *typeAlias, uint64_t vectorSize, uint64_t columnCount, bool columnMajor)
Declaration(introspection::Type type, char const *name, char const *typeAlias, uint64_t vectorSize, uint64_t columnCount, bool columnMajor, uint64_t const *arrayDimensions, uint64_t nDimensions)
Declaration(introspection::Type type, char const *name, char const *typeAlias, uint64_t vectorSize, uint64_t columnCount, bool columnMajor, uint64_t const *arrayDimensions, uint64_t nDimensions, uint64_t offset)
Declaration(introspection::Struct &&structDef, char const *declaredName)

Scalar constructor will initialize cardinality to 1.

Parameters
  • structDef -- A Struct that should be associated with this Declaration.

  • declaredName -- Name of element.

Declaration(introspection::Struct &&structDef, char const *declaredName, char const *typeAlias)
Declaration(introspection::Struct &&structDef, char const *declaredName, char const *typeAlias, uint64_t const *arrayDimensions, uint64_t nArrayDimensions)
Declaration(introspection::Struct &&structDef, char const *declaredName, char const *typeAlias, uint64_t const *arrayDimensions, uint64_t nArrayDimensions, uint64_t offset)
~Declaration()
introspection::Type Type() const

Getters.

char const *Name() const
char const *TypeAlias() const
uint64_t RowCount() const
uint64_t ColumnCount() const
bool ColumnMajor() const
uint64_t ArrayDimensionCount() const
uint64_t ArrayDimension(uint64_t index) const
uint64_t StorageSize() const
bool IsStruct() const
introspection::Struct const *StructDeclaration() const
uint64_t Offset() const

Getter for the hard coded offset of a member in an aggregate.

Returns

Offset value, if defined in shader code. UINT64_MAX otherwise.