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