source: trunk/lib/StatsCollection.h @ 538

Last change on this file since 538 was 538, checked in by Peter Johansson, 13 years ago

added ignore-cache option

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1#ifndef _theplu_svndigest_stats_collection_
2#define _theplu_svndigest_stats_collection_
3
4// $Id: StatsCollection.h 538 2007-12-27 07:25:08Z 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://trac.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 2 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 this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26  02111-1307, USA.
27*/
28
29#include "Stats.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       reset everything
65     */
66    void print(std::ostream&);
67
68    /**
69       reset everything
70     */
71    void reset(void);
72
73    const std::map<std::string, Stats*>& stats(void) const;
74
75    /**
76     */
77    const StatsCollection& operator+=(const StatsCollection&);
78
79    /**
80       \return const Stats reference associated to \a key
81
82       \throw if key does not exists
83     */
84    const Stats& operator[](const std::string& key) const;
85
86    /**
87       \return Stats reference associated to \a key
88     */
89    Stats& operator[](const std::string& key);
90
91  private:
92    const std::string path_;
93    typedef std::map<std::string, Stats*> map;
94    map stats_;
95  };
96}} // end of namespace svndigest end of namespace theplu
97
98#endif
Note: See TracBrowser for help on using the repository browser.