| 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: Matthew Khouzam - Initial API and implementation |
| 10 | *******************************************************************************/ |
| 11 | |
| 12 | package org.eclipse.tracecompass.ctf.core.event; |
| 13 | |
| 14 | import java.util.Collections; |
| 15 | import java.util.Set; |
| 16 | |
| 17 | import org.eclipse.tracecompass.ctf.core.CTFException; |
| 18 | import org.eclipse.tracecompass.ctf.core.CTFStrings; |
| 19 | import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; |
| 20 | import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration; |
| 21 | import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration; |
| 22 | import org.eclipse.tracecompass.ctf.core.trace.CTFStream; |
| 23 | import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader; |
| 24 | |
| 25 | /** |
| 26 | * A lost event definition |
| 27 | * |
| 28 | * @author Matthew Khouzam |
| 29 | * @since 1.0 |
| 30 | */ |
| 31 | public class LostEventDeclaration implements IEventDeclaration { |
| 32 | |
| 33 | /** |
| 34 | * Id of lost events |
| 35 | * |
| 36 | * @since 1.0 |
| 37 | */ |
| 38 | public static final long LOST_EVENT_ID = -1L; |
| 39 | |
| 40 | /** |
| 41 | * Gets a "lost" event. This is a synthetic event that is there to show that |
| 42 | * there should be something there. |
| 43 | */ |
| 44 | public static final LostEventDeclaration INSTANCE = new LostEventDeclaration(); |
| 45 | |
| 46 | private final StructDeclaration fFields = new StructDeclaration(0); |
| 47 | |
| 48 | private LostEventDeclaration() { |
| 49 | getFields().addField(CTFStrings.LOST_EVENTS_FIELD, IntegerDeclaration.UINT_32B_DECL); |
| 50 | getFields().addField(CTFStrings.LOST_EVENTS_DURATION, IntegerDeclaration.UINT_64B_DECL); |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, BitBuffer input, long timestamp) throws CTFException { |
| 55 | return null; |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public String getName() { |
| 60 | return CTFStrings.LOST_EVENT_NAME; |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public StructDeclaration getFields() { |
| 65 | return fFields; |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public StructDeclaration getContext() { |
| 70 | return null; |
| 71 | } |
| 72 | |
| 73 | @Override |
| 74 | public Long getId() { |
| 75 | return LOST_EVENT_ID; |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public CTFStream getStream() { |
| 80 | return null; |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public long getLogLevel() { |
| 85 | return 0; |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public Set<String> getCustomAttributes() { |
| 90 | return Collections.<String> emptySet(); |
| 91 | } |
| 92 | |
| 93 | @Override |
| 94 | public String getCustomAttribute(String key) { |
| 95 | return null; |
| 96 | } |
| 97 | |
| 98 | } |