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

Queue with constant processing time. More...

#include <QueueBase.h>

Inheritance diagram for inet::QueueBase:
inet::AbstractQueue inet::GenericNetworkProtocol inet::IPv4 inet::IPv6

Public Member Functions

 QueueBase ()
 
- Public Member Functions inherited from inet::AbstractQueue
 AbstractQueue ()
 
virtual ~AbstractQueue ()
 

Protected Member Functions

virtual void initialize () override
 
virtual void arrival (cPacket *msg) override
 Functions to (re)define behaviour. More...
 
virtual cPacket * arrivalWhenIdle (cPacket *msg) override
 Called when a message arrives at the module when the queue is empty. More...
 
virtual simtime_t startService (cPacket *msg) override
 Called when a message starts service, and should return the service time. More...
 
- Protected Member Functions inherited from inet::AbstractQueue
virtual void handleMessage (cMessage *msg) override
 
virtual void endService (cPacket *msg)=0
 Called when a message completes service. More...
 
virtual cPacket * cancelService ()
 If a message is under service, aborts its service and returns the message. More...
 

Protected Attributes

simtime_t delay
 
- Protected Attributes inherited from inet::AbstractQueue
cPacketQueue queue
 The queue. More...
 

Detailed Description

Queue with constant processing time.

Leaves the endService(cMessage *msg) method of AbstractQueue undefined.

Constructor & Destructor Documentation

inet::QueueBase::QueueBase ( )
inline
35 {}

Member Function Documentation

void inet::QueueBase::arrival ( cPacket *  msg)
overrideprotectedvirtual

Functions to (re)define behaviour.

Called when a message arrives at the module. The method should either enqueue this message (usual behaviour), or discard it. It may also wrap the it into another message, and insert that one in the queue.

Most straightforward implementation: queue.insert(msg);

Implements inet::AbstractQueue.

29 {
30  queue.insert(msg);
31 }
cPacketQueue queue
The queue.
Definition: AbstractQueue.h:48
cPacket * inet::QueueBase::arrivalWhenIdle ( cPacket *  msg)
overrideprotectedvirtual

Called when a message arrives at the module when the queue is empty.

The message doesn't need to be enqueued in this case, it can start service immediately. This method may:

  1. simply return the the same pointer (usual behaviour), or
  2. discard the message and return nullptr pointer (the effect being this message being ignored)
  3. or modify the message, wrap in into another message etc, and return the (new) message's pointer.

Most straightforward implementation: return msg;

Implements inet::AbstractQueue.

34 {
35  return msg;
36 }
void inet::QueueBase::initialize ( )
overrideprotectedvirtual

Reimplemented from inet::AbstractQueue.

Reimplemented in inet::GenericNetworkProtocol.

Referenced by inet::GenericNetworkProtocol::initialize(), inet::IPv6::initialize(), and inet::IPv4::initialize().

23 {
25  delay = par("procDelay");
26 }
simtime_t delay
Definition: QueueBase.h:32
virtual void initialize() override
Definition: AbstractQueue.cc:36
simtime_t inet::QueueBase::startService ( cPacket *  msg)
overrideprotectedvirtual

Called when a message starts service, and should return the service time.

Example implementation: return 1.0;

Implements inet::AbstractQueue.

39 {
40  return delay;
41 }
simtime_t delay
Definition: QueueBase.h:32

Member Data Documentation

simtime_t inet::QueueBase::delay
protected

Referenced by initialize(), and startService().


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