Commit | Line | Data |
---|---|---|
8e964be1 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2011-2014 Ericsson, Ecole Polytechnique de Montreal and others |
8e964be1 MK |
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 | ||
f357bcd4 | 12 | package org.eclipse.tracecompass.ctf.core.event; |
8e964be1 MK |
13 | |
14 | import java.util.Set; | |
15 | ||
a4fa4e36 | 16 | import org.eclipse.jdt.annotation.NonNull; |
680f9173 | 17 | import org.eclipse.tracecompass.ctf.core.CTFException; |
f357bcd4 AM |
18 | import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; |
19 | import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration; | |
f357bcd4 AM |
20 | import org.eclipse.tracecompass.ctf.core.trace.CTFStream; |
21 | import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader; | |
8e964be1 MK |
22 | |
23 | /** | |
24 | * Representation of one type of event. A bit like "int" or "long" but for trace | |
25 | * events. | |
26 | * | |
27 | * @author Matthew Khouzam | |
8e964be1 MK |
28 | */ |
29 | public interface IEventDeclaration { | |
30 | ||
a433ce7d MK |
31 | /** |
32 | * Id of events when not set | |
33 | * | |
34 | * @since 1.0 | |
35 | */ | |
36 | public static final long UNSET_EVENT_ID = -2L; | |
37 | ||
8e964be1 MK |
38 | /** |
39 | * Creates an instance of EventDefinition corresponding to this declaration. | |
40 | * | |
41 | * @param streamInputReader | |
42 | * The StreamInputReader for which this definition is created. | |
a4fa4e36 MK |
43 | * @param input |
44 | * the bitbuffer input source | |
45 | * @param timestamp | |
46 | * The timestamp when the event was taken | |
8e964be1 | 47 | * @return A new EventDefinition. |
680f9173 | 48 | * @throws CTFException |
a4fa4e36 MK |
49 | * As a bitbuffer is used to read, it could have wrapped |
50 | * IOExceptions. | |
8e964be1 | 51 | */ |
680f9173 | 52 | EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException; |
8e964be1 MK |
53 | |
54 | /** | |
55 | * Gets the name of an event declaration | |
56 | * | |
57 | * @return the name | |
58 | */ | |
3e2618e9 | 59 | String getName(); |
8e964be1 MK |
60 | |
61 | /** | |
62 | * Gets the fields of an event declaration | |
63 | * | |
64 | * @return fields the fields in {@link StructDeclaration} format | |
65 | */ | |
3e2618e9 | 66 | StructDeclaration getFields(); |
8e964be1 MK |
67 | |
68 | /** | |
69 | * Gets the context of an event declaration | |
70 | * | |
71 | * @return context the fields in {@link StructDeclaration} format | |
72 | */ | |
3e2618e9 | 73 | StructDeclaration getContext(); |
8e964be1 MK |
74 | |
75 | /** | |
76 | * Gets the id of an event declaration | |
77 | * | |
78 | * @return The EventDeclaration ID | |
79 | */ | |
3e2618e9 | 80 | Long getId(); |
8e964be1 MK |
81 | |
82 | /** | |
d84419e1 | 83 | * Gets the {@link CTFStream} of an event declaration |
8e964be1 MK |
84 | * |
85 | * @return the stream | |
8e964be1 | 86 | */ |
d84419e1 | 87 | CTFStream getStream(); |
8e964be1 MK |
88 | |
89 | /** | |
90 | * What is the log level of this event? | |
91 | * | |
92 | * @return the log level. | |
8e964be1 | 93 | */ |
3e2618e9 | 94 | long getLogLevel(); |
8e964be1 MK |
95 | |
96 | /** | |
97 | * Get the {@link Set} of names of the custom CTF attributes. | |
98 | * | |
99 | * @return The set of custom attributes | |
8e964be1 | 100 | */ |
3e2618e9 | 101 | Set<String> getCustomAttributes(); |
8e964be1 MK |
102 | |
103 | /** | |
104 | * Get the value of a given CTF attribute. | |
105 | * | |
106 | * @param key | |
107 | * The CTF attribute name | |
108 | * @return the CTF attribute | |
8e964be1 | 109 | */ |
3e2618e9 | 110 | String getCustomAttribute(String key); |
8e964be1 MK |
111 | |
112 | } |