![]()  | 
  
    The Open Master Hearing Aid (openMHA)
    openMHA
    
   Open community platform for hearing aid algorithm research 
   | 
 
A FIFO class. More...

Public Types | |
| typedef std::vector< T >::value_type | value_type | 
| The data type exchanged by this fifo.  More... | |
Public Member Functions | |
| virtual void | write (const T *data, unsigned count) | 
| write specified ammount of data to the fifo.  More... | |
| virtual void | read (T *outbuf, unsigned count) | 
| read data from fifo  More... | |
| virtual unsigned | get_fill_count () const | 
| Read-only access to fill_count.  More... | |
| virtual unsigned | get_available_space () const | 
| Read-only access to available_space.  More... | |
| virtual unsigned | get_max_fill_count () const | 
| The capacity of this fifo.  More... | |
| mha_fifo_t (unsigned max_fill_count, const T &t=T()) | |
| Create FIFO with fixed buffer size, where all (initially unused) instances of T are initialized as copies of t.  More... | |
| virtual | ~mha_fifo_t ()=default | 
| Make destructor virtual.  More... | |
| mha_fifo_t (const mha_fifo_t &)=delete | |
| Copy constructor.  More... | |
| mha_fifo_t (mha_fifo_t &&)=delete | |
| Move constructor.  More... | |
| mha_fifo_t< T > & | operator= (const mha_fifo_t< T > &)=delete | 
| Assignment operator.  More... | |
| mha_fifo_t< T > & | operator= (mha_fifo_t< T > &&)=delete | 
| Move assignment operator.  More... | |
Protected Member Functions | |
| void | clear () | 
| Empty the fifo at once.  More... | |
| const T * | get_write_ptr () const | 
| read-only access to the write pointer for derived classes  More... | |
| const T * | get_read_ptr () const | 
| read-only access to read pointer for derived classes  More... | |
| unsigned | get_fill_count (const T *wp, const T *rp) const | 
| Compute fill count from given write pointer and read pointer.  More... | |
Private Attributes | |
| std::vector< T > | buf | 
| The memory allocated to store the data in the fifo.  More... | |
| T * | write_ptr | 
| points to location where to write next  More... | |
| const T * | read_ptr | 
| points to location where to read next  More... | |
A FIFO class.
Synchronization: None. Use external synchronisation or synchronization in inheriting class. Assignment, copy and move constructors are disabled.
| typedef std::vector<T>::value_type mha_fifo_t< T >::value_type | 
The data type exchanged by this fifo.
      
  | 
  explicit | 
Create FIFO with fixed buffer size, where all (initially unused) instances of T are initialized as copies of t.
| max_fill_count | The maximum number of instances of T that can be held at the same time inside the fifo. | 
| The | fifo allocates a vector of max_fill_count+1 instances of T for storage, one of which is always unused. | 
      
  | 
  virtualdefault | 
Make destructor virtual.
      
  | 
  delete | 
Copy constructor.
      
  | 
  delete | 
Move constructor.
      
  | 
  virtual | 
write specified ammount of data to the fifo.
| data | Pointer to source data. | 
| count | Number of instances to copy | 
| MHA_Error | when there is not enough space available. | 
Reimplemented in mha_fifo_lf_t< T >, mha_fifo_lw_t< T >, and mha_drifter_fifo_t< T >.
      
  | 
  virtual | 
read data from fifo
| outbuf | Pointer to the target buffer. | 
| count | Number of instances to copy. | 
| MHA_Error | when there is not enough data available. | 
Reimplemented in mha_fifo_lf_t< T >, mha_fifo_lw_t< T >, and mha_drifter_fifo_t< T >.
      
  | 
  inlinevirtual | 
Read-only access to fill_count.
Reimplemented in mha_fifo_lf_t< T >, mha_fifo_lf_t< mha_real_t >, mha_fifo_lf_t< MHA_AC::acspace2matrix_t >, and mha_drifter_fifo_t< T >.
      
  | 
  virtual | 
Read-only access to available_space.
Reimplemented in mha_fifo_lf_t< T >, mha_fifo_lf_t< mha_real_t >, mha_fifo_lf_t< MHA_AC::acspace2matrix_t >, and mha_drifter_fifo_t< T >.
      
  | 
  inlinevirtual | 
The capacity of this fifo.
      
  | 
  delete | 
Assignment operator.
      
  | 
  delete | 
Move assignment operator.
      
  | 
  inlineprotected | 
Empty the fifo at once.
Should be called by the reader, or when the reader is inactive.
      
  | 
  inlineprotected | 
read-only access to the write pointer for derived classes
      
  | 
  inlineprotected | 
read-only access to read pointer for derived classes
      
  | 
  inlineprotected | 
Compute fill count from given write pointer and read pointer.
| wp | Write pointer. | 
| rp | Read pointer. | 
      
  | 
  private | 
The memory allocated to store the data in the fifo.
At least one location in buf is always unused, because we have max_fill_count + 1 possible fillcounts [0:max_fill_count] that we need to distinguish.
      
  | 
  private | 
points to location where to write next
      
  | 
  private | 
points to location where to read next