Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_core
Attribute
Types
MulAgg.inl
Go to the documentation of this file.
1
namespace
iv
2
{
3
4
template
<
class
Float >
5
MulAgg< Float >::MulAgg
() :
6
current( 1.0 ),
7
count( 0 )
8
{
9
}
10
11
template
<
class
Float >
12
MulAgg< Float >::MulAgg
( Float current,
int
count ) :
13
current( current ),
14
count( count )
15
{
16
}
17
18
template
<
class
Float >
19
MulAgg< Float >
MulAgg< Float >::Insert
( Float value )
const
20
{
21
Float current = this->current * value;
22
int
count = this->count + 1;
23
if
( count == 0 )
24
current = 1.0;
25
return
MulAgg< Float >
( current, count );
26
}
27
28
template
<
class
Float >
29
MulAgg< Float >
MulAgg< Float >::Remove
( Float value )
const
30
{
31
Float current = this->current / value;
32
int
count = this->count - 1;
33
if
( count == 0 )
34
current = 1.0;
35
return
MulAgg< Float >
( current, count );
36
}
37
38
template
<
class
Float >
39
Float
MulAgg< Float >::Aggregated
()
const
40
{
41
return
this->current;
42
}
43
44
template
<
class
Float >
45
int
MulAgg< Float >::Size
()
const
46
{
47
return
this->count;
48
}
49
50
}