#include <DropTailQueue.h>
Protected Member Functions | |
virtual void | initialize () |
virtual bool | enqueue (cMessage *msg) |
virtual cMessage * | dequeue () |
virtual void | sendOut (cMessage *msg) |
Protected Attributes | |
int | frameCapacity |
cQueue | queue |
cGate * | outGate |
cOutVector | qlenVec |
cOutVector | dropVec |
void DropTailQueue::initialize | ( | ) | [protected, virtual] |
Reimplemented from PassiveQueueBase.
00026 { 00027 PassiveQueueBase::initialize(); 00028 queue.setName("l2queue"); 00029 00030 qlenVec.setName("queue length"); 00031 dropVec.setName("drops"); 00032 00033 outGate = gate("out"); 00034 00035 // configuration 00036 frameCapacity = par("frameCapacity"); 00037 }
bool DropTailQueue::enqueue | ( | cMessage * | msg | ) | [protected, virtual] |
Redefined from PassiveQueueBase.
Implements PassiveQueueBase.
00040 { 00041 if (frameCapacity && queue.length() >= frameCapacity) 00042 { 00043 EV << "Queue full, dropping packet.\n"; 00044 delete msg; 00045 dropVec.record(1); 00046 return true; 00047 } 00048 else 00049 { 00050 queue.insert(msg); 00051 qlenVec.record(queue.length()); 00052 return false; 00053 } 00054 }
cMessage * DropTailQueue::dequeue | ( | ) | [protected, virtual] |
Redefined from PassiveQueueBase.
Implements PassiveQueueBase.
00057 { 00058 if (queue.empty()) 00059 return NULL; 00060 00061 cMessage *pk = (cMessage *)queue.pop(); 00062 00063 // statistics 00064 qlenVec.record(queue.length()); 00065 00066 return pk; 00067 }
void DropTailQueue::sendOut | ( | cMessage * | msg | ) | [protected, virtual] |
Redefined from PassiveQueueBase.
Implements PassiveQueueBase.
00070 { 00071 send(msg, outGate); 00072 }
int DropTailQueue::frameCapacity [protected] |
Referenced by enqueue(), and initialize().
cQueue DropTailQueue::queue [protected] |
Referenced by dequeue(), enqueue(), and initialize().
cGate* DropTailQueue::outGate [protected] |
Referenced by initialize(), and sendOut().
cOutVector DropTailQueue::qlenVec [protected] |
Referenced by dequeue(), enqueue(), and initialize().
cOutVector DropTailQueue::dropVec [protected] |
Referenced by enqueue(), and initialize().