Yurttas/PL/OOL/Cplusplus/F/02/08/01/00/cubby hole.h

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2005
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9 
10   date   : September 1, 2005.
11   author : Austin W. Westfall, Salih Yurttas.
12
13   cubby_hole.h
14*/
15
16
17#include <queue>
18#include <unistd.h>
19
20#include "mutex.h"
21
22using namespace std;
23
24template<class T>
25class cubby_hole {
26public:
27  cubby_hole(int max_size = 16);
28
29  ~cubby_hole();
30
31  int size() const;
32
33  void put(T item);
34
35  T get();
36
37private:
38  queue<T> data;
39  mutex mut;
40  int max_size;
41};