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

Passive FIFO Queue with unlimited buffer space. More...

#include <FIFOQueue.h>

Inheritance diagram for inet::FIFOQueue:
inet::PassiveQueueBase inet::IQueueAccess inet::IPassiveQueue

Public Member Functions

 FIFOQueue ()
 
- 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 ()
 
- Public Member Functions inherited from inet::IQueueAccess
virtual ~IQueueAccess ()
 

Protected Member Functions

virtual void initialize () override
 
virtual cMessage * enqueue (cMessage *msg) override
 Inserts packet into the queue or the priority queue, or drops it (or another packet). More...
 
virtual cMessage * dequeue () override
 Returns a packet from the queue, or nullptr if the queue is empty. More...
 
virtual void sendOut (cMessage *msg) override
 Should be redefined to send out the packet; e.g. More...
 
virtual bool isEmpty () override
 Return true when queue is empty, otherwise return false. More...
 
virtual int getLength () const override
 Returns the number of frames in the queue. More...
 
virtual int getByteLength () const override
 Returns the number of bytes in the queue. 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

cQueue queue
 
cGate * outGate
 
int byteLength
 
- 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

- 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

Passive FIFO Queue with unlimited buffer space.

Constructor & Destructor Documentation

inet::FIFOQueue::FIFOQueue ( )
inline
43 : outGate(nullptr), byteLength(0) {}
int byteLength
Definition: FIFOQueue.h:37
cGate * outGate
Definition: FIFOQueue.h:36

Member Function Documentation

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

Returns a packet from the queue, or nullptr if the queue is empty.

Implements inet::PassiveQueueBase.

46 {
47  if (queue.isEmpty())
48  return nullptr;
49 
50  cPacket *packet = check_and_cast<cPacket *>(queue.pop());
51  byteLength -= packet->getByteLength();
52  emit(queueLengthSignal, queue.getLength());
53  return packet;
54 }
cQueue queue
Definition: FIFOQueue.h:35
static simsignal_t queueLengthSignal
Definition: FIFOQueue.h:40
int byteLength
Definition: FIFOQueue.h:37
cMessage * inet::FIFOQueue::enqueue ( cMessage *  msg)
overrideprotectedvirtual

Inserts packet into the queue or the priority queue, or drops it (or another packet).

Returns nullptr if successful, or the pointer of the dropped packet.

Implements inet::PassiveQueueBase.

37 {
38  cPacket *packet = check_and_cast<cPacket *>(msg);
39  queue.insert(packet);
40  byteLength += packet->getByteLength();
41  emit(queueLengthSignal, queue.getLength());
42  return nullptr;
43 }
cQueue queue
Definition: FIFOQueue.h:35
static simsignal_t queueLengthSignal
Definition: FIFOQueue.h:40
int byteLength
Definition: FIFOQueue.h:37
virtual int inet::FIFOQueue::getByteLength ( ) const
inlineoverrideprotectedvirtual

Returns the number of bytes in the queue.

Implements inet::IQueueAccess.

58 { return byteLength; }
int byteLength
Definition: FIFOQueue.h:37
virtual int inet::FIFOQueue::getLength ( ) const
inlineoverrideprotectedvirtual

Returns the number of frames in the queue.

Implements inet::IQueueAccess.

56 { return queue.getLength(); }
cQueue queue
Definition: FIFOQueue.h:35
void inet::FIFOQueue::initialize ( )
overrideprotectedvirtual

Reimplemented from inet::PassiveQueueBase.

30 {
32  queue.setName(par("queueName"));
33  outGate = gate("out");
34 }
cQueue queue
Definition: FIFOQueue.h:35
cGate * outGate
Definition: FIFOQueue.h:36
virtual void initialize() override
Definition: PassiveQueueBase.cc:30
bool inet::FIFOQueue::isEmpty ( )
overrideprotectedvirtual

Return true when queue is empty, otherwise return false.

Implements inet::IPassiveQueue.

62 {
63  return queue.isEmpty();
64 }
cQueue queue
Definition: FIFOQueue.h:35
void inet::FIFOQueue::sendOut ( cMessage *  msg)
overrideprotectedvirtual

Should be redefined to send out the packet; e.g.

send(msg,"out").

Implements inet::PassiveQueueBase.

57 {
58  send(msg, outGate);
59 }
cGate * outGate
Definition: FIFOQueue.h:36

Member Data Documentation

int inet::FIFOQueue::byteLength
protected

Referenced by dequeue(), and enqueue().

cGate* inet::FIFOQueue::outGate
protected

Referenced by initialize(), and sendOut().

cQueue inet::FIFOQueue::queue
protected

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

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

Referenced by dequeue(), and enqueue().


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