source: trunk/lib/StatsPlotter.h @ 1290

Last change on this file since 1290 was 1290, checked in by Peter Johansson, 11 years ago

closes #457. Lifting out plotting functions in Stats into a new class
StatsPlotter?. In same manner lifting out print functions from
Node/Directory/File? into a new hierarchy
NodePrinter/DirectoryPrinter/FilePrinter?. To accomplish these splits
without to much recoding some friendships are introduced. These new
classes are only needed for svndigest (not svncopyright) and are
therefore placed in a library named libsvndigest together with Graph
class and first_page functions. Remaining functionality, shared
between svncopyright and svndigest, are located in libsvndigest_core
and linked into both binaries.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1#ifndef _theplu_svndigest_stats_plotter_
2#define _theplu_svndigest_stats_plotter_
3
4// $Id: StatsPlotter.h 1290 2010-11-12 04:01:35Z peter $
5
6/*
7  Copyright (C) 2005 Peter Johansson
8  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2010 Peter Johansson
10
11  This file is part of svndigest, http://dev.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 3 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 svndigest. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27#include "Vector.h"
28
29#include <string>
30#include <map>
31
32namespace theplu {
33namespace svndigest {
34
35  class Stats;
36
37  /**
38     Class plotting a Stats object
39  */
40  class StatsPlotter
41  {
42  public:
43    /**
44        \brief Default Constructor
45    */
46    explicit StatsPlotter(const Stats& stats);
47
48    /**
49       \brief Destructor
50    */
51    virtual ~StatsPlotter(void);
52
53    /**
54       Create statistics graph.
55    */
56    std::string plot(const std::string&, const std::string&) const;
57
58    /**
59       Plotting code, comment, other, and total in same plot (for
60       'all' not individual authors).
61    */
62    void plot_summary(const std::string& output) const;
63
64  private:
65    typedef std::map<std::string, SumVector> Author2Vector;
66    const Stats& stats_;
67
68    /**
69       called from plot(2)
70     */
71    void plot(const std::string& basename, const std::string& linetype,
72              const std::string& format) const;
73
74    /**
75       called from plot_summary(1)
76     */
77    void plot_summary(const std::string& basename, 
78                      const std::string& format) const;
79
80  };
81}} // end of namespace svndigest end of namespace theplu
82
83#endif
Note: See TracBrowser for help on using the repository browser.