Fix for bug 381411: Implement ranked location in experiment.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / FloatDeclaration.java
CommitLineData
53047a66
MK
1/*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
3 *
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
8 *
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
fd74e6c1 11
53047a66
MK
12package org.eclipse.linuxtools.ctf.core.event.types;
13
14import java.nio.ByteOrder;
15
9ac2eb62
MK
16/**
17 * Float declaration
18 *
19 * @author Matthew Khouzam
20 *
21 */
53047a66
MK
22public class FloatDeclaration implements IDeclaration {
23
24 // ------------------------------------------------------------------------
25 // Attributes
26 // ------------------------------------------------------------------------
27
28 private final int mant;
29 private final int exp;
30 private final ByteOrder byteOrder;
fd74e6c1 31 private final long alignment;
53047a66
MK
32
33 // ------------------------------------------------------------------------
34 // Constructors
35 // ------------------------------------------------------------------------
36
9ac2eb62
MK
37 /**
38 * Constructor
39 * @param exponent the exponent size in bits
40 * @param mantissa the mantissa size in bits (+1 for sign) (see ctf spec)
41 * @param byteOrder the byte order
42 * @param alignment the alignment
43 */
53047a66 44 public FloatDeclaration(int exponent, int mantissa, ByteOrder byteOrder,
07002e0a 45 long alignment) {
53047a66
MK
46 mant = mantissa;
47 exp = exponent;
48 this.byteOrder = byteOrder;
fd74e6c1 49 this.alignment = alignment;
53047a66
MK
50
51 }
52
53 // ------------------------------------------------------------------------
54 // Gettters/Setters/Predicates
55 // ------------------------------------------------------------------------
56
53047a66
MK
57 /**
58 * @return the mant
59 */
60 public int getMantissa() {
61 return mant;
62 }
63
64 /**
65 * @return the exp
66 */
67 public int getExponent() {
68 return exp;
69 }
70
71 /**
72 * @return the byteOrder
73 */
74 public ByteOrder getByteOrder() {
75 return byteOrder;
76 }
77
81c8e6f7 78 @Override
fd74e6c1
MK
79 public long getAlignment() {
80 return alignment;
81 }
82
53047a66
MK
83 // ------------------------------------------------------------------------
84 // Operations
85 // ------------------------------------------------------------------------
86
87 @Override
81c8e6f7 88 public FloatDefinition createDefinition(IDefinitionScope definitionScope,
53047a66
MK
89 String fieldName) {
90 return new FloatDefinition(this, definitionScope, fieldName);
91 }
92
93 @Override
94 public String toString() {
95 /* Only used for debugging */
96 return "[declaration] float[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
97 }
98}
This page took 0.029383 seconds and 5 git commands to generate.