IT++ Logo

front_drop_queue.h

Go to the documentation of this file.
00001 
00030 #ifndef FRONT_DROP_QUEUE_H
00031 #define FRONT_DROP_QUEUE_H
00032 
00033 #include <itpp/protocol/packet.h>
00034 #include <itpp/protocol/events.h>
00035 
00036 
00037 namespace itpp {
00038 
00040 
00041 
00043 #define DEFAULT_MAX_BYTES_IN_QUEUE 24000
00044 
00046   class Front_Drop_Queue : public virtual std::queue<Packet*> {
00047   public:
00049     Front_Drop_Queue(const int max_bytes = DEFAULT_MAX_BYTES_IN_QUEUE)  {
00050       max_bytes_in_queue = max_bytes;
00051       bytes_in_queue = 0;
00052       debug=false;
00053     }
00054 
00055     // TODO destructor
00056     //  ~FrontDropQueue() { }
00057 
00059     void set_debug(const bool enable_debug = true) {
00060       debug = enable_debug;
00061     }
00062 
00064     void push(Packet *packet);
00066     void pop();
00067 
00069     void set_max_byte_size(int max_bytes) { max_bytes_in_queue = max_bytes; }
00071     int max_byte_size() { return max_bytes_in_queue; }
00073     int byte_size() { return bytes_in_queue; }
00074 
00075   private:
00076     int max_bytes_in_queue;
00077     int bytes_in_queue;
00078     int debug;
00079   };
00080 
00082 
00083 } // namespace itpp
00084 
00085 #endif // #ifndef FRONT_DROP_QUEUE_H
00086 
SourceForge Logo

Generated on Sun Apr 20 12:40:06 2008 for IT++ by Doxygen 1.5.5