Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetAggregator()

bool System.Diagnostics.Metrics.LabelInstructionInterpretter< TObjectSequence, TAggregator >.GetAggregator ( ReadOnlySpan< KeyValuePair< string, object > > labels,
out TAggregator aggregator )
inline

Definition at line 24 of file LabelInstructionInterpretter.cs.

25 {
26 aggregator = null;
27 if (labels.Length != _expectedLabelCount)
28 {
29 return false;
30 }
31 TObjectSequence val = default(TObjectSequence);
32 if (val is ObjectSequenceMany)
33 {
34 val = (TObjectSequence)(object)new ObjectSequenceMany(new object[_expectedLabelCount]);
35 }
36 Span<object> span = val.AsSpan();
37 for (int i = 0; i < _instructions.Length; i++)
38 {
39 LabelInstruction labelInstruction = _instructions[i];
40 if (labelInstruction.LabelName != labels[labelInstruction.SourceIndex].Key)
41 {
42 return false;
43 }
44 span[i] = labels[labelInstruction.SourceIndex].Value;
45 }
47 {
49 if (aggregator == null)
50 {
51 return true;
52 }
54 }
55 return true;
56 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
TValue GetOrAdd(TKey key, Func< TKey, TValue > valueFactory)
ConcurrentDictionary< TObjectSequence, TAggregator > _valuesDict

References System.Diagnostics.Metrics.LabelInstructionInterpretter< TObjectSequence, TAggregator >._createAggregator, System.Diagnostics.Metrics.LabelInstructionInterpretter< TObjectSequence, TAggregator >._expectedLabelCount, System.Diagnostics.Metrics.LabelInstructionInterpretter< TObjectSequence, TAggregator >._instructions, System.Diagnostics.Metrics.LabelInstructionInterpretter< TObjectSequence, TAggregator >._valuesDict, System.Collections.Concurrent.ConcurrentDictionary< TKey, TValue >.GetOrAdd(), and System.Collections.Concurrent.ConcurrentDictionary< TKey, TValue >.TryGetValue().