/*!
 * \file deque08.h
 * \brief
 *    This file provides double ended queue capability based on a ring buffer
 *
 * Author: Christos Choutouridis AEM: 8997
 * email : <cchoutou@ece.auth.gr>
 *
 */
#ifndef  __deque08_h__
#define  __deque08_h__

#ifdef __cplusplus
extern "C" {
#endif

#include "driver_types.h"
#include <string.h>

typedef struct {
   byte_t      *m;         /*!< pointer to queue's buffer */
   iterator_t  capacity;   /*!< queue's max item capacity */
   iterator_t  items;      /*!< current item count */
   iterator_t  f, r;       /*!< queue iterators */
}deque08_t;


/*
 *  ============= PUBLIC EE API =============
 */

/*
 * Link and Glue functions
 */
void deque08_link_buffer (deque08_t *q, byte_t* buf);

/*
 * Set functions
 */
void deque08_set_capacity (deque08_t *q, size_t capacity);

/*
 * User Functions
 */
int  deque08_is_full (deque08_t *q);
int  deque08_is_empty (deque08_t *q);
int  deque08_size  (deque08_t *q);
void deque08_flush (deque08_t *q);

void deque08_init (deque08_t *q);
int  deque08_push_front (deque08_t *q, byte_t b);
int  deque08_pop_front (deque08_t *q, byte_t *b);
int  deque08_push_back (deque08_t *q, byte_t b);
int  deque08_pop_back (deque08_t *q, byte_t *b);

int  deque08_back (deque08_t *q, byte_t *b);
int  deque08_front (deque08_t *q, byte_t *b);


#ifdef __cplusplus
}
#endif


#endif //#ifndef  __deque08_h__
