foobar2000 SDK  2015-08-03
Data Structures | Public Member Functions | Protected Member Functions | Private Types
pfc::list_base_t< T >abstract

#include <list.h>

+ Inheritance diagram for pfc::list_base_t< T >:

Data Structures

class  sort_callback
 
class  sort_callback_auto
 
class  sort_callback_impl_t
 

Public Member Functions

t_size add_item (const T &item)
 
t_size add_items (const list_base_const_t< T > &items)
 
t_size add_items_fromptr (const T *source, t_size num)
 
t_size add_items_repeat (T item, t_size num)
 
virtual void filter_mask (const bit_array &mask)=0
 
template<typename t_func >
void for_each (t_func p_func)
 
template<typename t_func >
void for_each (t_func p_func, const bit_array &p_mask)
 
t_size insert_item (const T &item, t_size base)
 
virtual t_size insert_items (const list_base_const_t< T > &items, t_size base)=0
 
t_size insert_items_fromptr (const T *source, t_size num, t_size base)
 
t_size insert_items_repeat (const T &item, t_size num, t_size base)
 
template<typename t_in >
t_selfoperator+= (t_in const &p_source)
 
template<typename t_in >
t_selfoperator= (t_in const &source)
 
T operator[] (t_size n) const
 
template<typename t_in >
t_selfoperator|= (t_in const &p_source)
 
void remove_all ()
 
template<typename t_releasefunc >
void remove_all_ex (t_releasefunc p_func)
 
template<typename t_compare >
void remove_duplicates_t (t_compare p_compare)
 
void remove_mask (const bit_array &mask)
 
template<typename t_releasefunc >
void remove_mask_ex (const bit_array &p_mask, t_releasefunc p_func)
 
void reorder (const t_size *p_data)
 
virtual void reorder_partial (t_size p_base, const t_size *p_data, t_size p_count)=0
 
virtual void replace_item (t_size p_index, const T &p_item)=0
 
T replace_item_ex (t_size p_index, const T &p_item)
 
virtual void sort (sort_callback &p_callback)=0
 
void sort ()
 
template<typename t_compare >
void sort_remove_duplicates_t (t_compare p_compare)
 
virtual void sort_stable (sort_callback &p_callback)=0
 
template<typename t_compare >
void sort_stable_remove_duplicates_t (t_compare p_compare)
 
template<typename t_compare >
void sort_stable_t (t_compare p_compare)
 
template<typename t_compare >
void sort_t (t_compare p_compare)
 
virtual void swap_item_with (t_size p_index, T &p_item)=0
 
virtual void swap_items (t_size p_index1, t_size p_index2)=0
 
void truncate (t_size val)
 
- Public Member Functions inherited from pfc::list_base_const_t< T >
template<typename t_compare , typename t_param , typename t_permutation >
bool bsearch_permutation_t (t_compare p_compare, t_param const &p_param, const t_permutation &p_permutation, t_size &p_index) const
 
template<typename t_compare , typename t_param >
bool bsearch_t (t_compare p_compare, t_param const &p_param, t_size &p_index) const
 
template<typename t_callback >
void enumerate (t_callback &p_callback) const
 
template<typename t_compare , typename t_permutation >
t_size find_duplicates_sorted_permutation_t (t_compare p_compare, t_permutation const &p_permutation, bit_array_var &p_out)
 
template<typename t_compare >
t_size find_duplicates_sorted_t (t_compare p_compare, bit_array_var &p_out) const
 
template<typename t_search >
t_size find_item (const t_search &p_item) const
 
virtual t_size get_count () const =0
 
T get_item (t_size n) const
 
virtual void get_item_ex (T &p_out, t_size n) const =0
 
t_size get_size () const
 
template<typename t_search >
bool have_item (const t_search &p_item) const
 
bool operator!= (const t_self &item2) const
 
bool operator== (const t_self &item2) const
 
T operator[] (t_size n) const
 
template<typename t_compare , typename t_permutation >
void sort_get_permutation_t (t_compare p_compare, t_permutation const &p_permutation) const
 
template<typename t_compare , typename t_permutation >
void sort_stable_get_permutation_t (t_compare p_compare, t_permutation const &p_permutation) const
 

