00001 #ifndef WATERMARKED_QUEUE
00002 #define WATERMARKED_QUEUE
00003
00004 #include <queue>
00005
00006 namespace syn
00007 {
00010 template <typename _type>
00011 class WatermarkedQueue : public std::queue<_type, std::list<_type> >
00012 {
00013 public:
00014 WatermarkedQueue() : mLow( 1 ),
00015 mHigh( 2 )
00016 {
00017 }
00018 virtual ~WatermarkedQueue() {}
00019
00020
00021 public:
00023 void setHighMark( unsigned int h )
00024 {
00025 mHigh = h;
00026 }
00027
00029 void setLowMark( unsigned int l )
00030 {
00031 mLow = l;
00032 }
00033
00034 inline unsigned int highMark() const { return mHigh; }
00035 inline unsigned int lowMark() const { return mLow; }
00036
00038 bool high() const { return this->size() >= this->highMark(); }
00039
00041 bool low() const { return this->size() < this->lowMark(); }
00042
00044 bool empty() const { return this->size() == 0; }
00045
00046 unsigned int mLow, mHigh;
00047 };
00048 }
00049
00050 #endif