foobar2000 SDK  2015-08-03
Public Member Functions | Private Attributes
pfc::sort_callback_stabilizer

#include <sort.h>

+ Inheritance diagram for pfc::sort_callback_stabilizer:

Public Member Functions

 sort_callback_stabilizer (sort_callback &p_chain, t_size p_count)
 
virtual int compare (t_size p_index1, t_size p_index2) const
 
virtual void swap (t_size p_index1, t_size p_index2)
 
- Public Member Functions inherited from pfc::sort_callback
void swap_check (t_size p_index1, t_size p_index2)
 

Private Attributes

sort_callbackm_chain
 
array_t< t_sizem_order
 

Detailed Description

Definition at line 87 of file sort.h.

Constructor & Destructor Documentation

pfc::sort_callback_stabilizer::sort_callback_stabilizer ( sort_callback p_chain,
t_size  p_count 
)

Definition at line 239 of file sort.cpp.

240 : m_chain(p_chain)
241 {
242  m_order.set_size(p_count);
243  t_size n;
244  for(n=0;n<p_count;n++) m_order[n] = n;
245 }
size_t t_size
Definition: int_types.h:48
void set_size(t_size p_size)
Definition: array.h:104
sort_callback & m_chain
Definition: sort.h:94
array_t< t_size > m_order
Definition: sort.h:95

Member Function Documentation

int pfc::sort_callback_stabilizer::compare ( t_size  p_index1,
t_size  p_index2 
) const
virtual

Implements pfc::sort_callback.

Definition at line 247 of file sort.cpp.

248 {
249  int ret = m_chain.compare(p_index1,p_index2);
250  if (ret == 0) ret = pfc::sgn_t((t_ssize)m_order[p_index1] - (t_ssize)m_order[p_index2]);
251  return ret;
252 }
int sgn_t(const T &p_val)
Definition: primitives.h:669
virtual int compare(t_size p_index1, t_size p_index2) const =0
sort_callback & m_chain
Definition: sort.h:94
pfc::sized_int_t< sizeof(size_t) >::t_signed t_ssize
Definition: int_types.h:49
array_t< t_size > m_order
Definition: sort.h:95
void pfc::sort_callback_stabilizer::swap ( t_size  p_index1,
t_size  p_index2 
)
virtual

Implements pfc::sort_callback.

Definition at line 254 of file sort.cpp.

255 {
256  m_chain.swap(p_index1,p_index2);
257  pfc::swap_t(m_order[p_index1],m_order[p_index2]);
258 }
sort_callback & m_chain
Definition: sort.h:94
virtual void swap(t_size p_index1, t_size p_index2)=0
void swap_t(T &p_item1, T &p_item2)
Definition: primitives.h:285
array_t< t_size > m_order
Definition: sort.h:95

Field Documentation

sort_callback& pfc::sort_callback_stabilizer::m_chain
private

Definition at line 94 of file sort.h.

array_t<t_size> pfc::sort_callback_stabilizer::m_order
private

Definition at line 95 of file sort.h.


The documentation for this class was generated from the following files: