Commit | Line | Data |
---|---|---|
6de2f761 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2011, 2014 Ericsson |
6de2f761 PT |
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 | * Francois Chouinard - Initial API and implementation | |
11 | * Patrick Tasse - Updated for TMF 2.0 | |
12 | *******************************************************************************/ | |
13 | ||
04c0d7d3 | 14 | package org.eclipse.tracecompass.internal.gdbtrace.core.event; |
6de2f761 | 15 | |
baafe54c | 16 | import org.eclipse.jdt.annotation.NonNull; |
2bdf0193 AM |
17 | import org.eclipse.tracecompass.tmf.core.event.ITmfEventField; |
18 | import org.eclipse.tracecompass.tmf.core.event.TmfEventField; | |
6de2f761 PT |
19 | |
20 | /** | |
21 | * GDB Trace implementation of TmfEventField | |
22 | * @author Francois Chouinard | |
23 | */ | |
24 | public class GdbTraceEventContent extends TmfEventField { | |
25 | ||
26 | /** Trace Frame field name */ | |
baafe54c | 27 | public static final @NonNull String TRACE_FRAME = "Trace Frame"; //$NON-NLS-1$ |
6de2f761 | 28 | /** Tracepoint field name */ |
baafe54c | 29 | public static final @NonNull String TRACEPOINT = "Tracepoint"; //$NON-NLS-1$ |
6de2f761 PT |
30 | |
31 | // Tracepoint number | |
32 | private int fTracepointNumber = 0; | |
33 | // frame number | |
34 | private int fFrameNumber = 0; | |
35 | ||
36 | // ------------------------------------------------------------------------ | |
37 | // Constructors | |
38 | // ------------------------------------------------------------------------ | |
39 | ||
40 | /** | |
41 | * Full constructor | |
42 | * @param content the raw content | |
43 | * @param tracepointNumber the tracepoint number | |
44 | * @param frameNumber the frame number | |
45 | */ | |
46 | public GdbTraceEventContent(String content, int tracepointNumber, int frameNumber) { | |
47 | // TmfEvent parent, Object content | |
48 | super(ITmfEventField.ROOT_FIELD_ID, | |
49 | content.replaceAll("\r?\n", " | "), //$NON-NLS-1$ //$NON-NLS-2$ | |
50 | new ITmfEventField[] { | |
214cc822 AM |
51 | new TmfEventField(TRACE_FRAME, frameNumber, null), |
52 | new TmfEventField(TRACEPOINT, tracepointNumber, null) | |
53 | }); | |
6de2f761 PT |
54 | |
55 | fTracepointNumber = tracepointNumber; | |
56 | fFrameNumber = frameNumber; | |
57 | } | |
58 | ||
59 | /** | |
60 | * @param other the original event content | |
61 | */ | |
62 | public GdbTraceEventContent(GdbTraceEventContent other) { | |
63 | super(other); | |
64 | } | |
65 | ||
66 | // ------------------------------------------------------------------------ | |
67 | // Accessors | |
68 | // ------------------------------------------------------------------------ | |
69 | ||
70 | /** | |
71 | * @return the tracepointNumber | |
72 | */ | |
73 | public int getTracepointNumber() { | |
74 | return fTracepointNumber; | |
75 | } | |
76 | ||
77 | /** | |
78 | * @return the frameNumber | |
79 | */ | |
80 | public int getFrameNumber() { | |
81 | return fFrameNumber; | |
82 | } | |
83 | ||
84 | // ------------------------------------------------------------------------ | |
85 | // Object | |
86 | // ------------------------------------------------------------------------ | |
87 | ||
88 | @Override | |
89 | public String toString() { | |
90 | return getValue().toString(); | |
91 | } | |
92 | } |