1 /*******************************************************************************
2 * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.ctf
.core
.event
.types
;
14 import java
.nio
.ByteOrder
;
17 * A CTF float declaration.
19 * The declaration of a floating point basic data type.
22 * @author Matthew Khouzam
24 public class FloatDeclaration
implements IDeclaration
{
26 // ------------------------------------------------------------------------
28 // ------------------------------------------------------------------------
30 private final int mant
;
31 private final int exp
;
32 private final ByteOrder byteOrder
;
33 private final long alignment
;
35 // ------------------------------------------------------------------------
37 // ------------------------------------------------------------------------
43 * The exponent size in bits
45 * The mantissa size in bits (+1 for sign) (see CTF spec)
49 * The alignment. Should be ≥ 1
51 public FloatDeclaration(int exponent
, int mantissa
, ByteOrder byteOrder
,
55 this.byteOrder
= byteOrder
;
56 this.alignment
= Math
.max(alignment
, 1);
60 // ------------------------------------------------------------------------
61 // Getters/Setters/Predicates
62 // ------------------------------------------------------------------------
67 public int getMantissa() {
74 public int getExponent() {
79 * @return the byteOrder
81 public ByteOrder
getByteOrder() {
86 public long getAlignment() {
90 // ------------------------------------------------------------------------
92 // ------------------------------------------------------------------------
95 public FloatDefinition
createDefinition(IDefinitionScope definitionScope
,
97 return new FloatDefinition(this, definitionScope
, fieldName
);
101 public String
toString() {
102 /* Only used for debugging */
103 return "[declaration] float[" + Integer
.toHexString(hashCode()) + ']'; //$NON-NLS-1$