Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
StatisticalFloat.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Misc/AssertionMacros.h"
7#include "Math/UnrealMathUtility.h"
8
9// Used to measure a distribution
10template <typename T>
12{
13public:
15 : MinValue()
16 , MaxValue()
17 , Accumulator()
18 , NumSamples()
19 {
20 }
21
22 void AddSample(T Value)
23 {
24 if (NumSamples == 0)
25 {
27 }
28 else
29 {
32 }
34 ++NumSamples;
35 }
36
37 T GetMinValue() const
38 {
39 return MinValue;
40 }
41
42 T GetMaxValue() const
43 {
44 return MaxValue;
45 }
46
47 T GetAvgValue() const
48 {
49 return (NumSamples > 0) ? (Accumulator / (double)NumSamples) : T();
50 }
51
52 int32 GetCount() const
53 {
54 return NumSamples;
55 }
56
57private:
62};
63
FStatisticalValue< double > FStatisticalFloat
void AddSample(T Value)
int32 GetCount() const