ctf/tmf: allow multiple traces to be open with name clashing events
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / ctfadaptor / CtfLocation.java
index b310f822c81eb433697b861498e3a631c88f7817..e59a2d35c35079a00b0bc19b1bdd4f73bf6f0b96 100644 (file)
@@ -12,6 +12,8 @@
  *******************************************************************************/
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
+import java.nio.ByteBuffer;
+
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.location.TmfLocation;
 
@@ -101,6 +103,18 @@ public final class CtfLocation extends TmfLocation {
     // TmfLocation
     // ------------------------------------------------------------------------
 
+    /**
+     * Construct the location from the ByteBuffer.
+     *
+     * @param bufferIn
+     *            the buffer to read from
+     *
+     * @since 3.0
+     */
+    public CtfLocation(ByteBuffer bufferIn) {
+        super(new CtfLocationInfo(bufferIn));
+    }
+
     /**
      * @since 2.0
      */
@@ -115,10 +129,19 @@ public final class CtfLocation extends TmfLocation {
 
     @Override
     public String toString() {
-        if( this.getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) {
+        if (getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) {
             return getClass().getSimpleName() + " [INVALID]"; //$NON-NLS-1$
         }
         return super.toString();
     }
 
+    /**
+     * Constructs the location from the ByteBuffer. This typically happens when reading from disk.
+     *
+     * @since 3.0
+     */
+    @Override
+    public void serialize(ByteBuffer bufferOut) {
+        getLocationInfo().serialize(bufferOut);
+    }
 }
This page took 0.024915 seconds and 5 git commands to generate.