The Tooba
 All Data Structures Namespaces Files Functions Variables Macros Pages
Public Member Functions | Private Member Functions | Private Attributes
Queue Class Reference

#include <queue.h>

Public Member Functions

 Queue ()
 
uint8_t read (uint32_t *x)
 
uint8_t write (uint32_t x)
 

Private Member Functions

int size (void)
 
int empty (void)
 
int full (void)
 

Private Attributes

int wpointer
 
int rpointer
 
uint32_t buffer [BUFSIZE]
 

Detailed Description

A queue containing unsigned 32-bit samples. WARNING: This class provides NO protection against interrupts. That must be done by the user:

void example_usage(void) {
uint8_t r;
uint32_t x;
x = next_audio_sample;
cli();
r = queue.write(x);
sei();
// handle case where r != 0
}

Internal implementation is a fixed-size circular buffer.

Definition at line 28 of file queue.h.

Constructor & Destructor Documentation

Queue::Queue ( )
inline

Definition at line 42 of file queue.h.

Member Function Documentation

int Queue::empty ( void  )
inlineprivate

Definition at line 35 of file queue.h.

Referenced by read().

Here is the call graph for this function:

Here is the caller graph for this function:

int Queue::full ( void  )
inlineprivate

Definition at line 38 of file queue.h.

Referenced by write().

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t Queue::read ( uint32_t *  x)
inline

Read a sample from the queue.

Parameters
xa pointer to the variable to store the sample in
Returns
0 if read is successful, 1 if queue is empty.

Definition at line 50 of file queue.h.

Referenced by main(), and timer_interrupt().

Here is the call graph for this function:

Here is the caller graph for this function:

int Queue::size ( void  )
inlineprivate

Definition at line 32 of file queue.h.

Referenced by empty(), and full().

Here is the caller graph for this function:

uint8_t Queue::write ( uint32_t  x)
inline

Write a sample to the queue.

Parameters
xthe sample to be written
Returns
0 if write is successful, 1 if queue is full.

Definition at line 61 of file queue.h.

Referenced by compute_sample().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

uint32_t Queue::buffer[BUFSIZE]
private

Definition at line 31 of file queue.h.

int Queue::rpointer
private

Definition at line 30 of file queue.h.

Referenced by read().

int Queue::wpointer
private

Definition at line 30 of file queue.h.

Referenced by write().


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