1194 |
03 Oct 10 |
peter |
// $Id$ |
1194 |
03 Oct 10 |
peter |
2 |
|
1194 |
03 Oct 10 |
peter |
3 |
/* |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2010, 2011, 2023 Peter Johansson |
1194 |
03 Oct 10 |
peter |
5 |
|
1194 |
03 Oct 10 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
1194 |
03 Oct 10 |
peter |
7 |
|
1194 |
03 Oct 10 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
1194 |
03 Oct 10 |
peter |
under the terms of the GNU General Public License as published by |
1194 |
03 Oct 10 |
peter |
the Free Software Foundation; either version 3 of the License, or |
1194 |
03 Oct 10 |
peter |
(at your option) any later version. |
1194 |
03 Oct 10 |
peter |
12 |
|
1194 |
03 Oct 10 |
peter |
svndigest is distributed in the hope that it will be useful, but |
1194 |
03 Oct 10 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
1194 |
03 Oct 10 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1194 |
03 Oct 10 |
peter |
General Public License for more details. |
1194 |
03 Oct 10 |
peter |
17 |
|
1194 |
03 Oct 10 |
peter |
You should have received a copy of the GNU General Public License |
1194 |
03 Oct 10 |
peter |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
1194 |
03 Oct 10 |
peter |
20 |
*/ |
1194 |
03 Oct 10 |
peter |
21 |
|
1619 |
12 Mar 23 |
peter |
22 |
#include <config.h> |
1619 |
12 Mar 23 |
peter |
23 |
|
1194 |
03 Oct 10 |
peter |
24 |
#include "Vector.h" |
1194 |
03 Oct 10 |
peter |
25 |
|
1436 |
20 Dec 11 |
peter |
26 |
#include <cassert> |
1436 |
20 Dec 11 |
peter |
27 |
|
1194 |
03 Oct 10 |
peter |
28 |
namespace theplu{ |
1194 |
03 Oct 10 |
peter |
29 |
namespace svndigest{ |
1194 |
03 Oct 10 |
peter |
30 |
|
1194 |
03 Oct 10 |
peter |
31 |
|
1194 |
03 Oct 10 |
peter |
32 |
void accumulate(const SparseVector& vec, SumVector& result) |
1194 |
03 Oct 10 |
peter |
33 |
{ |
1194 |
03 Oct 10 |
peter |
34 |
result.clear(); |
1208 |
07 Oct 10 |
peter |
35 |
int value = 0; |
1513 |
23 Sep 12 |
peter |
36 |
for (SparseVector::const_iterator iter = vec.begin(); |
1208 |
07 Oct 10 |
peter |
37 |
iter!=vec.end();++iter) { |
1194 |
03 Oct 10 |
peter |
38 |
value += iter->second; |
1208 |
07 Oct 10 |
peter |
39 |
assert(value>=0); |
1194 |
03 Oct 10 |
peter |
40 |
result.set(iter->first, value); |
1194 |
03 Oct 10 |
peter |
41 |
} |
1194 |
03 Oct 10 |
peter |
42 |
} |
1194 |
03 Oct 10 |
peter |
43 |
|
1194 |
03 Oct 10 |
peter |
44 |
}} // end of namespace svndigest and namespace theplu |