foobar2000 SDK  2015-01-14
ptr_list.h
Go to the documentation of this file.
1 #ifndef __PFC_PTR_LIST_H_
2 #define __PFC_PTR_LIST_H_
3 
4 namespace pfc {
5 
6  template<class T, class B = list_t<T*> >
7  class ptr_list_t : public B
8  {
9  public:
11  ptr_list_t(const ptr_list_t<T> & p_source) {*this = p_source;}
12 
14  void free_all() {this->remove_all_ex(free);}
15  void free_mask(const bit_array & p_mask) {this->remove_mask_ex(p_mask,free);}
16 
17  void delete_item(T* ptr) {delete_by_idx(find_item(ptr));}
18 
19  void delete_by_idx(t_size p_index) {
20  delete_mask(bit_array_one(p_index));
21  }
22 
23  void delete_all() {
24  this->remove_all_ex(pfc::delete_t<T>);
25  }
26 
27  void delete_mask(const bit_array & p_mask) {
28  this->remove_mask_ex(p_mask,pfc::delete_t<T>);
29  }
30 
31  T * operator[](t_size n) const {return this->get_item(n);}
32  };
33 
34  template<typename T,t_size N>
35  class ptr_list_hybrid_t : public ptr_list_t<T,list_hybrid_t<T*,N> > {
36  public:
38  ptr_list_hybrid_t(const ptr_list_hybrid_t<T,N> & p_source) {*this = p_source;}
39  };
40 
42 
43  template<typename item, typename base> class traits_t<ptr_list_t<item, base> > : public traits_t<base> {};
44 }
45 
46 
47 #endif //__PFC_PTR_LIST_H_
void delete_mask(const bit_array &p_mask)
Definition: ptr_list.h:27
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
Definition: bit_array.h:6
void delete_all()
Definition: ptr_list.h:23
ptr_list_t(const ptr_list_t< T > &p_source)
Definition: ptr_list.h:11
void delete_item(T *ptr)
Definition: ptr_list.h:17
ptr_list_t< void > ptr_list
Definition: ptr_list.h:41
void free_mask(const bit_array &p_mask)
Definition: ptr_list.h:15
size_t t_size
Definition: int_types.h:48
ptr_list_hybrid_t(const ptr_list_hybrid_t< T, N > &p_source)
Definition: ptr_list.h:38
void free_by_idx(t_size n)
Definition: ptr_list.h:13
void free_all()
Definition: ptr_list.h:14
void delete_by_idx(t_size p_index)
Definition: ptr_list.h:19
T * operator[](t_size n) const
Definition: ptr_list.h:31