-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventHeaderEnumeratorState.cs
86 lines (73 loc) · 2.66 KB
/
EventHeaderEnumeratorState.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
namespace Microsoft.LinuxTracepoints.Decode
{
/// <summary>
/// Values for the State property of EventHeaderEnumerator.
/// </summary>
public enum EventHeaderEnumeratorState : byte
{
/// <summary>
/// After construction, a call to Clear, or a failed StartEvent.
/// </summary>
None,
/// <summary>
/// After an error has been returned by MoveNext.
/// </summary>
Error,
/// <summary>
/// Positioned after the last item in the event.
/// </summary>
AfterLastItem,
// MoveNext() is an invalid operation for all states above this line.
// MoveNext() is a valid operation for all states below this line.
/// <summary>
/// Positioned before the first item in the event.
/// </summary>
BeforeFirstItem,
// GetItemInfo() is an invalid operation for all states above this line.
// GetItemInfo() is a valid operation for all states below this line.
/// <summary>
/// Positioned at an item with data (a field or an array element).
/// </summary>
Value,
/// <summary>
/// Positioned before the first item in an array.
/// </summary>
ArrayBegin,
/// <summary>
/// Positioned after the last item in an array.
/// </summary>
ArrayEnd,
/// <summary>
/// Positioned before the first item in a struct.
/// </summary>
StructBegin,
/// <summary>
/// Positioned after the last item in a struct.
/// </summary>
StructEnd,
}
/// <summary>
/// Extension methods for <see cref="EventHeaderEnumeratorState"/>
/// </summary>
public static class EventHeaderEnumeratorStateExtensions
{
/// <summary>
/// Returns true if `state >= EventHeaderEnumeratorState.BeforeFirstItem`,
/// i.e. if <see cref="EventHeaderEnumerator.MoveNext()"/> is a valid operation.
/// </summary>
public static bool CanMoveNext(this EventHeaderEnumeratorState state)
{
return state >= EventHeaderEnumeratorState.BeforeFirstItem;
}
/// <summary>
/// Returns true if `state > EventHeaderEnumeratorState.BeforeFirstItem`,
/// i.e. if <see cref="EventHeaderEnumerator.GetItemInfo()"/> is a valid operation.
/// </summary>
public static bool CanGetItemInfo(this EventHeaderEnumeratorState state)
{
return state > EventHeaderEnumeratorState.BeforeFirstItem;
}
}
}