Integrate the TmfEvent+ITmfTimestamp API
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / trace / ITmfTrace.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2011 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
13 package org.eclipse.linuxtools.tmf.core.trace;
14
15 import java.io.FileNotFoundException;
16
17 import org.eclipse.core.resources.IProject;
18 import org.eclipse.linuxtools.tmf.core.component.ITmfComponent;
19 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
20 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
21 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
22
23 /**
24 * <b><u>ITmfTrace</u></b>
25 * <p>
26 */
27 public interface ITmfTrace<T extends TmfEvent> extends ITmfComponent {
28
29 // initTrace variants
30 public void initTrace(String path, Class<T> eventType) throws FileNotFoundException;
31
32 public void initTrace(String path, Class<T> eventType, int cacheSize) throws FileNotFoundException;
33
34 public void initTrace(String path, Class<T> eventType, boolean indexTrace) throws FileNotFoundException;
35
36 public void initTrace(String path, Class<T> eventType, int cacheSize, boolean indexTrace) throws FileNotFoundException;
37
38 public void initTrace(String path, Class<T> eventType, int cacheSize, boolean indexTrace, String name) throws FileNotFoundException;
39
40 // Trace type validation
41 public boolean validate(IProject project, String path);
42
43 public ITmfTrace<T> copy();
44
45 /**
46 * @return the trace path
47 */
48 public String getPath();
49
50 /**
51 * @return the trace name
52 */
53 @Override
54 public String getName();
55
56 /**
57 * @return the cache size
58 */
59 public int getCacheSize();
60
61 /**
62 * @return the number of events in the trace
63 */
64 public long getNbEvents();
65
66 /**
67 * Trace time range accesses
68 */
69 public TmfTimeRange getTimeRange();
70
71 public ITmfTimestamp getStartTime();
72
73 public ITmfTimestamp getEndTime();
74
75 /**
76 * Positions the trace at the first event with the specified timestamp or index (i.e. the nth event in the trace).
77 *
78 * Returns a context which can later be used to read the event.
79 *
80 * @param location
81 * @param timestamp
82 * @param rank
83 * @return a context object for subsequent reads
84 */
85 public TmfContext seekLocation(ITmfLocation<?> location);
86
87 public TmfContext seekEvent(ITmfTimestamp timestamp);
88
89 public TmfContext seekEvent(long rank);
90
91 /**
92 * Positions the trace at the event located at the specified ratio.
93 *
94 * Returns a context which can later be used to read the event.
95 *
96 * @param ratio
97 * a floating-point number between 0.0 (beginning) and 1.0 (end)
98 * @return a context object for subsequent reads
99 */
100 public TmfContext seekLocation(double ratio);
101
102 /**
103 * Returns the ratio corresponding to the specified location.
104 *
105 * @param location
106 * a trace location
107 * @return a floating-point number between 0.0 (beginning) and 1.0 (end)
108 */
109 public double getLocationRatio(ITmfLocation<?> location);
110
111 public ITmfLocation<?> getCurrentLocation();
112
113 /**
114 * Returns the rank of the first event with the requested timestamp. If none, returns the index of the next event
115 * (if any).
116 *
117 * @param timestamp
118 * @return
119 */
120 public long getRank(ITmfTimestamp timestamp);
121
122 /**
123 * Return the event pointed by the supplied context (or null if no event left) and updates the context to the next
124 * event.
125 *
126 * @return the next event in the stream
127 */
128 public TmfEvent getNextEvent(TmfContext context);
129
130 /**
131 * Return the event pointed by the supplied context (or null if no event left) and *does not* update the context.
132 *
133 * @return the next event in the stream
134 */
135 public TmfEvent parseEvent(TmfContext context);
136
137 }
This page took 0.051555 seconds and 6 git commands to generate.