Defines | Typedefs | Functions
core/vbl/vbl_qsort.h File Reference

Collection of common predicates for library sort routines. More...

#include <vxl_config.h>
#include <vcl_algorithm.h>
#include <vcl_functional.h>
#include <vcl_iostream.h>
#include <vcl_vector.h>
#include <vbl/vbl_sort.h>

Go to the source code of this file.

Defines

#define vbl_qsort_double_ascending   vbl_sort_double_ascending
#define vbl_qsort_double_descending   vbl_sort_double_descending
#define vbl_qsort_int_ascending   vbl_sort_int_ascending
#define vbl_qsort_int_descending   vbl_sort_int_descending
#define vbl_qsort_helper   vbl_sort_helper
#define VBL_QSORT_INSTANTIATE(T)
#define VBL_QSORT_INSTANTIATE_vector(T)

Typedefs

typedef int(* vbl_qsort_compare_t )(const void *a, const void *b)

Functions

template<class T >
void vbl_qsort_ascending (T *base, int n)
 Sort a C array into ascending order.
template<class T >
void vbl_qsort_descending (T *base, int n)
 Sort a C array into descending order.
template<class T >
void vbl_qsort_ascending (vcl_vector< T > &v)
 Sort an STL vector into ascending order.
template<class T >
void vbl_qsort_descending (vcl_vector< T > &v)
 Sort an STL vector into descending order.
template<class T >
void vbl_qsort (vcl_vector< T > &v, int(*compare)(T const &a, T const &b))
 Sort STL vector.

Detailed Description

Collection of common predicates for library sort routines.

Author:
awf@robots.ox.ac.uk
Date:
15 Mar 00
    Modifications
     971119 AWF Initial version
     PDA (Manchester) 23/03/2001: Tidied up the documentation
     Feb.2002 - Peter Vanroose - brief doxygen comment placed on single line
   

Definition in file vbl_qsort.h.


Define Documentation

#define vbl_qsort_double_ascending   vbl_sort_double_ascending

Definition at line 34 of file vbl_qsort.h.

#define vbl_qsort_double_descending   vbl_sort_double_descending

Definition at line 35 of file vbl_qsort.h.

#define vbl_qsort_helper   vbl_sort_helper

Definition at line 38 of file vbl_qsort.h.

#define VBL_QSORT_INSTANTIATE (   T)
Value:
VCL_INSTANTIATE_INLINE(void vbl_qsort_ascending(T*,int));\
VCL_INSTANTIATE_INLINE(void vbl_qsort_descending(T*,int))

Definition at line 113 of file vbl_qsort.h.

#define VBL_QSORT_INSTANTIATE_vector (   T)
Value:
VCL_INSTANTIATE_INLINE(void vbl_qsort(vcl_vector<T >& v, \
                        int (*compare)(T const& a, T const& b)))

Definition at line 117 of file vbl_qsort.h.

#define vbl_qsort_int_ascending   vbl_sort_int_ascending

Definition at line 36 of file vbl_qsort.h.

#define vbl_qsort_int_descending   vbl_sort_int_descending

Definition at line 37 of file vbl_qsort.h.


Typedef Documentation

typedef int(* vbl_qsort_compare_t)(const void *a, const void *b)

Definition at line 40 of file vbl_qsort.h.


Function Documentation

template<class T >
void vbl_qsort ( vcl_vector< T > &  v,
int(*)(T const &a, T const &b)  compare 
) [inline]

Sort STL vector.

Definition at line 103 of file vbl_qsort.h.

template<class T >
void vbl_qsort_ascending ( T *  base,
int  n 
) [inline]

Sort a C array into ascending order.

Do this using the standard comparison operations for T, namely operator> and operator==.

Definition at line 47 of file vbl_qsort.h.

template<class T >
void vbl_qsort_ascending ( vcl_vector< T > &  v) [inline]

Sort an STL vector into ascending order.

Do this using the standard comparison operations for T, namely operator> and operator==. I know STL has a sort, but this is easier, and faster in the 21st century.

Definition at line 76 of file vbl_qsort.h.

template<class T >
void vbl_qsort_descending ( T *  base,
int  n 
) [inline]

Sort a C array into descending order.

Do this using the standard comparison operations for T, namely "operator>" and "operator==".

Definition at line 61 of file vbl_qsort.h.

template<class T >
void vbl_qsort_descending ( vcl_vector< T > &  v) [inline]

Sort an STL vector into descending order.

Do this using the standard comparison operations for T, namely "operator>" and "operator==".

Definition at line 90 of file vbl_qsort.h.