Merge branch 'master' into lttng-luna
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / statevalue / ITmfStateValue.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 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 * 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 * This is the interface for using state values and reading their contents.
19 *
20 * @version 1.0
21 * @author Alexandre Montplaisir
22 */
23 public interface ITmfStateValue {
24
25 /**
26 * The supported types of state values
27 * @since 2.0
28 */
29 public enum Type {
30 /** Null value, for an interval not carrying any information */
31 NULL,
32 /** 32-bit integer value */
33 INTEGER,
34 /** 64-bit integer value */
35 LONG,
36 /** IEEE 754 double precision number */
37 DOUBLE,
38 /** Variable-length string value */
39 STRING,
40 }
41
42 /**
43 * Each implementation has to define which one (among the supported types)
44 * they implement. There could be more than one implementation of each type,
45 * depending on the needs of the different users.
46 *
47 * @return The ITmfStateValue.Type enum representing the type of this value
48 * @since 2.0
49 */
50 Type getType();
51
52 /**
53 * Only "null values" should return true here
54 *
55 * @return True if this type of SV is considered "null", false if it
56 * contains a real value.
57 */
58 boolean isNull();
59
60 /**
61 * Read the contained value as an 'int' primitive
62 *
63 * @return The integer contained in the state value
64 * @throws StateValueTypeException
65 * If the contained value cannot be read as an integer
66 */
67 int unboxInt() throws StateValueTypeException;
68
69 /**
70 * Read the contained value as a 'long' primitive
71 *
72 * @return The long contained in the state value
73 * @throws StateValueTypeException
74 * If the contained value cannot be read as a long
75 * @since 2.0
76 */
77 long unboxLong() throws StateValueTypeException;
78
79 /**
80 * Read the contained value as a 'double' primitive
81 *
82 * @return The double contained in the state value
83 * @throws StateValueTypeException
84 * If the contained value cannot be read as a double
85 */
86 double unboxDouble() throws StateValueTypeException;
87
88 /**
89 * Read the contained value as a String
90 *
91 * @return The String contained in the state value
92 * @throws StateValueTypeException
93 * If the contained value cannot be read as a String
94 */
95 String unboxStr() throws StateValueTypeException;
96 }
This page took 0.033881 seconds and 6 git commands to generate.