#ifndef _BoundedBuffer_H_ #define _BoundedBuffer_H_ #include #include //#include using namespace std; //extern unsigned int n, b, w; class BoundedBuffer{ int b_val; Semaphore *full = new Semaphore(0); //initialized to 0, Since there are 0 full slots Semaphore *empty;// = new Semaphore(b); //initialized to b, Since all the slots are empty Semaphore *mutex = new Semaphore(1); vector data; //BoundedBuffer( public: BoundedBuffer(){empty = new Semaphore(100);}//default b value BoundedBuffer(int b){ b_val = b; empty = new Semaphore(b_val); } int get_val(){return b_val;} void set_b(int b){ b_val = b;} void push(string item); string pop(); //can't be larger than b strings //b = user input }; #endif