Commit | Line | Data |
---|---|---|
ff71e543 | 1 | /******************************************************************************* |
df854ddb | 2 | * Copyright (c) 2014, 2015 Ericsson |
ff71e543 MK |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made 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: | |
10 | * Matthew Khouzam - Initial API and implementation | |
df854ddb | 11 | * Patrick Tasse - Rename reference to target |
ff71e543 MK |
12 | *******************************************************************************/ |
13 | ||
7ce90559 | 14 | package org.eclipse.tracecompass.btf.core.event; |
ff71e543 | 15 | |
df854ddb | 16 | import org.eclipse.core.runtime.Platform; |
2bdf0193 AM |
17 | import org.eclipse.tracecompass.tmf.core.event.ITmfEventField; |
18 | import org.eclipse.tracecompass.tmf.core.event.ITmfEventType; | |
19 | import org.eclipse.tracecompass.tmf.core.event.TmfEvent; | |
20 | import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; | |
21 | import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; | |
ff71e543 MK |
22 | |
23 | /** | |
df854ddb PT |
24 | * A Btf event, basically a wrapper for the TmfEvent with the additional fields |
25 | * source, target and description. | |
ff71e543 MK |
26 | * |
27 | * @author Matthew Khouzam | |
28 | */ | |
29 | public class BtfEvent extends TmfEvent { | |
30 | ||
31 | private final String fDescription; | |
e1de2fd4 | 32 | private final String fSource; |
df854ddb | 33 | private final String fTarget; |
ff71e543 MK |
34 | |
35 | /** | |
36 | * Standard constructor. | |
37 | * | |
38 | * @param trace | |
39 | * the parent trace | |
40 | * @param rank | |
41 | * the event rank | |
42 | * @param timestamp | |
43 | * the event timestamp | |
44 | * @param source | |
45 | * the event source | |
46 | * @param type | |
47 | * the event type | |
48 | * @param description | |
49 | * a description of the type | |
50 | * @param content | |
51 | * the event content (payload) | |
df854ddb | 52 | * @param target |
ff71e543 MK |
53 | * the event reference |
54 | */ | |
e1de2fd4 AM |
55 | public BtfEvent(final ITmfTrace trace, |
56 | final long rank, | |
57 | final ITmfTimestamp timestamp, | |
58 | final String source, | |
59 | final ITmfEventType type, | |
60 | final String description, | |
61 | final ITmfEventField content, | |
df854ddb | 62 | final String target) { |
e1de2fd4 | 63 | super(trace, rank, timestamp, type, content); |
ff71e543 | 64 | fDescription = description; |
e1de2fd4 | 65 | fSource = source; |
df854ddb | 66 | fTarget = target; |
ff71e543 MK |
67 | } |
68 | ||
69 | /** | |
70 | * Gets a description | |
71 | * | |
72 | * @return the description | |
73 | */ | |
74 | public String getEventDescription() { | |
75 | return fDescription; | |
76 | } | |
77 | ||
df854ddb PT |
78 | @Override |
79 | public Object getAdapter(Class adapter) { | |
80 | // Force loading the adapters otherwise some plugins might not load | |
81 | return Platform.getAdapterManager().loadAdapter(this, adapter.getName()); | |
82 | } | |
83 | ||
e1de2fd4 AM |
84 | /** |
85 | * Returns the source of this event. | |
86 | * | |
87 | * @return This event's source | |
88 | */ | |
89 | public String getSource() { | |
90 | return fSource; | |
91 | } | |
92 | ||
93 | /** | |
df854ddb | 94 | * Returns the target of this event. |
e1de2fd4 | 95 | * |
df854ddb | 96 | * @return This event's target |
e1de2fd4 | 97 | */ |
df854ddb PT |
98 | public String getTarget() { |
99 | return fTarget; | |
e1de2fd4 | 100 | } |
ff71e543 | 101 | } |