1 /*******************************************************************************
2 * Copyright (c) 2011-2014 Ericsson, Ecole Polytechnique de Montreal and others
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
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
12 package org
.eclipse
.tracecompass
.ctf
.core
.event
;
14 import java
.util
.Collections
;
15 import java
.util
.List
;
18 import org
.eclipse
.jdt
.annotation
.NonNull
;
19 import org
.eclipse
.tracecompass
.ctf
.core
.CTFException
;
20 import org
.eclipse
.tracecompass
.ctf
.core
.event
.io
.BitBuffer
;
21 import org
.eclipse
.tracecompass
.ctf
.core
.event
.types
.StructDeclaration
;
22 import org
.eclipse
.tracecompass
.ctf
.core
.trace
.CTFStreamInputReader
;
23 import org
.eclipse
.tracecompass
.ctf
.core
.trace
.ICTFStream
;
24 import org
.eclipse
.tracecompass
.internal
.ctf
.core
.trace
.CTFStream
;
27 * Representation of one type of event. A bit like "int" or "long" but for trace
30 * @author Matthew Khouzam
32 public interface IEventDeclaration
{
35 * Id of events when not set
39 public static final long UNSET_EVENT_ID
= -2L;
42 * Creates an instance of {@link IEventDefinition} corresponding to this
45 * @param streamInputReader
46 * The {@link CTFStreamInputReader} for which this definition is
49 * the {@link BitBuffer} input source
51 * The timestamp when the event was taken
52 * @return A new {@link IEventDefinition}
53 * @throws CTFException
54 * As a bitbuffer is used to read, it could have wrapped
58 IEventDefinition
createDefinition(CTFStreamInputReader streamInputReader
, @NonNull BitBuffer input
, long timestamp
) throws CTFException
;
61 * Gets the name of an event declaration
68 * Gets the fields of an event declaration
70 * @return fields the fields in {@link StructDeclaration} format
72 StructDeclaration
getFields();
75 * Gets the context of an event declaration
77 * @return context the fields in {@link StructDeclaration} format
79 StructDeclaration
getContext();
82 * Gets the id of an event declaration
84 * @return The EventDeclaration ID
89 * Gets the {@link CTFStream} of an event declaration
94 ICTFStream
getStream();
97 * What is the log level of this event?
99 * @return the log level.
104 * Get the {@link Set} of names of the custom CTF attributes.
106 * @return The set of custom attributes
109 Set
<@NonNull String
> getCustomAttributes();
112 * Get the value of a given CTF attribute.
115 * The CTF attribute name
116 * @return the CTF attribute
118 String
getCustomAttribute(String key
);
121 * Gets the potential static call sites of an event
123 * @return the collection of call sites of an event
126 default @NonNull List
<@NonNull CTFCallsite
> getCallsites() {
127 return Collections
.emptyList();