2f4a2058965c8dd4b01c7e491cf6a163b33a1572
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / statevalue / ITmfStateValue.java
1 /*******************************************************************************
2 * Copyright (c) 2012 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 * Alexandre Montplaisir - Initial API
11 ******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.core.statevalue;
14
15 import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
16
17
18 /**
19 * This is the interface for using state values and reading their contents.
20 *
21 * @author alexmont
22 *
23 */
24 public interface ITmfStateValue {
25
26 public static final byte TYPE_NULL = -1;
27 public static final byte TYPE_INTEGER = 0;
28 public static final byte TYPE_STRING = 1;
29
30 /**
31 * Each implementation has to supply a "type" number. This will get written
32 * as-is in the History file to recognize the type, so it needs to be unique
33 *
34 * @return The unique "int8" assigned to this state value type
35 */
36 public byte getType();
37
38 /**
39 * Only "null values" should return true here
40 *
41 * @return True if this type of SV is considered "null", false if it
42 * contains a real value.
43 */
44 public boolean isNull();
45
46 /**
47 * Read the contained value as an 'int' primitive
48 *
49 * @return The integer contained in the state value
50 * @throws StateValueTypeException
51 * If the contained value cannot be read as an integer
52 */
53 public int unboxInt() throws StateValueTypeException;
54
55 /**
56 * Read the contained value as a String
57 *
58 * @return The String contained in the state value
59 * @throws StateValueTypeException
60 * If the contained value cannot be read as a String
61 */
62 public String unboxStr() throws StateValueTypeException;
63 }
This page took 0.031713 seconds and 5 git commands to generate.