Commit | Line | Data |
---|---|---|
5ece050b AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2014 Ericsson | |
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 | * Alexandre Montplaisir - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.trace.text; |
5ece050b | 14 | |
ca5b04ad | 15 | import org.eclipse.jdt.annotation.NonNull; |
2bdf0193 AM |
16 | import org.eclipse.tracecompass.tmf.core.event.ITmfEventType; |
17 | import org.eclipse.tracecompass.tmf.core.event.TmfEvent; | |
18 | import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; | |
0c7471fb | 19 | import org.eclipse.tracecompass.tmf.core.trace.ITmfContext; |
5ece050b AM |
20 | |
21 | /** | |
22 | * Class to store the common functionality of text trace events. | |
23 | * | |
24 | * @author Alexandre Montplaisir | |
5ece050b AM |
25 | */ |
26 | public abstract class TextTraceEvent extends TmfEvent { | |
27 | ||
28 | /** | |
29 | * Full Constructor. | |
30 | * | |
31 | * Compared to {@link TmfEvent}'s constructor, 'content' is restricted to a | |
32 | * {@link TextTraceEventContent}. | |
33 | * | |
34 | * @param parentTrace | |
35 | * The parent trace | |
36 | * @param timestamp | |
37 | * The event timestamp | |
5ece050b AM |
38 | * @param type |
39 | * The event type | |
40 | * @param content | |
41 | * The event content (payload) | |
5ece050b AM |
42 | */ |
43 | public TextTraceEvent(TextTrace<? extends TextTraceEvent> parentTrace, | |
44 | final ITmfTimestamp timestamp, | |
5ece050b | 45 | final ITmfEventType type, |
e1de2fd4 AM |
46 | final TextTraceEventContent content) { |
47 | super(parentTrace, ITmfContext.UNKNOWN_RANK, timestamp, type, content); | |
5ece050b AM |
48 | } |
49 | ||
50 | /** | |
51 | * Copy constructor | |
52 | * | |
53 | * @param other | |
54 | * The event to copy | |
55 | */ | |
ca5b04ad | 56 | public TextTraceEvent(final @NonNull TextTraceEvent other) { |
5ece050b AM |
57 | super(other); |
58 | } | |
59 | ||
60 | @Override | |
61 | public TextTrace<? extends TextTraceEvent> getTrace() { | |
62 | /* Cast should be safe, type is restricted by the constructor */ | |
63 | return (TextTrace<?>) super.getTrace(); | |
64 | } | |
65 | ||
66 | @Override | |
67 | public TextTraceEventContent getContent() { | |
68 | /* Cast should be safe, type is restricted by the constructor */ | |
69 | return (TextTraceEventContent) super.getContent(); | |
70 | } | |
71 | } |