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