Commit | Line | Data |
---|---|---|
eb1bab5b | 1 | /********************************************************************** |
53616c9e | 2 | * Copyright (c) 2012, 2014 Ericsson |
b0318660 | 3 | * |
eb1bab5b BH |
4 | * All rights reserved. This program and the accompanying materials are |
5 | * made 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 | |
b0318660 AM |
8 | * |
9 | * Contributors: | |
eb1bab5b BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
53616c9e | 12 | |
8e8c0226 | 13 | package org.eclipse.linuxtools.internal.lttng2.control.core.model; |
eb1bab5b BH |
14 | |
15 | /** | |
eb1bab5b | 16 | * Trace event type enumeration. |
b0318660 | 17 | * |
dbd4432d | 18 | * @author Bernd Hufmann |
eb1bab5b | 19 | */ |
b0318660 AM |
20 | public enum TraceEventType { |
21 | /** Event type: tracepoint */ | |
eb1bab5b | 22 | TRACEPOINT("tracepoint"), //$NON-NLS-1$ |
b0318660 | 23 | /** Event type: syscall */ |
3e91c9c0 | 24 | SYSCALL("syscall"), //$NON-NLS-1$ |
b0318660 | 25 | /** Event type: probe */ |
53616c9e | 26 | PROBE("probe"), //$NON-NLS-1$ |
1f07c96c BH |
27 | /** Event type: function */ |
28 | FUNCTION("function"), //$NON-NLS-1$ | |
b0318660 | 29 | /** Event type unknown */ |
eb1bab5b BH |
30 | UNKNOWN("unknown"); //$NON-NLS-1$ |
31 | ||
32 | private final String fInName; | |
33 | ||
34 | private TraceEventType(String name) { | |
35 | fInName = name; | |
36 | } | |
37 | ||
b0318660 AM |
38 | /** |
39 | * Get the type's name | |
40 | * | |
41 | * @return The type's name | |
42 | */ | |
eb1bab5b BH |
43 | public String getInName() { |
44 | return fInName; | |
45 | } | |
eb1bab5b | 46 | |
53616c9e JRJ |
47 | /** |
48 | * Return the corresponding {@link TraceEventType} of string miName | |
49 | * | |
50 | * @param name | |
51 | * name of the {@link TraceEventType} to look for | |
52 | * @return the corresponding {@link TraceEventType} | |
53 | */ | |
54 | public static TraceEventType valueOfString(String name) { | |
55 | if (name == null) { | |
56 | throw new IllegalArgumentException(); | |
57 | } | |
58 | for (TraceEventType teType : TraceEventType.values()) { | |
59 | if (teType.getInName().equalsIgnoreCase(name)) { | |
60 | return teType; | |
61 | } | |
62 | } | |
63 | return UNKNOWN; | |
64 | } | |
65 | } |