Add floating point support and Loglevel support
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / FloatDeclaration.java
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 *******************************************************************************/
11 package org.eclipse.linuxtools.ctf.core.event.types;
12
13 import java.nio.ByteOrder;
14
15
16 public class FloatDeclaration implements IDeclaration {
17
18 // ------------------------------------------------------------------------
19 // Attributes
20 // ------------------------------------------------------------------------
21
22 private final int mant;
23 private final int exp;
24 private final ByteOrder byteOrder;
25 private final Encoding encoding;
26
27 // ------------------------------------------------------------------------
28 // Constructors
29 // ------------------------------------------------------------------------
30
31 public FloatDeclaration(int exponent, int mantissa, ByteOrder byteOrder,
32 Encoding encoding) {
33 mant = mantissa;
34 exp = exponent;
35 this.byteOrder = byteOrder;
36 this.encoding = encoding;
37
38 }
39
40 // ------------------------------------------------------------------------
41 // Gettters/Setters/Predicates
42 // ------------------------------------------------------------------------
43
44
45
46 /**
47 * @return the mant
48 */
49 public int getMantissa() {
50 return mant;
51 }
52
53 /**
54 * @return the exp
55 */
56 public int getExponent() {
57 return exp;
58 }
59
60 /**
61 * @return the byteOrder
62 */
63 public ByteOrder getByteOrder() {
64 return byteOrder;
65 }
66
67 /**
68 * @return the encoding
69 */
70 public Encoding getEncoding() {
71 return encoding;
72 }
73
74 // ------------------------------------------------------------------------
75 // Operations
76 // ------------------------------------------------------------------------
77
78 @Override
79 public Definition createDefinition(IDefinitionScope definitionScope,
80 String fieldName) {
81 return new FloatDefinition(this, definitionScope, fieldName);
82 }
83
84 @Override
85 public String toString() {
86 /* Only used for debugging */
87 return "[declaration] float[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
88 }
89 }
This page took 0.038795 seconds and 6 git commands to generate.