tmf: Split the state system in a separate plugin
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / statesystem / ITmfStateProvider.java
CommitLineData
a52fde77 1/*******************************************************************************
61759503 2 * Copyright (c) 2012, 2013 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
18ab1d18 13package org.eclipse.linuxtools.tmf.core.statesystem;
a52fde77 14
bcec0116
AM
15import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem;
16import org.eclipse.linuxtools.statesystem.core.ITmfStateSystemBuilder;
2c2f900e
AM
17import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
18import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
19
a52fde77
AM
20/**
21 * This is the interface used to define the "state change input", which is the
22 * main type of input that goes in the state system.
5df842b3 23 *
a52fde77
AM
24 * Usually a state change input, also called "state provider" is the piece of
25 * the pipeline which converts trace events to state changes.
5df842b3 26 *
2cb26548 27 * @author Alexandre Montplaisir
0fe46f2a 28 * @since 2.0
a52fde77 29 */
0fe46f2a 30public 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
39 * @since 2.0
40 */
57a2a5ca 41 int getVersion();
a96cc6be 42
2c2f900e
AM
43 /**
44 * Get the trace with which this state input plugin is associated.
5df842b3 45 *
2c2f900e
AM
46 * @return The associated trace
47 */
57a2a5ca 48 ITmfTrace getTrace();
5df842b3 49
a52fde77
AM
50 /**
51 * Return the start time of this "state change input", which is normally the
52 * start time of the originating trace (or it can be the time of the first
53 * state-changing event).
5df842b3 54 *
a52fde77
AM
55 * @return The start time
56 */
57a2a5ca 57 long getStartTime();
a52fde77 58
2c2f900e
AM
59 /**
60 * Method for the input plugin to specify which type of events it expects.
61 * This will guarantee that all events it receives via processEvent() are
62 * indeed of the given type, so it should be safe to cast to that type.
5df842b3 63 *
79044a66
AM
64 * @return The expected Class of the event. Only events of this class (and
65 * valid subclasses) will be handled.
66 * @since 2.0
2c2f900e 67 */
57a2a5ca 68 Class<? extends ITmfEvent> getExpectedEventType();
2c2f900e 69
a52fde77
AM
70 /**
71 * Assign the target state system where this SCI will insert its state
72 * changes. Because of dependencies issues, this can normally not be done at
73 * the constructor.
5df842b3 74 *
a52fde77 75 * This needs to be called before .run()!
5df842b3 76 *
d26f90fd 77 * @param ssb
5df842b3
AM
78 * Target state system for the state changes generated by this
79 * input plugin
bcec0116 80 * @since 3.0
a52fde77 81 */
57a2a5ca 82 void assignTargetStateSystem(ITmfStateSystemBuilder ssb);
2c2f900e 83
7e634be6
AM
84 /**
85 * Return the currently assigned target state system.
86 *
87 * @return Reference to the currently assigned state system, or null if no
88 * SS is assigned yet
bcec0116 89 * @since 3.0
7e634be6 90 */
57a2a5ca 91 ITmfStateSystem getAssignedStateSystem();
7e634be6 92
2c2f900e
AM
93 /**
94 * Send an event to this input plugin for processing. The implementation
95 * should check the contents, and call the state-modifying methods of its
96 * IStateSystemBuilder object accordingly.
5df842b3 97 *
2c2f900e
AM
98 * @param event
99 * The event (which should be safe to cast to the
100 * expectedEventType) that has to be processed.
101 */
57a2a5ca 102 void processEvent(ITmfEvent event);
2c2f900e 103
e96ab5c4
AM
104 /**
105 * Provide a non-initialized copy of this state input plugin. You will need
106 * to call {@link #assignTargetStateSystem} on it to assign its target.
107 *
108 * @return A new state change input object, of the same type, but without an
109 * assigned target state system
110 * @since 2.0
111 */
57a2a5ca 112 ITmfStateProvider getNewInstance();
e96ab5c4 113
2c2f900e
AM
114 /**
115 * Indicate to the state history building process that we are done (for now),
116 * and that it should close its current history.
117 */
57a2a5ca 118 void dispose();
a52fde77 119}
This page took 0.051408 seconds and 5 git commands to generate.