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 / ArrayDeclaration.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
15/**
16 * <b><u>ArrayDeclaration</u></b>
17 */
18public class ArrayDeclaration implements IDeclaration {
19
20 // ------------------------------------------------------------------------
21 // Attributes
22 // ------------------------------------------------------------------------
23
24 private final int length;
25 private final IDeclaration elemType;
26
27 // ------------------------------------------------------------------------
28 // Constructors
29 // ------------------------------------------------------------------------
30
31 public ArrayDeclaration(int length, IDeclaration elemType) {
32 this.length = length;
33 this.elemType = elemType;
34 }
35
36 // ------------------------------------------------------------------------
37 // Getters/Setters/Predicates
38 // ------------------------------------------------------------------------
39
40 public IDeclaration getElementType() {
41 return elemType;
42 }
43
44 public int getLength() {
45 return length;
46 }
47
fd74e6c1
MK
48 @Override
49 public long getAlignment() {
50 long retVal = this.getElementType().getAlignment();
51 return retVal;
52 }
866e5b51
FC
53 // ------------------------------------------------------------------------
54 // Operations
55 // ------------------------------------------------------------------------
56
57 @Override
58 public ArrayDefinition createDefinition(IDefinitionScope definitionScope,
59 String fieldName) {
60 return new ArrayDefinition(this, definitionScope, fieldName);
61 }
62
63 @Override
64 public String toString() {
65 /* Only used for debugging */
66 return "[declaration] array[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
67 }
68
69}
This page took 0.026789 seconds and 5 git commands to generate.