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 {
00039 
00041 
00042 
00044 #define DEFAULT_MAX_BYTES_IN_QUEUE 24000
00045 
00047 class Front_Drop_Queue : public virtual std::queue<Packet*>
00048 {
00049 public:
00051   Front_Drop_Queue(const int max_bytes = DEFAULT_MAX_BYTES_IN_QUEUE)  {
00052     max_bytes_in_queue = max_bytes;
00053     bytes_in_queue = 0;
00054     debug = false;
00055   }
00056 
00057   // TODO destructor
00058   //  ~FrontDropQueue() { }
00059 
00061   void set_debug(const bool enable_debug = true) {
00062     debug = enable_debug;
00063   }
00064 
00066   void push(Packet *packet);
00068   void pop();
00069 
00071   void set_max_byte_size(int max_bytes) { max_bytes_in_queue = max_bytes; }
00073   int max_byte_size() { return max_bytes_in_queue; }
00075   int byte_size() { return bytes_in_queue; }
00076 
00077 private:
00078   int max_bytes_in_queue;
00079   int bytes_in_queue;
00080   int debug;
00081 };
00082 
00084 
00085 } // namespace itpp
00086 
00087 #endif // #ifndef FRONT_DROP_QUEUE_H
00088 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SourceForge Logo

Generated on Wed Dec 7 2011 03:38:51 for IT++ by Doxygen 1.7.4