Protected Member Functions

 list_base_t ()
 
 list_base_t (const t_self &)
 
 ~list_base_t ()
 
void operator= (const t_self &)
 
- Protected Member Functions inherited from pfc::list_base_const_t< T >
 list_base_const_t ()
 
 list_base_const_t (const t_self &)
 
 ~list_base_const_t ()
 
void operator= (const t_self &)
 

Private Types

typedef list_base_t< Tt_self
 
typedef const list_base_const_t< Tt_self_const
 

Additional Inherited Members

- Public Types inherited from pfc::list_base_const_t< T >
typedef T t_item
 
- Static Public Member Functions inherited from pfc::list_base_const_t< T >
static bool g_equals (const t_self &item1, const t_self &item2)
 

Detailed Description

template<typename T>
class pfc::list_base_t< T >

Definition at line 181 of file list.h.

Member Typedef Documentation

template<typename T>
typedef list_base_t<T> pfc::list_base_t< T >::t_self
private

Definition at line 183 of file list.h.

template<typename T>
typedef const list_base_const_t<T> pfc::list_base_t< T >::t_self_const
private

Definition at line 184 of file list.h.

Constructor & Destructor Documentation

template<typename T>
pfc::list_base_t< T >::list_base_t ( )
inlineprotected

Definition at line 297 of file list.h.

297 {}
template<typename T>
pfc::list_base_t< T >::~list_base_t ( )
inlineprotected

Definition at line 298 of file list.h.

298 {}
template<typename T>
pfc::list_base_t< T >::list_base_t ( const t_self )
inlineprotected

Definition at line 299 of file list.h.

299 {}

Member Function Documentation

template<typename T>
t_size pfc::list_base_t< T >::add_item ( const T item)
inline

Definition at line 210 of file list.h.

210 {return insert_item(item,~0);}
t_size insert_item(const T &item, t_size base)
Definition: list.h:203
template<typename T>
t_size pfc::list_base_t< T >::add_items ( const list_base_const_t< T > &  items)
inline

Definition at line 209 of file list.h.

209 {return insert_items(items,~0);}
virtual t_size insert_items(const list_base_const_t< T > &items, t_size base)=0
template<typename T>
t_size pfc::list_base_t< T >::add_items_fromptr ( const T source,
t_size  num 
)
inline

Definition at line 207 of file list.h.

207 {return insert_items_fromptr(source,num,~0);}
t_size insert_items_fromptr(const T *source, t_size num, t_size base)
Definition: list.h:206
template<typename T>
t_size pfc::list_base_t< T >::add_items_repeat ( T  item,
t_size  num 
)
inline

Definition at line 205 of file list.h.

205 {return insert_items_repeat(item,num,~0);}
t_size insert_items_repeat(const T &item, t_size num, t_size base)
Definition: list.h:204
template<typename T>
virtual void pfc::list_base_t< T >::filter_mask ( const bit_array mask)
pure virtual
template<typename T>
template<typename t_func >
void pfc::list_base_t< T >::for_each ( t_func  p_func)
inline

Definition at line 267 of file list.h.

267  {
268  t_size n,max=this->get_count();
269  for(n=0;n<max;n++) p_func(this->get_item(n));
270  }
size_t t_size
Definition: int_types.h:48
virtual t_size get_count() const =0
T get_item(t_size n) const
Definition: list.h:16
template<typename T>
template<typename t_func >
void pfc::list_base_t< T >::for_each ( t_func  p_func,
const bit_array p_mask 
)
inline

Definition at line 273 of file list.h.

273  {
274  t_size n,max=this->get_count();
275  for(n=p_mask.find(true,0,max);n<max;n=p_mask.find(true,n+1,max-n-1)) {
276  p_func(this->get_item(n));
277  }
278  }
virtual t_size find(bool val, t_size start, t_ssize count) const
Returns the first occurance of val between start and start+count (excluding start+count), or start+count if not found; count may be negative to search back rather than forward. Can be overridden by bit_array implementations for improved speed in specific cases.
Definition: bit_array.h:11
size_t t_size
Definition: int_types.h:48
virtual t_size get_count() const =0
T get_item(t_size n) const
Definition: list.h:16
template<typename T>
t_size pfc::list_base_t< T >::insert_item ( const T item,
t_size  base 
)
inline

