tmf: Do not define base aspects in the interface
[deliverable/tracecompass.git] / gdbtrace / org.eclipse.tracecompass.gdbtrace.core / src / org / eclipse / tracecompass / internal / gdbtrace / core / trace / GdbEventAspects.java
1 /*******************************************************************************
2 * Copyright (c) 2014, 2015 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 * Bernd Hufmann - Add Content aspect
12 *******************************************************************************/
13
14 package org.eclipse.tracecompass.internal.gdbtrace.core.trace;
15
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
18 import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
19 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
20 import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects;
21 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
22 import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
23
24 import com.google.common.collect.ImmutableList;
25
26 /**
27 * Event table column definition for GDB traces.
28 *
29 * @author Alexandre Montplaisir
30 */
31 public final class GdbEventAspects {
32
33 private GdbEventAspects() {}
34
35 private static final @NonNull Iterable<ITmfEventAspect<?>> GDB_ASPECTS =
36 ImmutableList.of(
37 new TmfContentFieldAspect(GdbTraceEventContent.TRACE_FRAME, GdbTraceEventContent.TRACE_FRAME),
38 new TmfContentFieldAspect(GdbTraceEventContent.TRACEPOINT, GdbTraceEventContent.TRACEPOINT),
39 new GdbFileAspect(),
40 TmfBaseAspects.getContentsAspect()
41 );
42
43 private static class GdbFileAspect implements ITmfEventAspect<String> {
44
45 @Override
46 public String getName() {
47 return "File"; //$NON-NLS-1$
48 }
49
50 @Override
51 public String getHelpText() {
52 return EMPTY_STRING;
53 }
54
55 @Override
56 public String resolve(ITmfEvent event) {
57 if (!(event instanceof GdbTraceEvent)) {
58 return EMPTY_STRING;
59 }
60 String ret = ((GdbTraceEvent) event).getReference();
61 return (ret == null ? EMPTY_STRING : ret);
62 }
63 }
64
65 /**
66 * Get the event aspects specific to GDB traces.
67 *
68 * @return The set of aspects
69 */
70 public static @NonNull Iterable<ITmfEventAspect<?>> getAspects() {
71 return GDB_ASPECTS;
72 }
73 }
This page took 0.031605 seconds and 5 git commands to generate.