Minor API improvements
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui.tests / stubs / org / eclipse / linuxtools / internal / lttng / stubs / LTTngEventParserStub.java
CommitLineData
6040f86c
ASL
1/*******************************************************************************
2 * Copyright (c) 2009 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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
2e5e79d5 13package org.eclipse.linuxtools.internal.lttng.stubs;
6040f86c 14
5945cec9 15import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
a1440d1f 16import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
7e6347b0 17import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
6040f86c
ASL
18
19/**
20 * <b><u>TmfEventParserStub</u></b>
21 * <p>
22 * TODO: Implement me. Please.
23 */
72f1e62a 24public class LTTngEventParserStub implements ITmfEventParser<LttngEvent> {
6040f86c 25
72f1e62a
FC
26 /* (non-Javadoc)
27 * @see org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser#parseNextEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfTrace, org.eclipse.linuxtools.tmf.core.trace.TmfContext)
28 */
29 @Override
2352aed9 30 public LttngEvent parseEvent(ITmfContext context) {
72f1e62a
FC
31 // TODO Auto-generated method stub
32 return null;
33 }
6040f86c
ASL
34
35// // ========================================================================
36// // Attributes
37// // ========================================================================
38//
39// private final int NB_FORMATS = 10;
40// private final TmfEventFormat[] fFormats;
41//
42// // ========================================================================
43// // Constructors
44// // ========================================================================
45//
46// public LTTngEventParserStub() {
47// fFormats = new TmfEventFormat[NB_FORMATS];
48// for (int i = 0; i < NB_FORMATS; i++) {
49// Vector<String> format = new Vector<String>();
50// for (int j = 1; j <= i; j++) {
51// format.add(new String("Fmt-" + i + "-Fld-" + j));
52// }
53// String[] fields = new String[i];
54// fFormats[i] = new TmfEventFormat(format.toArray(fields));
55// }
56// }
57//
58// // ========================================================================
59// // Accessors
60// // ========================================================================
61//
62// // ========================================================================
63// // Operators
64// // ========================================================================
65//
66// /* (non-Javadoc)
67// * @see org.eclipse.linuxtools.tmf.eventlog.ITmfEventParser#parseNextEvent()
68// */
69// static final String typePrefix = "Type-";
70// public TmfEvent parseNextEvent(ITmfTrace eventStream, TmfTraceContext context) throws IOException {
71//
72// if (! (eventStream instanceof LTTngTraceStub)) {
73// return null;
74// }
75//
76// // Highly inefficient...
77// RandomAccessFile stream = ((LTTngTraceStub) eventStream).getStream();
78// String name = eventStream.getName();
79// name = name.substring(name.lastIndexOf('/') + 1);
80//
81// synchronized(stream) {
82// long location = 0;
83// if (context != null)
84// location = (Long) (context.getLocation());
85// stream.seek(location);
86//
87// try {
88// // Read the individual fields
89// long ts = stream.readLong();
90// String source = stream.readUTF();
91// String type = stream.readUTF();
92// @SuppressWarnings("unused")
93// int reference = stream.readInt();
94//
95// // Read the event parts
96// int typeIndex = Integer.parseInt(type.substring(typePrefix.length()));
97// String[] fields = new String[typeIndex];
98// for (int i = 0; i < typeIndex; i++) {
99// fields[i] = stream.readUTF();
100// }
101//
102// // Format the content from the individual fields
103// String content = "[";
104// if (typeIndex > 0) {
105// content += fields[0];
106// }
107// for (int i = 1; i < typeIndex; i++) {
108// content += ", " + fields[i];
109// }
110// content += "]";
111//
112// // Update the context
113// context.setLocation(stream.getFilePointer());
114// context.incrIndex();
115// try {
116// long ts2 = stream.readLong();
117// context.setTimestamp(new LTTngTimestampStub(ts2));
118// } catch (EOFException e) {
119// context.setTimestamp(null);
120// }
121//
122// // Create the event
123// TmfEvent event = new TmfEvent(
124// new LTTngTimestampStub(ts),
125// new TmfEventSource(source),
126// new TmfEventType(type, fFormats[typeIndex]),
127// new TmfEventContent(content, fFormats[typeIndex]),
128// new TmfEventReference(name));
129//
130// return event;
131//
132// } catch (EOFException e) {
133// context.setTimestamp(null);
134// }
135// }
136// return null;
137// }
138
139}
This page took 0.032936 seconds and 5 git commands to generate.