source: trunk/lib/Stats.h @ 74

Last change on this file since 74 was 74, checked in by Jari Häkkinen, 17 years ago

Improved web presentation. Y axises normalized, ticket ticket:15 resolved.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1//$Id: Stats.h 74 2006-03-07 15:46:59Z jari $
2
3#ifndef _theplu_svnstat_stats_
4#define _theplu_svnstat_stats_
5
6#include <iostream>
7#include <map>
8#include <ostream>
9#include <string>
10#include <vector>
11
12namespace theplu{
13namespace svnstat{
14
15  ///
16  /// Class taking care of statistics from svn.
17  ///
18  class Stats
19  {
20  public:
21    ///
22    /// @brief Default Constructor
23    ///
24    inline Stats(void) {}
25
26    ///
27    /// @return true if file is binary
28    ///
29    bool parse(const std::string&);
30
31    ///
32    /// Create statistics graph.
33    ///
34    std::string plot(const std::string&) const;
35
36    ///
37    /// @brief Clear all statistics
38    ///
39    inline void reset(void) { map_.clear(); }
40
41    ///
42    ///
43    ///
44    inline u_int rows(void) const { return accumulated().back(); }
45
46    ///
47    /// @return resulting Stats
48    ///
49    Stats& operator+=(const Stats&);
50
51  private:
52    ///
53    /// Copy constructor (not implemented)
54    ///
55    Stats(const Stats& other);
56
57    ///
58    /// @return accumulated vector of total
59    ///
60    std::vector<u_int> accumulated(void) const;
61
62    ///
63    /// @return accumulated vector of stats_[user]
64    ///
65    std::vector<u_int> accumulated(const std::string& user) const;
66
67    ///
68    /// @brief adding a line to user from revision to the stats
69    ///
70    void add(const std::string& user, const u_int& revision); 
71
72    static u_int latest_revision_; // latest revision for whole project
73
74    // Peter, if the vector is sparse make it a map
75    typedef std::map<std::string, std::vector<u_int> > Map_;
76    typedef Map_::iterator MapIter_;
77    typedef Map_::const_iterator MapConstIter_;
78    Map_ map_;
79  };
80}} // end of namespace svnstat end of namespace theplu
81
82#endif
Note: See TracBrowser for help on using the repository browser.