Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F27035774
AverageValue.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Authored By
Unknown
Size
841 B
Referenced Files
None
Subscribers
None
AverageValue.cpp
View Options
#include
"AverageValue.h"
#include
<stdio.h>
AverageValue
::
AverageValue
()
{
resetAverageValue
();
}
void
AverageValue
::
resetAverageValue
()
{
avgValue
=
0
;
injectedValuesCounter
=
0
;
}
void
AverageValue
::
injectAndCalculateAverageValue
(
float
value
)
{
if
(
injectedValuesCounter
>
0
)
{
avgValue
=
(
avgValue
*
injectedValuesCounter
+
value
)
/
(
injectedValuesCounter
+
1
);
}
else
{
avgValue
=
value
;
}
injectedValuesCounter
++
;
}
float
AverageValue
::
getAverageValue
()
{
return
avgValue
;
}
unsigned
int
AverageValue
::
getInjectedValuesCounter
()
{
return
injectedValuesCounter
;
}
bool
AverageValue
::
averageValueIsValid
()
{
//printf(" ------------------- hier\n");
if
(
injectedValuesCounter
>
0
)
{
//printf(" --- injVal %u\n", injectedValuesCounter);
return
true
;
}
return
false
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Oct 27, 7:11 PM (22 m, 9 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
411390
Default Alt Text
AverageValue.cpp (841 B)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline