Fix bug when tracefile is not aligned. Now supports exotic architectures.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / IntegerDeclaration.java
CommitLineData
866e5b51
FC
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 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.ctf.core.event.types;
14
15import java.nio.ByteOrder;
16
17/**
18 * <b><u>IntegerDeclaration</u></b>
19 */
20public class IntegerDeclaration implements IDeclaration {
21
22 // ------------------------------------------------------------------------
23 // Attributes
24 // ------------------------------------------------------------------------
25
fd74e6c1
MK
26 final private int length;
27 final private boolean signed;
28 final private int base;
29 final private ByteOrder byteOrder;
30 final private Encoding encoding;
31 final private long alignment;
32 final private String clock;
866e5b51
FC
33
34 // ------------------------------------------------------------------------
35 // Constructors
36 // ------------------------------------------------------------------------
37
38 public IntegerDeclaration(int len, boolean signed, int base,
fd74e6c1 39 ByteOrder byteOrder, Encoding encoding, String clock, long alignment) {
866e5b51
FC
40 this.length = len;
41 this.signed = signed;
42 this.base = base;
43 this.byteOrder = byteOrder;
44 this.encoding = encoding;
284fdee8 45 this.clock = clock;
fd74e6c1 46 this.alignment = alignment;
866e5b51
FC
47 }
48
49 // ------------------------------------------------------------------------
50 // Gettters/Setters/Predicates
51 // ------------------------------------------------------------------------
52
53 public boolean isSigned() {
54 return signed;
55 }
56
866e5b51
FC
57 public int getBase() {
58 return base;
59 }
60
866e5b51
FC
61 public ByteOrder getByteOrder() {
62 return byteOrder;
63 }
64
866e5b51
FC
65 public Encoding getEncoding() {
66 return encoding;
67 }
68
fd74e6c1 69 public boolean isCharacter() {
866e5b51
FC
70 return (length == 8) && (encoding != Encoding.NONE);
71 }
72
73 public int getLength() {
74 return length;
75 }
76
fd74e6c1
MK
77 public long getAlignment(){
78 return alignment;
79 }
80
81 public String getClock(){
82 return clock;
83 }
866e5b51
FC
84 // ------------------------------------------------------------------------
85 // Operations
86 // ------------------------------------------------------------------------
87
88 @Override
89 public IntegerDefinition createDefinition(IDefinitionScope definitionScope,
90 String fieldName) {
91 return new IntegerDefinition(this, definitionScope, fieldName);
92 }
93
94 @Override
95 public String toString() {
96 /* Only used for debugging */
97 return "[declaration] integer[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
98 }
99
100}
This page took 0.032599 seconds and 5 git commands to generate.