void QsortRead(struct rIndex2 *array,uint64_t x, uint64_t y) { struct rIndex2 pivote, aux; uint64_t x1, y1; copyRead(&pivote, &array[(x+y)/2]); x1 = x; y1 = y; do{ while (strcmp(pivote.id, array[x1].id)>0) x1++; while (strcmp(pivote.id, array[y1].id)<0) y1--; if (x1 < y1) { copyRead(&aux,&array[x1]); copyRead(&array[x1], &array[y1]); copyRead(&array[y1], &aux); x1++; y1--; }else if (x1 == y1) x1++; } while (x1 <=y1); if (x<y1) QsortRead(array,x,y1); if (x1<y) QsortRead(array,x1,y); }
/** Read camera data. * * @return true if successful */ bool HiwrCameraControllerNodelet::read() { bool success = true; if(config_width_ < 1 || config_height_ < 1 ) return false; try { bool copy_worked = copyRead(); if(!copy_worked) return false; image_ipl_->imageData = (char *)final_; } catch (uvc_cam::Exception& e) { printf("exception readind data %s", e.what()); success = false; } return success; }