releng: Transition to jdt.annotation 2.0
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.ctf.core / src / org / eclipse / tracecompass / ctf / core / event / types / IDeclaration.java
CommitLineData
866e5b51 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal and others
866e5b51
FC
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
f357bcd4 13package org.eclipse.tracecompass.ctf.core.event.types;
866e5b51 14
a4fa4e36 15import org.eclipse.jdt.annotation.NonNull;
680f9173 16import org.eclipse.tracecompass.ctf.core.CTFException;
f357bcd4
AM
17import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
18import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
fbe6fa6f 19import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
a4fa4e36 20
866e5b51 21/**
d37aaa7f 22 * A CTF data type declaration.
3e2618e9 23 *
d37aaa7f
FC
24 * An example: <br>
25 * int i = 0; <br>
26 * <b>int</b> is the declaration.<br>
27 * <b>i</b> is the definition.<br>
28 * <b>0</b> is the value assigned to the definition, not the declaration.<br>
29 *
30 * @version 1.0
31 * @author Matthew Khouzam
32 * @author Simon Marchi
866e5b51
FC
33 */
34public interface IDeclaration {
35
9ac2eb62
MK
36 /**
37 * Create a definition from this declaration
38 *
39 * @param definitionScope
40 * the definition scope, the parent where the definition will be
41 * placed
42 * @param fieldName
43 * the name of the definition
a4fa4e36
MK
44 * @param input
45 * a bitbuffer to read from
9ac2eb62 46 * @return a reference to the definition
680f9173 47 * @throws CTFException
a4fa4e36 48 * error in reading
9ac2eb62 49 */
4c4e2816 50 @NonNull Definition createDefinition(IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull BitBuffer input) throws CTFException;
a4fa4e36
MK
51
52 /**
53 * Get the path of a definition
54 *
55 * @param definitionScope
56 * the scope of the definition
57 * @param fieldName
58 * the name of the definition
59 * @return the path of the definition
fbe6fa6f 60 * @since 1.0
a4fa4e36 61 */
fbe6fa6f 62 @NonNull ILexicalScope getPath(IDefinitionScope definitionScope, @NonNull String fieldName);
fd74e6c1 63
9ac2eb62
MK
64 /**
65 * The minimum alignment. if the field is 32 bits, the definition will pad
66 * all the data up to (position%32==0)
67 *
68 * @return the alignment in bits
69 */
3e2618e9 70 long getAlignment();
a4fa4e36
MK
71
72 /**
5b53901a 73 * The MAXIMUM size of this declaration (in bits).
a4fa4e36
MK
74 *
75 * @return the maximum size
a4fa4e36
MK
76 */
77 int getMaximumSize();
78
e00e6663 79 @Override
66aa25f0 80 int hashCode();
e00e6663
MK
81
82 @Override
66aa25f0
MK
83 boolean equals(Object other);
84
85 /**
f068c622
MK
86 * Are the two declarations equivalent on a binary level. eg: an 8 bit
87 * little endian and big endian int.
66aa25f0
MK
88 *
89 * @param other
90 * the other {@link IDeclaration}
91 * @return true if the binary CTF stream will generate the same value with
92 * the two streams
93 */
94 boolean isBinaryEquivalent(IDeclaration other);
e00e6663 95
866e5b51 96}
This page took 0.070638 seconds and 5 git commands to generate.