| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2009, 2013 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 | * Francois Chouinard - Updated as per TMF Trace Model 1.0 |
| 12 | * Patrick Tasse - Updated for removal of context clone |
| 13 | *******************************************************************************/ |
| 14 | |
| 15 | package org.eclipse.linuxtools.tmf.core.trace; |
| 16 | |
| 17 | import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation; |
| 18 | |
| 19 | /** |
| 20 | * The basic trace context structure in TMF. The purpose of the context is to |
| 21 | * associate a trace location to an event at a specific rank (order). |
| 22 | * <p> |
| 23 | * The context should be sufficient to allow the trace to position itself so |
| 24 | * that performing a trace read operation will yield the corresponding 'nth' |
| 25 | * event. |
| 26 | * |
| 27 | * @version 1.0 |
| 28 | * @author Francois Chouinard |
| 29 | * |
| 30 | * @see ITmfLocation |
| 31 | */ |
| 32 | public interface ITmfContext { |
| 33 | |
| 34 | // ------------------------------------------------------------------------ |
| 35 | // Constants |
| 36 | // ------------------------------------------------------------------------ |
| 37 | |
| 38 | /** |
| 39 | * The unknown event rank |
| 40 | */ |
| 41 | public long UNKNOWN_RANK = -1L; |
| 42 | |
| 43 | // ------------------------------------------------------------------------ |
| 44 | // Getters |
| 45 | // ------------------------------------------------------------------------ |
| 46 | |
| 47 | /** |
| 48 | * @return the rank of the event at the context location |
| 49 | */ |
| 50 | long getRank(); |
| 51 | |
| 52 | /** |
| 53 | * @return the location of the event at the context rank |
| 54 | * @since 3.0 |
| 55 | */ |
| 56 | ITmfLocation getLocation(); |
| 57 | |
| 58 | /** |
| 59 | * @return indicates if the context rank is valid (!= UNKNOWN_RANK) |
| 60 | */ |
| 61 | boolean hasValidRank(); |
| 62 | |
| 63 | // ------------------------------------------------------------------------ |
| 64 | // Operations |
| 65 | // ------------------------------------------------------------------------ |
| 66 | |
| 67 | /** |
| 68 | * @param location the new location |
| 69 | * @since 3.0 |
| 70 | */ |
| 71 | void setLocation(ITmfLocation location); |
| 72 | |
| 73 | /** |
| 74 | * @param rank the new rank |
| 75 | */ |
| 76 | void setRank(long rank); |
| 77 | |
| 78 | /** |
| 79 | * Increment the context rank |
| 80 | */ |
| 81 | void increaseRank(); |
| 82 | |
| 83 | /** |
| 84 | * Cleanup hook |
| 85 | */ |
| 86 | void dispose(); |
| 87 | |
| 88 | } |