/**************************************/
/* DESCRIPTION */

// The round buffer can be used to buffer a stream of bytes. It functions
// essentially as a queue. The first data you write to the round
// buffer is the first data you read. It is important that you check if enough
// data/space is available in the buffer before you attempt a read/write.


/*******************************************/
/* INCLUDES */

#ifndef __ROUND_BUF_H__
#define __ROUND_BUF_H__
#include "util.h"


/*******************************************/
/* DEFINES AND ENUM */


/*******************************************/
/* PROTOTYPES */

class round_buf {
  public:

    char *buf;
    int alloc_size;
    int read_index;
    int write_index;

     round_buf::round_buf();
     round_buf::round_buf(int buf_size);
     round_buf::~round_buf();
     round_buf::round_buf(round_buf & other);
     round_buf & round_buf::operator=(round_buf & other);
    int round_buf::size();
    void round_buf::set_size(int new_size);
    void round_buf::clean_up();
    bool round_buf::is_empty();
    bool round_buf::is_full();
    int round_buf::avail_size();
    int round_buf::used_size();
    void round_buf::seek(int pos);
    void round_buf::internal_read_buf(char *data_buf, int data_buf_size,
				      int *local_index_ptr);
    void round_buf::read_buf(char *data_buf, int data_buf_size);
    void round_buf::peek_buf(char *data_buf, int data_buf_size);
    void round_buf::write_buf(char *data_buf, int data_buf_size);
};


#endif
