IT++ Logo Newcom Logo

front_drop_queue.h

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

Generated on Sat Aug 25 23:40:04 2007 for IT++ by Doxygen 1.5.2