Commit | Line | Data |
---|---|---|
866e5b51 | 1 | /******************************************************************************* |
3e2618e9 | 2 | * Copyright (c) 2011, 2013 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 | ||
13 | package org.eclipse.linuxtools.ctf.core.event.types; | |
14 | ||
a4fa4e36 MK |
15 | import org.eclipse.jdt.annotation.NonNull; |
16 | import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer; | |
17 | import org.eclipse.linuxtools.ctf.core.event.scope.IDefinitionScope; | |
18 | import org.eclipse.linuxtools.ctf.core.event.scope.LexicalScope; | |
19 | import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException; | |
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 | */ |
34 | public 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 |
a4fa4e36 MK |
47 | * @throws CTFReaderException |
48 | * error in reading | |
49 | * @since 3.0 | |
9ac2eb62 | 50 | */ |
a4fa4e36 MK |
51 | Definition createDefinition(IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull BitBuffer input) throws CTFReaderException; |
52 | ||
53 | /** | |
54 | * Get the path of a definition | |
55 | * | |
56 | * @param definitionScope | |
57 | * the scope of the definition | |
58 | * @param fieldName | |
59 | * the name of the definition | |
60 | * @return the path of the definition | |
61 | * @since 3.0 | |
62 | */ | |
cc98c947 | 63 | public @NonNull LexicalScope getPath(IDefinitionScope definitionScope, @NonNull String fieldName); |
fd74e6c1 | 64 | |
9ac2eb62 MK |
65 | /** |
66 | * The minimum alignment. if the field is 32 bits, the definition will pad | |
67 | * all the data up to (position%32==0) | |
68 | * | |
69 | * @return the alignment in bits | |
70 | */ | |
3e2618e9 | 71 | long getAlignment(); |
a4fa4e36 MK |
72 | |
73 | /** | |
74 | * The MAXIMUM size of this declaration | |
75 | * | |
76 | * @return the maximum size | |
77 | * @since 3.0 | |
78 | */ | |
79 | int getMaximumSize(); | |
80 | ||
866e5b51 | 81 | } |