| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2015 Ericsson |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are made |
| 5 | * 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 |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Matthew Khouzam - Initial API and implementation |
| 11 | *******************************************************************************/ |
| 12 | |
| 13 | package org.eclipse.tracecompass.internal.ctf.core.trace; |
| 14 | |
| 15 | import org.eclipse.jdt.annotation.NonNullByDefault; |
| 16 | import org.eclipse.jdt.annotation.Nullable; |
| 17 | import org.eclipse.tracecompass.ctf.core.CTFException; |
| 18 | import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition; |
| 19 | import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor; |
| 20 | import org.eclipse.tracecompass.ctf.core.trace.IPacketReader; |
| 21 | import org.eclipse.tracecompass.internal.ctf.core.event.EventDefinition; |
| 22 | |
| 23 | /** |
| 24 | * Null packet reader, used for unset packets |
| 25 | */ |
| 26 | @NonNullByDefault |
| 27 | public final class NullPacketReader implements IPacketReader { |
| 28 | |
| 29 | /** |
| 30 | * Instance of a null packet reader |
| 31 | */ |
| 32 | public static final NullPacketReader INSTANCE = new NullPacketReader(); |
| 33 | |
| 34 | private NullPacketReader() { } |
| 35 | |
| 36 | @Override |
| 37 | public int getCPU() { |
| 38 | return UNKNOWN_CPU; |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | public boolean hasMoreEvents() { |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | @Override |
| 47 | public @Nullable EventDefinition readNextEvent() throws CTFException { |
| 48 | return null; |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | public @Nullable ICTFPacketDescriptor getCurrentPacket() { |
| 53 | return null; |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public @Nullable ICompositeDefinition getCurrentPacketEventHeader() { |
| 58 | return null; |
| 59 | } |
| 60 | } |