00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00035 #ifndef _eoPopStat_h
00036 #define _eoPopStat_h
00037
00038 #include <utils/eoStat.h>
00039
00040
00050 template <class EOT>
00051 class eoPopStat : public eoStat<EOT, std::string>
00052 {
00053 public:
00054
00055 using eoStat<EOT, std::string>::value;
00056
00061 eoPopStat(unsigned _howMany = 0, std::string _desc ="")
00062 : eoStat<EOT, std::string>("", _desc), combien( _howMany) {}
00063
00068 void operator()(const eoPop<EOT>& _pop)
00069 {
00070 value() = "\n# ====== pop dump =====\n";
00071 unsigned howmany=combien?combien:_pop.size();
00072 for (unsigned i = 0; i < howmany; ++i)
00073 {
00074 std::ostringstream os;
00075 os << _pop[i] << std::endl;
00076
00077
00078 value() += os.str();
00079 }
00080 }
00081
00082 private:
00083 unsigned combien;
00084 };
00085
00095 template <class EOT>
00096 class eoSortedPopStat : public eoSortedStat<EOT, std::string>
00097 {
00098 public:
00099
00100 using eoSortedStat<EOT, std::string>::value;
00101
00107 eoSortedPopStat(unsigned _howMany = 0, std::string _desc ="")
00108 : eoSortedStat<EOT, std::string>("", _desc) , combien( _howMany)
00109 {}
00110
00116 void operator()(const std::vector<const EOT*>& _pop)
00117 {
00118 value() = "";
00119 unsigned howMany=combien?combien:_pop.size();
00120 for (unsigned i = 0; i < howMany; ++i)
00121 {
00122 std::ostringstream os;
00123 os << *_pop[i] << std::endl;
00124
00125
00126 value() += os.str();
00127 }
00128 }
00129 private:
00130 unsigned combien;
00131 };
00132
00133 #endif