source: trunk/lib/Stats.h @ 23

Last change on this file since 23 was 23, checked in by Peter Johansson, 16 years ago

added print functionality

File size: 1.3 KB
Line 
1//$Id$
2
3#ifndef _theplu_svnstat_stats_
4#define _theplu_svnstat_stats_
5
6#include <map>
7#include <vector>
8
9namespace theplu{
10namespace svnstat{
11
12  ///
13  /// Class taking care of statistics from svn.
14  ///
15  class Stats
16  {
17  public:
18    ///
19    /// @brief Default Constructor
20    ///
21    Stats(void);
22   
23    ///
24    /// @brief adding a line to user from revision to the stats
25    ///
26    void add(const std::string& user, const u_int& revision); 
27
28    ///
29    /// @bief print statistics
30    ///
31    void print(std::ostream&) const;
32
33    ///
34    /// @brief Clear all statistics
35    ///
36    inline void reset(void) { map_.clear(); }
37
38    ///
39    /// @return resulting Stats
40    ///
41    Stats& operator+=(const Stats&);
42
43  private:
44    ///
45    /// Copy constructor (not implemented)
46    ///
47    Stats(const Stats& other);
48
49    ///
50    /// @return accumulated vector of total
51    ///
52    std::vector<u_int> accumulated(void) const;
53
54    ///
55    /// @return accumulated vector of stats_[user]
56    ///
57    std::vector<u_int> accumulated(const std::string& user);
58
59    // Peter, if the vector is sparse make it a map
60    typedef std::map<std::string, std::vector<u_int> > Map_;
61    typedef Map_::iterator MapIter_;
62    typedef Map_::const_iterator MapConstIter_;
63    Map_ map_;
64  };
65}}
66
67#endif // end of namespace svnstat end of namespace theplu
Note: See TracBrowser for help on using the repository browser.