00001 #ifndef BoundedBuffer_HPP
00002 #define BoundedBuffer_HPP
00003
00004 #include "Standard.hpp"
00005 #include "Basic_PThread.hpp"
00006
00007 #define BBSIZE 10
00008 #define STEPS 15
00009
00010 class BoundedBuffer {
00011 private:
00012 size_t size;
00013 size_t front;
00014 size_t rear;
00015 long count;
00016 char* buffer;
00017 BOOL* empty;
00018
00019 public:
00020 BoundedBuffer( size_t sz = BBSIZE );
00021
00022 void enqueue( char item );
00023 char dequeue();
00024
00025 inline long getCount() { return count; }
00026 inline size_t getSize() { return size; }
00027 inline BOOL isEmpty() { return (count == 0); }
00028 };
00029
00030 #endif