00001
00023
00024
00025 #ifndef _eoSelectNumber_h
00026 #define _eoSelectNumber_h
00027
00028
00029
00030 #include <eoSelect.h>
00031 #include <eoSelectOne.h>
00032 #include <math.h>
00033
00034
00041 template<class EOT>
00042 class eoSelectNumber : public eoSelect<EOT>
00043 {
00044 public:
00046 eoSelectNumber(eoSelectOne<EOT>& _select, unsigned _nb_to_select = 1)
00047 : select(_select), nb_to_select(_nb_to_select) {}
00048
00055 virtual void operator()(const eoPop<EOT>& _source, eoPop<EOT>& _dest)
00056 {
00057 size_t target = static_cast<size_t>(nb_to_select);
00058
00059 _dest.resize(target);
00060
00061 select.setup(_source);
00062
00063 for (size_t i = 0; i < _dest.size(); ++i)
00064 _dest[i] = select(_source);
00065 }
00066
00067 private :
00068 eoSelectOne<EOT>& select;
00069 unsigned nb_to_select;
00070 };
00071
00072 #endif