source: trunk/lib/StatsCollection.h @ 834

Last change on this file since 834 was 801, checked in by Peter Johansson, 12 years ago

working on the test for partial cache. refs #338

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1#ifndef _theplu_svndigest_stats_collection_
2#define _theplu_svndigest_stats_collection_
3
4// $Id: StatsCollection.h 801 2009-07-06 02:07:42Z peter $
5
6/*
7  Copyright (C) 2005 Peter Johansson
8  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2007 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 <map>
30#include <string>
31
32namespace theplu{
33namespace svndigest{
34
35  ///
36  /// Class taking care of statistics from svn.
37  ///
38  class StatsCollection
39  {
40  public:
41    ///
42    /// @brief Default Constructor
43    ///
44    explicit StatsCollection(const std::string& path);
45
46    /**
47       \brief Destructor
48     */
49    virtual ~StatsCollection(void);
50
51    /**
52       \return true if cache was up to date
53     */
54    bool load_cache(std::istream&);
55
56    /**
57       Do the parsing for different statistics
58     */
59    void parse(const std::string& path);
60
61    /**
62     */
63    void print(std::ostream&);
64
65    /**
66       reset everything
67     */
68    void reset(void);
69
70    const std::map<std::string, Stats*>& stats(void) const;
71
72    /**
73     */
74    const StatsCollection& operator+=(const StatsCollection&);
75
76    /**
77       \return const Stats reference associated to \a key
78
79       \throw if key does not exists
80     */
81    const Stats& operator[](const std::string& key) const;
82
83    /**
84       \return Stats reference associated to \a key
85     */
86    Stats& operator[](const std::string& key);
87
88  private:
89    const std::string path_;
90    typedef std::map<std::string, Stats*> map;
91    map stats_;
92  };
93}} // end of namespace svndigest end of namespace theplu
94
95#endif
Note: See TracBrowser for help on using the repository browser.