ctf: Make events immutable
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / EnumDeclaration.java
index 89d28d8d0eef7ae1d6434784420a22ba7e6abe60..6d250986f3ebb23266ce042aa56ebeb434b2cacb 100644 (file)
@@ -18,6 +18,10 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
+import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
+import org.eclipse.linuxtools.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+
 /**
  * A CTF enum declaration.
  *
@@ -28,7 +32,7 @@ import java.util.Set;
  * @author Matthew Khouzam
  * @author Simon Marchi
  */
-public class EnumDeclaration implements IDeclaration {
+public final class EnumDeclaration extends Declaration {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -72,14 +76,26 @@ public class EnumDeclaration implements IDeclaration {
         return this.getContainerType().getAlignment();
     }
 
+    /**
+     * @since 3.0
+     */
+    @Override
+    public int getMaximumSize() {
+        return fContainerType.getMaximumSize();
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
 
+    /**
+     * @since 3.0
+     */
     @Override
-    public EnumDefinition createDefinition(IDefinitionScope definitionScope,
-            String fieldName) {
-        return new EnumDefinition(this, definitionScope, fieldName);
+    public EnumDefinition createDefinition(IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException {
+        alignRead(input);
+        IntegerDefinition value = getContainerType().createDefinition(definitionScope, fieldName, input);
+        return new EnumDefinition(this, definitionScope, fieldName, value);
     }
 
     /**
This page took 0.031829 seconds and 5 git commands to generate.