Commit | Line | Data |
---|---|---|
a52fde77 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2012, 2015 Ericsson |
a52fde77 AM |
3 | * Copyright (c) 2010, 2011 École Polytechnique de Montréal |
4 | * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com> | |
5df842b3 | 5 | * |
a52fde77 AM |
6 | * All rights reserved. This program and the accompanying materials are |
7 | * made available under the terms of the Eclipse Public License v1.0 which | |
8 | * accompanies this distribution, and is available at | |
9 | * http://www.eclipse.org/legal/epl-v10.html | |
5df842b3 | 10 | * |
a52fde77 AM |
11 | *******************************************************************************/ |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.statesystem; |
a52fde77 | 14 | |
d0c7e4ba | 15 | import org.eclipse.jdt.annotation.Nullable; |
e894a508 AM |
16 | import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; |
17 | import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; | |
2bdf0193 AM |
18 | import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; |
19 | import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; | |
2c2f900e | 20 | |
a52fde77 AM |
21 | /** |
22 | * This is the interface used to define the "state change input", which is the | |
23 | * main type of input that goes in the state system. | |
5df842b3 | 24 | * |
a52fde77 AM |
25 | * Usually a state change input, also called "state provider" is the piece of |
26 | * the pipeline which converts trace events to state changes. | |
5df842b3 | 27 | * |
2cb26548 | 28 | * @author Alexandre Montplaisir |
a52fde77 | 29 | */ |
0fe46f2a | 30 | public interface ITmfStateProvider { |
a52fde77 | 31 | |
a96cc6be AM |
32 | /** |
33 | * Event handler plugins should provide a version number. This is used to | |
34 | * determine if a potential existing file can be re-opened later (if the | |
35 | * versions in the file and in the viewer match), or if the file should be | |
36 | * rebuilt from scratch (if the versions don't match). | |
37 | * | |
38 | * @return The version number of the input plugin | |
a96cc6be | 39 | */ |
57a2a5ca | 40 | int getVersion(); |
a96cc6be | 41 | |
2c2f900e AM |
42 | /** |
43 | * Get the trace with which this state input plugin is associated. | |
5df842b3 | 44 | * |
2c2f900e AM |
45 | * @return The associated trace |
46 | */ | |
57a2a5ca | 47 | ITmfTrace getTrace(); |
5df842b3 | 48 | |
a52fde77 AM |
49 | /** |
50 | * Return the start time of this "state change input", which is normally the | |
51 | * start time of the originating trace (or it can be the time of the first | |
52 | * state-changing event). | |
5df842b3 | 53 | * |
a52fde77 AM |
54 | * @return The start time |
55 | */ | |
57a2a5ca | 56 | long getStartTime(); |
a52fde77 | 57 | |
91dc8d51 GB |
58 | /** |
59 | * Return the last time at which it is safe to query the state system under | |
60 | * construction, ie not the current end time of the underlying state system, | |
61 | * but the time just before the latest event that has been processed. | |
62 | * | |
63 | * @return The last timestamp at which it is safe to query the state system | |
64 | * underneath | |
65 | * @since 2.0 | |
66 | */ | |
67 | long getLatestSafeTime(); | |
68 | ||
a52fde77 AM |
69 | /** |
70 | * Assign the target state system where this SCI will insert its state | |
71 | * changes. Because of dependencies issues, this can normally not be done at | |
72 | * the constructor. | |
5df842b3 | 73 | * |
a52fde77 | 74 | * This needs to be called before .run()! |
5df842b3 | 75 | * |
d26f90fd | 76 | * @param ssb |
5df842b3 AM |
77 | * Target state system for the state changes generated by this |
78 | * input plugin | |
a52fde77 | 79 | */ |
57a2a5ca | 80 | void assignTargetStateSystem(ITmfStateSystemBuilder ssb); |
2c2f900e | 81 | |
7e634be6 AM |
82 | /** |
83 | * Return the currently assigned target state system. | |
84 | * | |
85 | * @return Reference to the currently assigned state system, or null if no | |
86 | * SS is assigned yet | |
7e634be6 | 87 | */ |
d0c7e4ba | 88 | @Nullable ITmfStateSystem getAssignedStateSystem(); |
7e634be6 | 89 | |
2c2f900e AM |
90 | /** |
91 | * Send an event to this input plugin for processing. The implementation | |
92 | * should check the contents, and call the state-modifying methods of its | |
93 | * IStateSystemBuilder object accordingly. | |
5df842b3 | 94 | * |
2c2f900e AM |
95 | * @param event |
96 | * The event (which should be safe to cast to the | |
97 | * expectedEventType) that has to be processed. | |
98 | */ | |
57a2a5ca | 99 | void processEvent(ITmfEvent event); |
2c2f900e | 100 | |
e96ab5c4 AM |
101 | /** |
102 | * Provide a non-initialized copy of this state input plugin. You will need | |
103 | * to call {@link #assignTargetStateSystem} on it to assign its target. | |
104 | * | |
105 | * @return A new state change input object, of the same type, but without an | |
106 | * assigned target state system | |
e96ab5c4 | 107 | */ |
57a2a5ca | 108 | ITmfStateProvider getNewInstance(); |
e96ab5c4 | 109 | |
2c2f900e AM |
110 | /** |
111 | * Indicate to the state history building process that we are done (for now), | |
112 | * and that it should close its current history. | |
113 | */ | |
57a2a5ca | 114 | void dispose(); |
a52fde77 | 115 | } |