/*!
  Sorts the grasps in \a grl in quality order from highest to lowest,
  and deletes those grasps that have a quality < 0.
*/
void
grasp_tester::orderGraspListByQuality(std::list<plannedGrasp *> &grl) {

  if (grl.empty()) {
    return;
  }

#ifdef WIN32
  //the microsoft stl::list<T>.sort algorithm does not work the same
  //way as other stl implementations, so we sort by hand.
  sortGrasps(grl, grl.begin(), grl.end(), grl.size());
#else
  grl.sort(compareGraspQM());
#endif

  while ((!grl.empty()) && ((*grl.begin())->get_quality() <= 0.0)) {
    delete *(grl.begin());
    grl.pop_front();
  }
  grl.reverse();

#ifdef GRASPITDBG
  std::list<plannedGrasp *>::iterator it;
  for (it = grl.begin(); it != grl.end(); it++) {
    std::cout << "PL_OUT: QM " << (*it)->get_quality() << std::endl;
  }
#endif

}
Exemple #2
0
 ExportList()
 {
   data.push_back("/srv/test");
   data.push_back("/srv/test/tv");
   data.push_back("/");
   data.sort();
   data.reverse();
 }
Exemple #3
0
 inline static void run(std::list<T> &c, std::size_t) {
     c.reverse();
 }