1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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
10 * Alexandre Montplaisir - Initial API
11 ******************************************************************************/
13 package org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
;
15 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.StateValueTypeException
;
18 * This is the interface for using state values and reading their contents.
20 * @author Alexandre Montplaisir
22 public interface ITmfStateValue
extends Comparable
<ITmfStateValue
> {
25 * The supported types of state values
29 /** Null value, for an interval not carrying any information */
31 /** 32-bit integer value */
33 /** 64-bit integer value */
35 /** IEEE 754 double precision number */
37 /** Variable-length string value */
40 private final byte fTypeByte
;
42 private Type(byte type
) {
47 * Get the corresponding Type from its byte representation.
51 * @return The corresponding Type enum element
52 * @throws IllegalArgumentException
53 * If the type byte is not recognized
56 public static Type
getTypeFromByte(byte type
) {
69 throw new IllegalArgumentException();
74 * Get the byte representation of this type.
76 * @return The type byte
79 public byte getByte() {
85 * Each implementation has to define which one (among the supported types)
86 * they implement. There could be more than one implementation of each type,
87 * depending on the needs of the different users.
89 * @return The ITmfStateValue.Type enum representing the type of this value
94 * Only "null values" should return true here
96 * @return True if this type of SV is considered "null", false if it
97 * contains a real value.
102 * Read the contained value as an 'int' primitive
104 * @return The integer contained in the state value
105 * @throws StateValueTypeException
106 * If the contained value cannot be read as an integer
111 * Read the contained value as a 'long' primitive
113 * @return The long contained in the state value
114 * @throws StateValueTypeException
115 * If the contained value cannot be read as a long
120 * Read the contained value as a 'double' primitive
122 * @return The double contained in the state value
123 * @throws StateValueTypeException
124 * If the contained value cannot be read as a double
126 double unboxDouble();
129 * Read the contained value as a String
131 * @return The String contained in the state value
132 * @throws StateValueTypeException
133 * If the contained value cannot be read as a String
138 * Serialize this state value into a byte array.
140 * The format of this array should always be:
142 * <pre>[type byte][payload]</pre>
144 * and the type will determine the layout of [payload].
146 * @return The serialized form of the state value
This page took 0.041633 seconds and 5 git commands to generate.