Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/root/src/subsynth/syn/Util/WatermarkedQueue.h

Go to the documentation of this file.
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    // watermark metrics...
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

Generated at Mon Apr 15 09:26:08 2002 for subsynth by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001