INET Framework for OMNeT++/OMNEST
DropTailQueue Class Reference

#include <DropTailQueue.h>

Inheritance diagram for DropTailQueue:
PassiveQueueBase IPassiveQueue

List of all members.

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

Detailed Description

Drop-front queue. See NED for more info.


Member Function Documentation

cMessage * DropTailQueue::dequeue ( ) [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

{
    if (queue.empty())
        return NULL;

   cMessage *pk = (cMessage *)queue.pop();

    // statistics
    qlenVec.record(queue.length());

    return pk;
}
bool DropTailQueue::enqueue ( cMessage *  msg) [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

{
    if (frameCapacity && queue.length() >= frameCapacity)
    {
        EV << "Queue full, dropping packet.\n";
        delete msg;
        dropVec.record(1);
        return true;
    }
    else
    {
        queue.insert(msg);
        qlenVec.record(queue.length());
        return false;
    }
}
void DropTailQueue::initialize ( ) [protected, virtual]

Reimplemented from PassiveQueueBase.

{
    PassiveQueueBase::initialize();
    queue.setName("l2queue");

    qlenVec.setName("queue length");
    dropVec.setName("drops");

    outGate = gate("out");

    // configuration
    frameCapacity = par("frameCapacity");
}
void DropTailQueue::sendOut ( cMessage *  msg) [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

{
    send(msg, outGate);
}

Member Data Documentation

cOutVector DropTailQueue::dropVec [protected]

Referenced by enqueue(), and initialize().

Referenced by enqueue(), and initialize().

cGate* DropTailQueue::outGate [protected]

Referenced by initialize(), and sendOut().

cOutVector DropTailQueue::qlenVec [protected]

Referenced by dequeue(), enqueue(), and initialize().

cQueue DropTailQueue::queue [protected]

Referenced by dequeue(), enqueue(), and initialize().


The documentation for this class was generated from the following files: