/*******************************************************************************
- * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
+ * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
package org.eclipse.linuxtools.ctf.core.event.types;
import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
/**
* A CTF enum definition.
/**
* Sets the value of the enum in string format so "Enum a{DAY="0", NIGHT="1"}; will set 0
- * @param Value The value of the enum.
+ * @param value The value of the enum.
*/
- public void setIntegerValue(long Value) {
- integerValue.setValue(Value);
- value = declaration.query(Value);
+ public void setIntegerValue(long value) {
+ integerValue.setValue(value);
+ this.value = declaration.query(value);
}
@Override
// ------------------------------------------------------------------------
@Override
- public void read(BitBuffer input) {
- int align = (int) declaration.getAlignment();
- int pos = input.position() + ((align-(input.position() % align))%align);
- input.position(pos);
+ public void read(BitBuffer input) throws CTFReaderException {
+ alignRead(input, this.declaration);
integerValue.read(input);
long val = integerValue.getValue();
value = declaration.query(val);
}
+ @Override
+ public String toString() {
+ return "{ value = " + getValue() + //$NON-NLS-1$
+ ", container = " + integerValue.toString() + //$NON-NLS-1$
+ " }"; //$NON-NLS-1$
+ }
}