Ignore:
Timestamp:
Dec 25, 2007, 11:23:04 AM (14 years ago)
Author:
Peter Johansson
Message:

fixes #280 - keep on refactoring of Stats class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/ClassicStats.h

    r519 r528  
    4343    explicit ClassicStats(const std::string& path);
    4444
    45     ///
    46     ///
    47     ///
    48     inline u_int code(void) const { return accumulated(code_).back(); }
    49 
    50     ///
    51     ///
    52     ///
    53     inline u_int code(const std::string& user) const
    54     { return accumulated(code_, user).back(); }
    55 
    56     ///
    57     ///
    58     ///
    59     inline u_int comments(void) const { return accumulated(comments_).back(); }
    60 
    61     ///
    62     ///
    63     ///
    64     inline u_int comments(const std::string& user) const
    65     { return accumulated(comments_, user).back(); }
    66 
    67     ///
    68     ///
    69     ///
    70     inline u_int empty(void) const { return accumulated(empty_).back(); }
    71 
    72     ///
    73     ///
    74     ///
    75     inline u_int empty(const std::string& user) const
    76     { return accumulated(empty_, user).back(); }
    77 
    78     ///
    79     ///
    80     ///
    81     inline u_int lines(void) const { return accumulated(total_).back(); }
    82 
    83     ///
    84     ///
    85     ///
    86     inline u_int lines(const std::string& user) const
    87     { return accumulated(total_, user).back(); }
     45    ClassicStats(const ClassicStats& other);
    8846
    8947    ///
     
    9250    void plot_summary(const std::string& output) const;
    9351
    94     ///
    95     ///
    96     ///
    97     inline std::vector<u_int> total(const std::string& user) const
    98     { return accumulated(total_, user); }
    99 
    100     ///
    101     /// @return resulting Stats
    102     ///
    103     ClassicStats& operator+=(const ClassicStats&);
    104 
    10552  private:
    106     // Peter, if the vector is sparse make it a map
    107     typedef std::map<std::string, std::vector<u_int> > Map_;
    108     typedef Map_::iterator MapIter_;
    109     typedef Map_::const_iterator MapConstIter_;
    110 
    11153    /// using compiler generated copy
    112     //ClassicStats(const ClassicStats& other);
    113 
    114     ///
    115     /// @return accumulated vector of total
    116     ///
    117     std::vector<u_int> accumulated(const Map_&) const;
    118 
    119     ///
    120     /// @return accumulated vector of stats_[user]
    121     ///
    122     std::vector<u_int> accumulated(const Map_&,
    123                                    const std::string& user) const;
    12454
    12555    ///
     
    14777    void do_print(std::ostream&) const;
    14878
    149     ///
    150     /// @brief Clear all statistics
    151     ///
    152     inline void do_reset(void)
    153     {
    154       code_.clear(); comments_.clear(); empty_.clear(); total_.clear();
    155     }
    156 
    15779    // Change this string if cache format is changed in such a way
    15880    // that all old cache files are obsolete.
     
    16587       Load map from stream
    16688     */
    167     void load(std::istream&, Map_&);
     89    void load(std::istream&, Author2Vector&);
    16890
    169     void do_print(std::ostream& os, const Map_& map) const;
     91    void do_print(std::ostream& os, const Author2Vector& map) const;
    17092
    171     Map_ code_;
    172     Map_ comments_;
    173     Map_ empty_;
    174     Map_ total_;
    17593  };
    17694}} // end of namespace svndigest end of namespace theplu
Note: See TracChangeset for help on using the changeset viewer.