/*******************************************************************************
- * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
+ * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
import java.nio.ByteOrder;
-
+/**
+ * A CTF float declaration.
+ *
+ * The declaration of a floating point basic data type.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ */
public class FloatDeclaration implements IDeclaration {
// ------------------------------------------------------------------------
private final int mant;
private final int exp;
private final ByteOrder byteOrder;
- private final Encoding encoding;
private final long alignment;
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ *
+ * @param exponent
+ * The exponent size in bits
+ * @param mantissa
+ * The mantissa size in bits (+1 for sign) (see CTF spec)
+ * @param byteOrder
+ * The byte order
+ * @param alignment
+ * The alignment. Should be ≥ 1
+ */
public FloatDeclaration(int exponent, int mantissa, ByteOrder byteOrder,
- Encoding encoding, long alignment) {
+ long alignment) {
mant = mantissa;
exp = exponent;
this.byteOrder = byteOrder;
- this.encoding = encoding;
- this.alignment = alignment;
+ this.alignment = Math.max(alignment, 1);
}
// ------------------------------------------------------------------------
- // Gettters/Setters/Predicates
+ // Getters/Setters/Predicates
// ------------------------------------------------------------------------
/**
return byteOrder;
}
- /**
- * @return the encoding
- */
- public Encoding getEncoding() {
- return encoding;
- }
-
+ @Override
public long getAlignment() {
return alignment;
}
// ------------------------------------------------------------------------
@Override
- public Definition createDefinition(IDefinitionScope definitionScope,
+ public FloatDefinition createDefinition(IDefinitionScope definitionScope,
String fieldName) {
return new FloatDefinition(this, definitionScope, fieldName);
}