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

Schedule packets in strict priority order. More...

#include <PriorityScheduler.h>

Inheritance diagram for inet::PriorityScheduler:
inet::SchedulerBase inet::IPassiveQueue inet::IPassiveQueueListener

Protected Member Functions

virtual bool schedulePacket () override
 
- Protected Member Functions inherited from inet::SchedulerBase
virtual void initialize () override
 
virtual void finalize ()
 
virtual void handleMessage (cMessage *msg) override
 
virtual void sendOut (cMessage *msg)
 
virtual void notifyListeners ()
 

Additional Inherited Members

- Public Member Functions inherited from inet::SchedulerBase
 SchedulerBase ()
 
virtual ~SchedulerBase ()
 
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 bool isEmpty () override
 Return true when queue is empty, otherwise return false. More...
 
virtual void clear () override
 Clear all queued packets and stored requests. More...
 
virtual cMessage * pop () override
 Returns a packet directly from the queue, bypassing the primary, send-on-request mechanism. More...
 
virtual void packetEnqueued (IPassiveQueue *inputQueue) override
 A packet arrived and it was added to the queue (the queue length increased by one). More...
 
virtual void addListener (IPassiveQueueListener *listener) override
 Adds a new listener to the listener list. More...
 
virtual void removeListener (IPassiveQueueListener *listener) override
 Removes a listener from the listener list. More...
 
- Public Member Functions inherited from inet::IPassiveQueue
virtual ~IPassiveQueue ()
 
- Public Member Functions inherited from inet::IPassiveQueueListener
virtual ~IPassiveQueueListener ()
 
- Protected Attributes inherited from inet::SchedulerBase
int packetsRequestedFromUs
 
int packetsToBeRequestedFromInputs
 
std::vector< IPassiveQueue * > inputQueues
 
cGate * outGate
 
std::list< IPassiveQueueListener * > listeners
 

Detailed Description

Schedule packets in strict priority order.

Packets arrived at the 0th gate has the higher priority.

Member Function Documentation

bool inet::PriorityScheduler::schedulePacket ( )
overrideprotectedvirtual

Implements inet::SchedulerBase.

26 {
27  for (auto inputQueue : inputQueues) {
28 
29  if (!inputQueue->isEmpty()) {
30  inputQueue->requestPacket();
31  return true;
32  }
33  }
34  return false;
35 }
std::vector< IPassiveQueue * > inputQueues
Definition: SchedulerBase.h:46

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