Changeset 23 for trunk/lib/Stats.cc
- Timestamp:
- Jan 2, 2006, 9:14:57 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Stats.cc
r14 r23 7 7 #include <numeric> 8 8 #include <string> 9 #include <utility> 9 10 #include <vector> 11 12 #include <iostream> 10 13 11 14 namespace theplu{ … … 59 62 } 60 63 64 void Stats::print(std::ostream& os) const 65 { 66 std::vector<std::pair<std::string, std::vector<u_int> > > accum; 67 for (MapConstIter_ i= map_.begin(); i != map_.end(); i++){ 68 std::pair<std::string, std::vector<u_int> > element(*i); 69 std::partial_sum(element.second.begin(),element.second.end(), 70 element.second.begin()); 71 accum.push_back(element); 72 } 73 sort(accum.begin(),accum.end(), CodingMore()); 74 os << "<table>\n"; 75 for (size_t i = 0; i<accum.size(); i++){ 76 os << "<tr><td>\n" << accum[i].first << "</td><td>" 77 << accum[i].second.back() << "</td></tr>"; 78 } 79 os << "</table>\n"; 80 81 os << "<p>[Plot to be here.]</p>\n"; 82 } 83 61 84 Stats& Stats::operator+=(const Stats& other) 62 85 { 63 for ( _MapConstIto_i= other.map_.begin(); o_i != other.map_.end(); ++o_i)86 for (MapConstIter_ o_i= other.map_.begin(); o_i != other.map_.end(); ++o_i) 64 87 { 65 std::pair< _MapIt,bool> result = map_.insert(*o_i);88 std::pair<MapIter_,bool> result = map_.insert(*o_i); 66 89 if (!result.second) 67 map_[(*(result.first)).first] =68 90 map_[(*(result.first)).first] = 91 VectorPlus<u_int>()( (*(result.first)).second, (*o_i).second ); 69 92 70 93 }
Note: See TracChangeset
for help on using the changeset viewer.