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

int Cache::get_data ( const int  index,
Qfloat **  data,
int  len 
)

Definition at line 106 of file svm.cpp.

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

Referenced by SVR_Q::get_Q(), ONE_CLASS_Q::get_Q(), and SVC_Q::get_Q().

00107 {
00108         head_t *h = &head[index];
00109         if(h->len) lru_delete(h);
00110         int more = len - h->len;
00111 
00112         if(more > 0)
00113         {
00114                 // free old space
00115                 while(size < more)
00116                 {
00117                         head_t *old = lru_head.next;
00118                         lru_delete(old);
00119                         free(old->data);
00120                         size += old->len;
00121                         old->data = 0;
00122                         old->len = 0;
00123                 }
00124 
00125                 // allocate new space
00126                 h->data = (Qfloat *)realloc(h->data,sizeof(Qfloat)*len);
00127                 size -= more;
00128                 std::swap(h->len,len);
00129         }
00130 
00131         lru_insert(h);
00132         *data = h->data;
00133         return len;
00134 }

Here is the call graph for this function:


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