VLFeat.org

API docs

  • Home
    • Download and Install
    • API docs
    • Matlab docs
    • About VLFeat
  • Tutorials
    • SIFT
    • MSER
    • IKM
    • HIKM
    • AIB
    • Utils
  • Main Page
  • Related Pages
  • Data Structures
  • Files
  • Examples

generic.c

Go to the documentation of this file.
00001 
00006 /* AUTORIGHTS
00007 Copyright 2007 (c) Andrea Vedaldi and Brian Fulkerson
00008 
00009 This file is part of VLFeat, available in the terms of the GNU
00010 General Public License version 2.
00011 */
00012 
00220 #include "generic.h"
00221 
00222 #include <assert.h>
00223 #include <stdlib.h>
00224 #include <stdio.h>
00225 #include <math.h>
00226 
00227 VL_EXPORT int vl_err_no = 0 ;
00228 VL_EXPORT char vl_err_msg [VL_ERR_MSG_LEN + 1] = "" ;
00229 
00235 VL_EXPORT
00236 char const * vl_get_version_string ()
00237 {
00238   return VL_VERSION_STRING ;
00239 }
00240 
00246 VL_EXPORT
00247 void vl_print_info () 
00248 {
00249   VL_PRINTF ("VLFeat version %s\n", vl_get_version_string()) ;
00250   vl_print_host_info () ;
00251 }
00252 
00254 static int
00255 do_nothing_printf (char const* format, ...)
00256 {
00257   return 0 ;
00258 }
00259 
00261 void *(*vl_malloc_func)  (size_t)          = &malloc ;
00262                                             
00264 void *(*vl_realloc_func) (void*,size_t)    = &realloc ;
00265 
00267 void *(*vl_calloc_func)  (size_t, size_t) = &calloc ;
00268 
00270 void  (*vl_free_func)    (void*)            = &free ;
00271                                             
00273 int   (*vl_printf_func)  (char const *, ...)=  printf ; /* &do_nothing_printf ;*/
00274 
00324 VL_EXPORT
00325 void vl_set_alloc_func (void *(*malloc_func)  (size_t),
00326                         void *(*realloc_func) (void*, size_t),
00327                         void *(*calloc_func)  (size_t, size_t),
00328                         void  (*free_func)    (void*))
00329 {
00330   vl_malloc_func  = malloc_func ;
00331   vl_realloc_func = realloc_func ;
00332   vl_calloc_func  = calloc_func ;
00333   vl_free_func    = free_func ;
00334 }
00335 
00342 VL_EXPORT
00343 void 
00344 vl_set_printf_func (int(*printf_func) (char const *format, ...))
00345 {
00346   vl_printf_func  = printf_func ? printf_func : do_nothing_printf ;
00347 }
00348 
00349 clock_t tic_mark ; 
00355 void vl_tic() 
00356 {
00357   tic_mark = clock() ;
00358 }
00359 
00368 double vl_toc()
00369 {
00370   return (double) (clock() - tic_mark) / CLOCKS_PER_SEC ;
00371 }
00372 
Copyright © 2008 Andrea Vedaldi and Brian Fulkerson