aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Khouzam2012-04-20 13:20:05 (EDT)
committerMatthew Khouzam2012-05-01 09:47:44 (EDT)
commitebc5d85c23dec4d566758870e6e8b99c42ffb3bf (patch)
treec917aad7e98a9daa04e9d5e4106b2e9774bd6964
parentcb942f7a60a2256ee8879b955b55cdf2c7fe11ee (diff)
downloadorg.eclipse.linuxtools-ebc5d85c23dec4d566758870e6e8b99c42ffb3bf.zip
org.eclipse.linuxtools-ebc5d85c23dec4d566758870e6e8b99c42ffb3bf.tar.gz
org.eclipse.linuxtools-ebc5d85c23dec4d566758870e6e8b99c42ffb3bf.tar.bz2
Add support for float fields in a string output.
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java30
1 files changed, 29 insertions, 1 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
index 0b4db06..fc5fe98 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
@@ -15,6 +15,7 @@ package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import org.eclipse.linuxtools.ctf.core.event.types.ArrayDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.ArrayDefinition;
import org.eclipse.linuxtools.ctf.core.event.types.Definition;
+import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition;
import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
import org.eclipse.linuxtools.ctf.core.event.types.SequenceDeclaration;
@@ -109,8 +110,11 @@ public abstract class CtfTmfEventField implements ITmfEventField {
field = new CTFIntegerArrayField(values, fieldName);
}
/* Add other Sequence types here */
+ } else if (fieldDef instanceof FloatDefinition){
+ FloatDefinition floatDef = (FloatDefinition) fieldDef;
+ field = new CTFFloatField( floatDef.getValue(), fieldName);
}
- /* Add other field types here */
+
return field;
}
@@ -290,4 +294,28 @@ final class CTFIntegerArrayField extends CtfTmfEventField {
}
}
+final class CTFFloatField extends CtfTmfEventField {
+
+ Double value;
+ protected CTFFloatField(double value ,String name) {
+ super(name);
+ this.value = value;
+ }
+
+ @Override
+ public int getFieldType() {
+ return 3;
+ }
+
+ @Override
+ public Object getValue() {
+ return this.value;
+ }
+
+ @Override
+ public String toString(){
+ return name + '=' + value;
+ }
+
+}
/* Implement other possible fields types here... */