/* ----------------------------------------------------------
buffer.h by biscuit@actoz.com
for Linux 2.6.x
v1.0 06/24/2004 first release
---------------------------------------------------------- */
#ifndef __BUFFER_H__
#define __BUFFER_H__
using namespace std;
class TBinQueue
{
protected :
char *buf;
int head, tail;
public :
int maxsize;
TBinQueue(const int lmaxsize) : head(0), tail(0), maxsize(lmaxsize)
{
buf = new char[lmaxsize];
};
~TBinQueue(){ delete []buf; };
int Push(const int nsize, const char *buffer);
int Pop(const int maxsize, char *outbuffer);
int View(const int maxsize, char *outbuffer) const;
int Skip(const int skipsize);
bool empty(void){ return (head == tail); };
int size(void) { return (tail - head); };
};
#endif