Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ReorderingBuffer.cs
Go to the documentation of this file.
3
5
6[DebuggerDisplay("Count={CountForDebugging}")]
8internal sealed class ReorderingBuffer<TOutput> : IReorderingBuffer
9{
10 private sealed class DebugView
11 {
13
15
16 public long NextIdRequired => _buffer._nextReorderedIdToOutput;
17
22 }
23
24 private readonly object _owningSource;
25
27
29
31
32 private object ValueLock => _reorderingBuffer;
33
35
41
42 internal void AddItem(long id, TOutput item, bool itemIsValid)
43 {
45 {
47 {
49 }
50 else
51 {
53 }
54 }
55 }
56
57 internal bool? AddItemIfNextAndTrusted(long id, TOutput item, bool isTrusted)
58 {
60 {
62 {
63 if (isTrusted)
64 {
66 return null;
67 }
68 return true;
69 }
70 return false;
71 }
72 }
73
74 public void IgnoreItem(long id)
75 {
76 AddItem(id, default(TOutput), itemIsValid: false);
77 }
78
97}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
Dictionary< long, KeyValuePair< bool, TOutput > > ItemsBuffered
ReorderingBuffer(object owningSource, Action< object, TOutput > outputAction)
readonly Dictionary< long, KeyValuePair< bool, TOutput > > _reorderingBuffer
void OutputNextItem(TOutput theNextItem, bool itemIsValid)
void AddItem(long id, TOutput item, bool itemIsValid)
bool? AddItemIfNextAndTrusted(long id, TOutput item, bool isTrusted)