Protected Member Functions | Protected Attributes

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.

Definition at line 28 of file DropTailQueue.h.


Member Function Documentation

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

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

Definition at line 56 of file DropTailQueue.cc.

{
    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.

Definition at line 39 of file DropTailQueue.cc.

{
    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.

Definition at line 25 of file DropTailQueue.cc.

{
    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.

Definition at line 69 of file DropTailQueue.cc.

{
    send(msg, outGate);
}


Member Data Documentation

cOutVector DropTailQueue::dropVec [protected]

Definition at line 40 of file DropTailQueue.h.

Referenced by enqueue(), and initialize().

Definition at line 32 of file DropTailQueue.h.

Referenced by enqueue(), and initialize().

cGate* DropTailQueue::outGate [protected]

Definition at line 36 of file DropTailQueue.h.

Referenced by initialize(), and sendOut().

cOutVector DropTailQueue::qlenVec [protected]

Definition at line 39 of file DropTailQueue.h.

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

cQueue DropTailQueue::queue [protected]

Definition at line 35 of file DropTailQueue.h.

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


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