source: trunk/lib/StatsCollection.h

Last change on this file was 1478, checked in by Peter Johansson, 9 years ago

closes #387

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1#ifndef _theplu_svndigest_stats_collection_
2#define _theplu_svndigest_stats_collection_
3
4// $Id: StatsCollection.h 1478 2012-05-29 10:17:04Z peter $
5
6/*
7  Copyright (C) 2007 Peter Johansson
8  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2010, 2012 Peter Johansson
10
11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
12
13  svndigest is free software; you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 3 of the License, or
16  (at your option) any later version.
17
18  svndigest is distributed in the hope that it will be useful, but
19  WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27#include "Stats.h"
28
29#include <subversion-1/svn_types.h>
30
31#include <map>
32#include <string>
33
34namespace theplu{
35namespace svndigest{
36
37  ///
38  /// Class taking care of statistics from svn.
39  ///
40  class StatsCollection
41  {
42  public:
43    ///
44    /// @brief Default Constructor
45    ///
46    explicit StatsCollection(const std::string& path);
47
48    /**
49       \brief Destructor
50     */
51    virtual ~StatsCollection(void);
52
53    /**
54       \return true if cache was up to date
55     */
56    bool load_cache(std::istream&);
57
58    /**
59       Do the parsing for different statistics
60     */
61    void parse(const std::string& path);
62
63    /**
64     */
65    void print(std::ostream&);
66
67    /**
68       reset everything
69     */
70    void reset(void);
71
72    /**
73     */
74    void ignore_rev(svn_revnum_t rev);
75
76    const std::map<std::string, Stats*>& stats(void) const;
77
78    /**
79     */
80    const StatsCollection& operator+=(const StatsCollection&);
81
82    /**
83       \return const Stats reference associated to \a key
84
85       \throw if key does not exists
86     */
87    const Stats& operator[](const std::string& key) const;
88
89    /**
90       \return Stats reference associated to \a key
91     */
92    Stats& operator[](const std::string& key);
93
94  private:
95    // copy not allowed
96    StatsCollection(const StatsCollection&);
97    StatsCollection& operator=(const StatsCollection&);
98
99    const std::string path_;
100    typedef std::map<std::string, Stats*> map;
101    map stats_;
102  };
103}} // end of namespace svndigest end of namespace theplu
104
105#endif
Note: See TracBrowser for help on using the repository browser.