INET Framework for OMNeT++/OMNEST
|
Abstract base class for single-server queues. More...
#include <AbstractQueue.h>
Public Member Functions | |
AbstractQueue () | |
virtual | ~AbstractQueue () |
Protected Member Functions | |
virtual void | initialize () override |
virtual void | handleMessage (cMessage *msg) override |
virtual void | arrival (cPacket *msg)=0 |
Functions to (re)define behaviour. More... | |
virtual cPacket * | arrivalWhenIdle (cPacket *msg)=0 |
Called when a message arrives at the module when the queue is empty. More... | |
virtual simtime_t | startService (cPacket *msg)=0 |
Called when a message starts service, and should return the service time. More... | |
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 | |
cPacketQueue | queue |
The queue. More... | |
Private Member Functions | |
void | doStartService () |
void | doEndService () |
Private Attributes | |
cPacket * | msgServiced |
cMessage * | endServiceMsg |
Abstract base class for single-server queues.
Contains special optimization for zero service time (i.e. it does not schedule the endService timer then).
inet::AbstractQueue::AbstractQueue | ( | ) |
|
virtual |
|
protectedpure virtual |
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);
Implemented in inet::QueueBase.
Referenced by handleMessage().
|
protectedpure virtual |
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:
Most straightforward implementation: return msg;
Implemented in inet::QueueBase.
Referenced by handleMessage().
|
protectedvirtual |
If a message is under service, aborts its service and returns the message.
Returns nullptr if no message is being serviced. The caller is free to delete the message, reinsert it into the queue, or handle it otherwise.
Referenced by inet::IPv4::flush().
|
private |
Referenced by doStartService(), and handleMessage().
|
private |
Referenced by doEndService(), and handleMessage().
|
protectedpure virtual |
Called when a message completes service.
The function may send it to another module, discard it, or in general do anything with it.
Most straightforward implementation: send(msg,"out");
Implemented in inet::IPv4, inet::IPv6, and inet::GenericNetworkProtocol.
Referenced by doEndService().
|
overrideprotectedvirtual |
Reimplemented in inet::IPv4, inet::IPv6, and inet::GenericNetworkProtocol.
Referenced by inet::GenericNetworkProtocol::handleMessage(), inet::IPv6::handleMessage(), and inet::IPv4::handleMessage().
|
overrideprotectedvirtual |
Reimplemented in inet::GenericNetworkProtocol, and inet::QueueBase.
Referenced by inet::QueueBase::initialize().
|
protectedpure virtual |
Called when a message starts service, and should return the service time.
Example implementation: return 1.0;
Implemented in inet::QueueBase.
Referenced by doStartService().
|
private |
Referenced by AbstractQueue(), cancelService(), doStartService(), handleMessage(), initialize(), and ~AbstractQueue().
|
private |
Referenced by AbstractQueue(), cancelService(), doEndService(), doStartService(), handleMessage(), initialize(), and ~AbstractQueue().
|
protected |
The queue.
Referenced by inet::QueueBase::arrival(), doEndService(), inet::IPv6::endService(), inet::IPv4::flush(), inet::IPv6::fragmentAndSend(), initialize(), and inet::IPv4::start().