Package org.cakelab.blender.metac
Class CType
- java.lang.Object
-
- org.cakelab.blender.metac.CType
-
- Direct Known Subclasses:
CStruct
public class CType extends java.lang.Object
Stores type information.- Author:
- homac
- See Also:
CMetaModel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CType.CKind
Provides information about the kind of data type.
-
Field Summary
Fields Modifier and Type Field Description protected int
arrayLength
length of array (if type is an array)protected CType.CKind
kind
Kind of that type.protected CType
referencedType
This is the type of component in case of an array or the target type in case of a pointer.protected java.lang.String
signature
full C signature of that type, e.g.int
size32
Size on 32bit architecture.int
size64
Size on 64bit architecture.
-
Constructor Summary
Constructors Constructor Description CType(java.lang.String typesig, CType.CKind kind)
CType(java.lang.String typesig, CType.CKind kind, int size32, int size64)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getArrayLength()
In case of a multidimensional array, this will return the length of the array of the first dimension.CType.CKind
getKind()
CType
getReferencedType()
In case of a pointer, this will return the type of elements, the pointer points to.java.lang.String
getSignature()
int
getTotalNumArrayElems()
int
sizeof(int addressWidth)
Returns the overall size of this type considering specifica such as array lengths.
-
-
-
Field Detail
-
arrayLength
protected int arrayLength
length of array (if type is an array)
-
referencedType
protected CType referencedType
This is the type of component in case of an array or the target type in case of a pointer.
-
kind
protected CType.CKind kind
Kind of that type.
-
signature
protected java.lang.String signature
full C signature of that type, e.g. int**[12]
-
size32
public int size32
Size on 32bit architecture.
-
size64
public int size64
Size on 64bit architecture.
-
-
Constructor Detail
-
CType
public CType(java.lang.String typesig, CType.CKind kind)
-
CType
public CType(java.lang.String typesig, CType.CKind kind, int size32, int size64)
-
-
Method Detail
-
getArrayLength
public int getArrayLength()
In case of a multidimensional array, this will return the length of the array of the first dimension. The length of the array of the next dimension can be determined by getReferencedType().getArrayLength() and so forth.
-
getReferencedType
public CType getReferencedType()
In case of a pointer, this will return the type of elements, the pointer points to. In case of an array, this will return the arrays component type.- Returns:
- referenced type.
-
getKind
public CType.CKind getKind()
-
getSignature
public java.lang.String getSignature()
-
getTotalNumArrayElems
public int getTotalNumArrayElems()
- Returns:
- total number of basic data elements of an array or array of arrays with fixed length.
-
sizeof
public int sizeof(int addressWidth)
Returns the overall size of this type considering specifica such as array lengths.- Parameters:
addressWidth
-
-
-