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
10
template
<
typename
T>
11
struct
FStatisticalValue
12
{
13
public
:
14
FStatisticalValue
()
15
:
MinValue
()
16
,
MaxValue
()
17
,
Accumulator
()
18
,
NumSamples
()
19
{
20
}
21
22
void
AddSample
(T Value)
23
{
24
if
(
NumSamples
== 0)
25
{
26
MinValue
=
MaxValue
=
Value
;
27
}
28
else
29
{
30
MinValue
=
FMath
::
Min
(
MinValue
,
Value
);
31
MaxValue
=
FMath
::
Max
(
MaxValue
,
Value
);
32
}
33
Accumulator
+=
Value
;
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
57
private
:
58
T
MinValue
;
59
T
MaxValue
;
60
T
Accumulator
;
61
int32
NumSamples
;
62
};
63
64
typedef
FStatisticalValue
<
double
>
FStatisticalFloat
;
FStatisticalFloat
FStatisticalValue< double > FStatisticalFloat
Definition
StatisticalFloat.h:64
FStatisticalValue
Definition
StatisticalFloat.h:12
FStatisticalValue::Accumulator
T Accumulator
Definition
StatisticalFloat.h:60
FStatisticalValue::AddSample
void AddSample(T Value)
Definition
StatisticalFloat.h:22
FStatisticalValue::GetMinValue
T GetMinValue() const
Definition
StatisticalFloat.h:37
FStatisticalValue::FStatisticalValue
FStatisticalValue()
Definition
StatisticalFloat.h:14
FStatisticalValue::GetMaxValue
T GetMaxValue() const
Definition
StatisticalFloat.h:42
FStatisticalValue::MaxValue
T MaxValue
Definition
StatisticalFloat.h:59
FStatisticalValue::MinValue
T MinValue
Definition
StatisticalFloat.h:58
FStatisticalValue::GetAvgValue
T GetAvgValue() const
Definition
StatisticalFloat.h:47
FStatisticalValue::NumSamples
int32 NumSamples
Definition
StatisticalFloat.h:61
FStatisticalValue::GetCount
int32 GetCount() const
Definition
StatisticalFloat.h:52
Downloads
ArkServerAPI_NEW
ASA
AsaApi
AsaApi
Core
Public
API
UE
Math
StatisticalFloat.h
Generated by
1.10.0