Commit | Line | Data |
---|---|---|
a0a88f65 | 1 | /******************************************************************************* |
60ae41e1 | 2 | * Copyright (c) 2010, 2014 Ericsson |
a0a88f65 AM |
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 | * Patrick Tassé - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.parsers.custom; |
be222f56 | 14 | |
aa353506 AM |
15 | import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; |
16 | ||
2bdf0193 AM |
17 | import org.eclipse.tracecompass.tmf.core.event.ITmfEventField; |
18 | import org.eclipse.tracecompass.tmf.core.event.TmfEventField; | |
19 | import org.eclipse.tracecompass.tmf.core.event.TmfEventType; | |
be222f56 | 20 | |
a0a88f65 AM |
21 | /** |
22 | * Event type for custom text parsers. | |
23 | * | |
24 | * @author Patrick Tassé | |
25 | */ | |
be222f56 | 26 | public abstract class CustomEventType extends TmfEventType { |
a0a88f65 | 27 | |
a0a88f65 AM |
28 | /** |
29 | * Constructor | |
30 | * | |
31 | * @param definition | |
32 | * Trace definition | |
33 | */ | |
be222f56 | 34 | public CustomEventType(CustomTraceDefinition definition) { |
aa353506 | 35 | super(checkNotNull(definition.definitionName), getRootField(definition)); |
be222f56 PT |
36 | } |
37 | ||
38 | private static ITmfEventField getRootField(CustomTraceDefinition definition) { | |
39 | ITmfEventField[] fields = new ITmfEventField[definition.outputs.size()]; | |
40 | for (int i = 0; i < fields.length; i++) { | |
214cc822 | 41 | fields[i] = new TmfEventField(definition.outputs.get(i).name, null, null); |
be222f56 | 42 | } |
214cc822 | 43 | ITmfEventField rootField = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fields); |
be222f56 PT |
44 | return rootField; |
45 | } | |
46 | ||
47 | } |