Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Cache::swap_index ( int  i,
int  j 
)

Definition at line 136 of file svm.cpp.

References head, lru_delete(), lru_head, lru_insert(), Cache::head_t::next, size, and swap().

Referenced by ONE_CLASS_Q::swap_index(), and SVC_Q::swap_index().

00137 {
00138         if(i==j) return;
00139 
00140         if(head[i].len) lru_delete(&head[i]);
00141         if(head[j].len) lru_delete(&head[j]);
00142         std::swap(head[i].data,head[j].data);
00143         std::swap(head[i].len,head[j].len);
00144         if(head[i].len) lru_insert(&head[i]);
00145         if(head[j].len) lru_insert(&head[j]);
00146 
00147         if(i>j) std::swap(i,j);
00148         for(head_t *h = lru_head.next; h!=&lru_head; h=h->next)
00149         {
00150                 if(h->len > i)
00151                 {
00152                         if(h->len > j)
00153                                 std::swap(h->data[i],h->data[j]);
00154                         else
00155                         {
00156                                 // give up
00157                                 lru_delete(h);
00158                                 free(h->data);
00159                                 size += h->len;
00160                                 h->data = 0;
00161                                 h->len = 0;
00162                         }
00163                 }
00164         }
00165 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:31:56 2010 for ImpalaSrc by  doxygen 1.5.1