source: trunk/lib/StatsCollection.h @ 532

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

Node holds a StatsCollection? rather than a Stats object.

  • 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 532 2007-12-26 01:47:03Z 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    const std::map<std::string, Stats*>& stats(void) const;
59
60
61    /**
62       reset everything
63     */
64    void print(std::ostream&);
65
66    /**
67       reset everything
68     */
69    void reset(void);
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    /**
89       Do the parsing for different statistics
90     */
91    const StatsCollection& parse(const std::string& path);
92
93    const std::string path_;
94    typedef std::map<std::string, Stats*> map;
95    map stats_;
96  };
97}} // end of namespace svndigest end of namespace theplu
98
99#endif
Note: See TracBrowser for help on using the repository browser.