SumAgg.inl
Go to the documentation of this file.
1 namespace iv
2 {
3 
4 template< class Int >
6  current( 0 ),
7  count( 0 )
8 {
9 }
10 
11 template< class Int >
12 SumAgg< Int >::SumAgg( Int current, int count ) :
13  current( current ),
14  count( count )
15 {
16 }
17 
18 template< class Int >
20 {
21  Int current = this->current + value;
22  int count = this->count + 1;
23  if( count == 0 )
24  current = 0;
25  return SumAgg< Int >( current, count );
26 }
27 
28 template< class Int >
30 {
31  Int current = this->current - value;
32  int count = this->count - 1;
33  if( count == 0 )
34  current = 0;
35  return SumAgg< Int >( current, count );
36 }
37 
38 template< class Int >
40 {
41  return this->current;
42 }
43 
44 template< class Int >
46 {
47  return this->count;
48 }
49 
50 }