package org.eclipse.linuxtools.ctf.core.event.types;
/**
- * <b><u>ArrayDeclaration</u></b>
+ * A CTF array declaration
+ *
+ * Arrays are fixed-length. Their length is declared in the type
+ * declaration within the meta-data. They contain an array of "inner type"
+ * elements, which can refer to any type not containing the type of the
+ * array being declared (no circular dependency). The length is the number
+ * of elements in an array.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
*/
public class ArrayDeclaration implements IDeclaration {
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param length how many elements in the array
+ * @param elemType what type of element is in the array
+ */
public ArrayDeclaration(int length, IDeclaration elemType) {
this.length = length;
this.elemType = elemType;
// Getters/Setters/Predicates
// ------------------------------------------------------------------------
+ /**
+ *
+ * @return the type of element in the array
+ */
public IDeclaration getElementType() {
return elemType;
}
+ /**
+ *
+ * @return how many elements in the array
+ */
public int getLength() {
return length;
}
+ @Override
+ public long getAlignment() {
+ long retVal = this.getElementType().getAlignment();
+ return retVal;
+ }
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------