foobar2000 SDK  2015-01-14
bit_array_impl_part2.h
Go to the documentation of this file.
1 namespace pfc {
5  public:
7  bit_array_var_impl( const bit_array & source, size_t sourceCount);
8  bool get(t_size n) const;
9  t_size find(bool val,t_size start,t_ssize count) const;
10  void set(t_size n,bool val);
11  void set(t_size n) {m_data += n;}
12  void unset(t_size n) {m_data -= n;}
13  t_size get_true_count() const {return m_data.get_count();}
14  void clear() {m_data.remove_all();}
15  private:
17  };
18 
19 
24  public:
26 
27  void add( size_t n );
28 
29  bool get(t_size n) const;
30  t_size find(bool val,t_size start,t_ssize count) const;
31 
32  void presort();
33 
34  private:
35  bool _findNearestUp( size_t val, size_t & outIdx ) const;
36  bool _findNearestDown( size_t val, size_t & outIdx ) const;
37  bool _find( size_t val, size_t & outIdx ) const {
38  return pfc::bsearch_simple_inline_t( m_content, m_content.get_size(), val, outIdx);
39  }
40 
42  };
43 }
void set(t_size n, bool val)
Definition: bit_array.cpp:27
pfc::array_t< size_t, pfc::alloc_fast > m_content
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.cpp:13
t_size get_count() const
Definition: avltree.h:453
bool _findNearestUp(size_t val, size_t &outIdx) const
Definition: bit_array.cpp:63
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
Definition: bit_array.h:6
bool bsearch_simple_inline_t(const t_buffer &p_buffer, t_size p_count, t_value const &p_value, t_size &p_result)
bool _findNearestDown(size_t val, size_t &outIdx) const
Definition: bit_array.cpp:73
size_t t_size
Definition: int_types.h:48
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.cpp:45
avltree_t< t_size > m_data
Bit array interface class, variable version (you can both set and retrieve values). As with the constant version, valid index range depends on the context.
Definition: bit_array.h:40
bool _find(size_t val, size_t &outIdx) const
pfc::sized_int_t< sizeof(size_t) >::t_signed t_ssize
Definition: int_types.h:49
Generic variable bit array implementation. Not very efficient to handle lots of items set to true bu...
void remove_all()
Definition: avltree.h:435
Specialized implementation of bit_array. Indended for scenarios where fast searching for true values...