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