Definition at line 203 of file list.h.

203 {return insert_items(list_single_ref_t<T>(item),base);}
virtual t_size insert_items(const list_base_const_t< T > &items, t_size base)=0
template<typename T>
virtual t_size pfc::list_base_t< T >::insert_items ( const list_base_const_t< T > &  items,
t_size  base 
)
pure virtual
template<typename T>
t_size pfc::list_base_t< T >::insert_items_fromptr ( const T source,
t_size  num,
t_size  base 
)
inline

Definition at line 206 of file list.h.

206 {return insert_items(list_const_ptr_t<T>(source,num),base);}
virtual t_size insert_items(const list_base_const_t< T > &items, t_size base)=0
template<typename T>
t_size pfc::list_base_t< T >::insert_items_repeat ( const T item,
t_size  num,
t_size  base 
)
inline

Definition at line 204 of file list.h.

204 {return insert_items(list_single_ref_t<T>(item,num),base);}
virtual t_size insert_items(const list_base_const_t< T > &items, t_size base)=0
template<typename T>
template<typename t_in >
t_self& pfc::list_base_t< T >::operator+= ( t_in const &  p_source)
inline

Definition at line 293 of file list.h.

293 {add_item(p_source); return *this;}
t_size add_item(const T &item)
Definition: list.h:210
template<typename T>
template<typename t_in >
t_self& pfc::list_base_t< T >::operator= ( t_in const &  source)
inline

Definition at line 292 of file list.h.

292 {remove_all(); add_items(source); return *this;}
void remove_all()
Definition: list.h:213
t_size add_items(const list_base_const_t< T > &items)
Definition: list.h:209
template<typename T>
void pfc::list_base_t< T >::operator= ( const t_self )
inlineprotected

Definition at line 300 of file list.h.

300 {}
template<typename T>
T pfc::list_base_t< T >::operator[] ( t_size  n) const
inline

Definition at line 218 of file list.h.

218 {return this->get_item(n);}
T get_item(t_size n) const
Definition: list.h:16
template<typename T>
template<typename t_in >
t_self& pfc::list_base_t< T >::operator|= ( t_in const &  p_source)
inline

Definition at line 294 of file list.h.

294 {add_items(p_source); return *this;}
t_size add_items(const list_base_const_t< T > &items)
Definition: list.h:209
template<typename T>
void pfc::list_base_t< T >::remove_all ( )
inline

Definition at line 213 of file list.h.

virtual void filter_mask(const bit_array &mask)=0
template<typename T>
template<typename t_releasefunc >
void pfc::list_base_t< T >::remove_all_ex ( t_releasefunc  p_func)
inline

Definition at line 287 of file list.h.

287  {
288  this->template for_each<t_releasefunc>(p_func);
289  remove_all();
290  }
void remove_all()
Definition: list.h:213
template<typename T>
template<typename t_compare >
void pfc::list_base_t< T >::remove_duplicates_t ( t_compare  p_compare)
inline

Definition at line 257 of file list.h.

258  {
259  order_helper order(this->get_count());
260  sort_get_permutation_t<t_compare,order_helper&>(p_compare,order);
261  bit_array_bittable array(this->get_count());
262  if (this->template find_duplicates_sorted_permutation_t<t_compare,order_helper const&>(p_compare,order,array) > 0)
263  remove_mask(array);
264  }
Generic variable bit_array implementation. Needs to be initialized with requested array size before ...
void remove_mask(const bit_array &mask)
Definition: list.h:212
virtual t_size get_count() const =0
template<typename T>
void pfc::list_base_t< T >::remove_mask ( const bit_array mask)
inline

Definition at line 212 of file list.h.

212 {filter_mask(bit_array_not(mask));}
Negation of another array. Valid index range is the same as valid index range of the parameter array...
virtual void filter_mask(const bit_array &mask)=0
template<typename T>
template<typename t_releasefunc >
void pfc::list_base_t< T >::remove_mask_ex ( const bit_array p_mask,
t_releasefunc  p_func 
)
inline

