source: trunk/lib/StatsCollection.h @ 847

Last change on this file since 847 was 847, checked in by Peter Johansson, 14 years ago

updating copyrights

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