41package com.jogamp.gluegen.cgram.types;
43import com.jogamp.gluegen.ASTLocusTag;
51 private final Type elementType;
52 private final int length;
55 final int cvAttributes) {
56 this(elementType, sizeInBytes, length, cvAttributes,
null);
59 final int cvAttributes,
final ASTLocusTag astLocus) {
60 super(elementType.
getName() +
" *", sizeInBytes, cvAttributes, astLocus);
61 this.elementType = elementType;
65 super(o, cvAttributes, astLocus);
66 elementType = o.elementType;
72 return new ArrayType(
this, cvAttributes, astLocus);
78 final int hash = elementType.
hashCode();
79 return ((hash << 5) - hash) + length;
85 return elementType.
equals(t.elementType) &&
93 return ((hash << 5) - hash) + length;
107 public String
getName(
final boolean includeCVAttrs) {
108 return elementType.
getName() +
" *";
140 void recomputeSize() {
142 if (arrayElementType !=
null) {
143 arrayElementType.recomputeSize();
153 public String
toString(
final String variableName) {
154 final StringBuilder buf =
new StringBuilder();
156 buf.append(
"const ");
159 if (variableName !=
null) {
161 buf.append(variableName);
166 return buf.toString();
172 elementType.
visit(arg);
Represents an array type.
String toString(final String variableName)
String toString()
Returns a string representation of this type.
final Type getTargetType()
Helper method to returns the target type of this type, in case another type is being referenced,...
String getName(final boolean includeCVAttrs)
Returns the name of this type, optionally including const/volatile attributes.
int hashCodeSemanticsImpl()
ArrayType(final Type elementType, final SizeThunk sizeInBytes, final int length, final int cvAttributes)
final ArrayType asArray()
Casts this to an ArrayType or returns null if not an ArrayType.
final Type getBaseType()
Helper method to returns the bottom-most element type of this type, i.e.
boolean equalsImpl(final Type arg)
final int arrayDimension()
Helper method for determining how many array dimentions this type represents (i.e....
ArrayType(final Type elementType, final SizeThunk sizeInBytes, final int length, final int cvAttributes, final ASTLocusTag astLocus)
void visit(final TypeVisitor arg)
Traverse this Type and all of its component types; for example, the return type and argument types of...
boolean equalSemanticsImpl(final Type arg)
Type getArrayBaseOrPointerTargetType()
Return getBaseType() if isArray() or returns getTargetType() otherwise.
Provides a level of indirection between the definition of a type's size and the absolute value of thi...
static SizeThunk constant(final int constant)
static SizeThunk mul(final SizeThunk thunk1, final SizeThunk thunk2)
final String getCName()
Returns the name of this type.
final int hashCodeSemantics()
Semantic hashcode for Types exclusive its given name.
final int hashCode()
Hashcode for Types.
final boolean isConst()
Indicates whether this type is const.
Type getBaseType()
Helper method to returns the bottom-most element type of this type, i.e.
int arrayDimension()
Helper method for determining how many array dimentions this type represents (i.e....
final boolean equalSemantics(final SemanticEqualityOp arg)
Semantic equality test for Types exclusive its given name.
final String getName()
Returns the name of this type.
void visit(final TypeVisitor visitor)
Traverse this Type and all of its component types; for example, the return type and argument types of...
final boolean equals(final Object arg)
Equality test for Types inclusive its given name.
final SizeThunk getSize()
SizeThunk which computes size of this type in bytes.
final Type newCVVariant(final int cvAttributes)
Return a variant of this type matching the given const/volatile attributes.
ArrayType asArray()
Casts this to an ArrayType or returns null if not an ArrayType.
final boolean isPointer()
Indicates whether this is a PointerType.
A visitor for Type's visitor model.