Definition at line 281 of file list.h.

281  {
282  this->template for_each<t_releasefunc>(p_func,p_mask);
283  remove_mask(p_mask);
284  }
void remove_mask(const bit_array &mask)
Definition: list.h:212
template<typename T>
void pfc::list_base_t< T >::reorder ( const t_size p_data)
inline

Definition at line 201 of file list.h.

201 {reorder_partial(0,p_data,this->get_count());}
virtual t_size get_count() const =0
virtual void reorder_partial(t_size p_base, const t_size *p_data, t_size p_count)=0
template<typename T>
virtual void pfc::list_base_t< T >::reorder_partial ( t_size  p_base,
const t_size p_data,
t_size  p_count 
)
pure virtual
template<typename T>
virtual void pfc::list_base_t< T >::replace_item ( t_size  p_index,
const T p_item 
)
pure virtual
template<typename T>
T pfc::list_base_t< T >::replace_item_ex ( t_size  p_index,
const T p_item 
)
inline

Definition at line 216 of file list.h.

216 {T ret = p_item;swap_item_with(p_index,ret);return ret;}
virtual void swap_item_with(t_size p_index, T &p_item)=0
template<typename T>
virtual void pfc::list_base_t< T >::sort ( sort_callback p_callback)
pure virtual
template<typename T>
void pfc::list_base_t< T >::sort ( )
inline

Definition at line 236 of file list.h.

236 {sort(sort_callback_auto());}
void sort()
Definition: list.h:236
template<typename T>
template<typename t_compare >
void pfc::list_base_t< T >::sort_remove_duplicates_t ( t_compare  p_compare)
inline

Definition at line 240 of file list.h.

241  {
242  sort_t<t_compare>(p_compare);
243  bit_array_bittable array(this->get_count());
244  if (this->template find_duplicates_sorted_t<t_compare>(p_compare,array) > 0)
245  remove_mask(array);
246  }
Generic variable bit_array implementation. Needs to be initialized with requested array size before ...
void remove_mask(const bit_array &mask)
Definition: list.h:212
virtual t_size get_count() const =0
template<typename T>
virtual void pfc::list_base_t< T >::sort_stable ( sort_callback p_callback)
pure virtual
template<typename T>
template<typename t_compare >
void pfc::list_base_t< T >::sort_stable_remove_duplicates_t ( t_compare  p_compare)
inline

Definition at line 248 of file list.h.

249  {
250  sort_stable_t<t_compare>(p_compare);
251  bit_array_bittable array(this->get_count());
252  if (this->template find_duplicates_sorted_t<t_compare>(p_compare,array) > 0)
253  remove_mask(array);
254  }
Generic variable bit_array implementation. Needs to be initialized with requested array size before ...
void remove_mask(const bit_array &mask)
Definition: list.h:212
virtual t_size get_count() const =0
template<typename T>
template<typename t_compare >
void pfc::list_base_t< T >::sort_stable_t ( t_compare  p_compare)
inline

Definition at line 238 of file list.h.

238 {sort_stable(sort_callback_impl_t<t_compare>(p_compare));}
virtual void sort_stable(sort_callback &p_callback)=0
template<typename T>
template<typename t_compare >
void pfc::list_base_t< T >::sort_t ( t_compare  p_compare)
inline

Definition at line 237 of file list.h.

237 {sort(sort_callback_impl_t<t_compare>(p_compare));}
void sort()
Definition: list.h:236
template<typename T>
virtual void pfc::list_base_t< T >::swap_item_with ( t_size  p_index,
T p_item 
)
pure virtual
template<typename T>
virtual void pfc::list_base_t< T >::swap_items ( t_size  p_index1,
t_size  p_index2 
)
pure virtual
template<typename T>
void pfc::list_base_t< T >::truncate ( t_size  val)
inline

Definition at line 214 of file list.h.

214 {if (val < this->get_count()) remove_mask(bit_array_range(val,this->get_count()-val,true));}
void remove_mask(const bit_array &mask)
Definition: list.h:212
virtual t_size get_count() const =0

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