e7a35232d79794f0f87561c9dc6bc1a5b21c0721
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / parsers / custom / CustomEventType.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 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 * Patrick Tassé - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.core.parsers.custom;
14
15 import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
16 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
17 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
18
19 /**
20 * Event type for custom text parsers.
21 *
22 * @author Patrick Tassé
23 */
24 public abstract class CustomEventType extends TmfEventType {
25
26 /**
27 * Constructor
28 *
29 * @param definition
30 * Trace definition
31 */
32 public CustomEventType(CustomTraceDefinition definition) {
33 super(definition.definitionName, getRootField(definition));
34 }
35
36 private static ITmfEventField getRootField(CustomTraceDefinition definition) {
37 ITmfEventField[] fields = new ITmfEventField[definition.outputs.size()];
38 for (int i = 0; i < fields.length; i++) {
39 fields[i] = new TmfEventField(definition.outputs.get(i).name, null, null);
40 }
41 ITmfEventField rootField = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fields);
42 return rootField;
43 }
44
45 }
This page took 0.045127 seconds and 4 git commands to generate.