INET Framework for OMNeT++/OMNEST
inet::DropTailQueue Class Reference

Drop-front queue. More...

#include <DropTailQueue.h>

Inheritance diagram for inet::DropTailQueue:
inet::PassiveQueueBase inet::IPassiveQueue

Protected Member Functions

virtual void initialize () override
 
virtual cMessage * enqueue (cMessage *msg) override
 Redefined from PassiveQueueBase. More...
 
virtual cMessage * dequeue () override
 Redefined from PassiveQueueBase. More...
 
virtual void sendOut (cMessage *msg) override
 Redefined from PassiveQueueBase. More...
 
virtual bool isEmpty () override
 Redefined from IPassiveQueue. More...
 
- Protected Member Functions inherited from inet::PassiveQueueBase
virtual void handleMessage (cMessage *msg) override
 
virtual void finish () override
 
virtual void refreshDisplay () const override
 
virtual void notifyListeners ()
 

Protected Attributes

int frameCapacity
 
cQueue queue
 
cGate * outGate
 
- Protected Attributes inherited from inet::PassiveQueueBase
std::list< IPassiveQueueListener * > listeners
 
int packetRequested
 
int numQueueReceived
 
int numQueueDropped
 

Static Protected Attributes

static simsignal_t queueLengthSignal = registerSignal("queueLength")
 

Additional Inherited Members

- Public Member Functions inherited from inet::PassiveQueueBase
virtual void requestPacket () override
 The queue should send a packet whenever this method is invoked. More...
 
virtual int getNumPendingRequests () override
 Returns number of pending requests. More...
 
virtual void clear () override
 Clear all queued packets and stored requests. More...
 
virtual cMessage * pop () override
 Return a packet from the queue directly. More...
 
virtual void addListener (IPassiveQueueListener *listener) override
 Implementation of IPassiveQueue::addListener(). More...
 
virtual void removeListener (IPassiveQueueListener *listener) override
 Implementation of IPassiveQueue::removeListener(). More...
 
- Public Member Functions inherited from inet::IPassiveQueue
virtual ~IPassiveQueue ()
 
- Static Public Attributes inherited from inet::PassiveQueueBase
static simsignal_t rcvdPkSignal = registerSignal("rcvdPk")
 Signal with packet when received it. More...
 
static simsignal_t enqueuePkSignal = registerSignal("enqueuePk")
 Signal with packet when enqueued it. More...
 
static simsignal_t dequeuePkSignal = registerSignal("dequeuePk")
 Signal with packet when sent out it. More...
 
static simsignal_t dropPkByQueueSignal = registerSignal("dropPkByQueue")
 Signal with packet when dropped it. More...
 
static simsignal_t queueingTimeSignal = registerSignal("queueingTime")
 Signal with value of delaying time when sent out a packet. More...
 

Detailed Description

Drop-front queue.

See NED for more info.

Member Function Documentation

cMessage * inet::DropTailQueue::dequeue ( )
overrideprotectedvirtual

Redefined from PassiveQueueBase.

Implements inet::PassiveQueueBase.

57 {
58  if (queue.isEmpty())
59  return nullptr;
60 
61  cMessage *msg = (cMessage *)queue.pop();
62 
63  // statistics
64  emit(queueLengthSignal, queue.getLength());
65 
66  return msg;
67 }
cQueue queue
Definition: DropTailQueue.h:37
static simsignal_t queueLengthSignal
Definition: DropTailQueue.h:41
cMessage * inet::DropTailQueue::enqueue ( cMessage *  msg)
overrideprotectedvirtual

Redefined from PassiveQueueBase.

Implements inet::PassiveQueueBase.

44 {
45  if (frameCapacity && queue.getLength() >= frameCapacity) {
46  EV << "Queue full, dropping packet.\n";
47  return msg;
48  }
49  else {
50  queue.insert(msg);
51  emit(queueLengthSignal, queue.getLength());
52  return nullptr;
53  }
54 }
int frameCapacity
Definition: DropTailQueue.h:34
cQueue queue
Definition: DropTailQueue.h:37
static simsignal_t queueLengthSignal
Definition: DropTailQueue.h:41
void inet::DropTailQueue::initialize ( )
overrideprotectedvirtual

Reimplemented from inet::PassiveQueueBase.

29 {
31 
32  queue.setName(par("queueName"));
33 
34  //statistics
35  emit(queueLengthSignal, queue.getLength());
36 
37  outGate = gate("out");
38 
39  // configuration
40  frameCapacity = par("frameCapacity");
41 }
int frameCapacity
Definition: DropTailQueue.h:34
cGate * outGate
Definition: DropTailQueue.h:38
cQueue queue
Definition: DropTailQueue.h:37
virtual void initialize() override
Definition: PassiveQueueBase.cc:30
static simsignal_t queueLengthSignal
Definition: DropTailQueue.h:41
bool inet::DropTailQueue::isEmpty ( )
overrideprotectedvirtual

Redefined from IPassiveQueue.

Implements inet::IPassiveQueue.

75 {
76  return queue.isEmpty();
77 }
cQueue queue
Definition: DropTailQueue.h:37
void inet::DropTailQueue::sendOut ( cMessage *  msg)
overrideprotectedvirtual

Redefined from PassiveQueueBase.

Implements inet::PassiveQueueBase.

70 {
71  send(msg, outGate);
72 }
cGate * outGate
Definition: DropTailQueue.h:38

Member Data Documentation

int inet::DropTailQueue::frameCapacity
protected

Referenced by enqueue(), and initialize().

cGate* inet::DropTailQueue::outGate
protected

Referenced by initialize(), and sendOut().

cQueue inet::DropTailQueue::queue
protected

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

simsignal_t inet::DropTailQueue::queueLengthSignal = registerSignal("queueLength")
staticprotected

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


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