The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
This FIFO uses locks to synchronize access. 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 *buf, unsigned count) |
read data from fifo. More... | |
mha_fifo_lw_t (unsigned max_fill_count) | |
Create FIFO with fixed buffer size. More... | |
virtual | ~mha_fifo_lw_t () |
release synchronization object More... | |
virtual void | set_error (unsigned index, MHA_Error *error) |
Process waiting for more data or space should bail out, throwing this error. More... | |
Public Member Functions inherited from mha_fifo_t< T > | |
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... | |
Private Attributes | |
mha_fifo_thread_platform_t * | sync |
platform specific thread synchronization More... | |
MHA_Error * | error [2] |
If waiting for synchronization should be aborted then exception to be thrown by reader process (index 0) or writer process (index 1) has to be placed here. More... | |
Additional Inherited Members | |
Public Types inherited from mha_fifo_t< T > | |
typedef std::vector< T >::value_type | value_type |
The data type exchanged by this fifo. More... | |
Protected Member Functions inherited from mha_fifo_t< T > | |
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... | |
This FIFO uses locks to synchronize access.
Reading and writing can block until the operation can be executed.
|
explicit |
Create FIFO with fixed buffer size.
|
virtual |
release synchronization object
|
virtual |
write specified ammount of data to the fifo.
If there is not enough space, then wait for more space.
data | Pointer to source data. |
count | Number of instances to copy. |
MHA_Error | when detecting a deadlock situation. |
Reimplemented from mha_fifo_t< T >.
|
virtual |
read data from fifo.
If there is not enough data, then wait for more data.
buf | Pointer to the target buffer. |
count | Number of instances to copy. |
MHA_Error | when detecting a deadlock situation. |
Reimplemented from mha_fifo_t< T >.
|
virtual |
Process waiting for more data or space should bail out, throwing this error.
index | Use 0 for terminating reader, 1 for terminating writer. |
error | MHA_Error to be thrown |
|
private |
platform specific thread synchronization
|
private |
If waiting for synchronization should be aborted then exception to be thrown by reader process (index 0) or writer process (index 1) has to be placed here.