EPONImplementationforOMNet++
0.8Beta
|
#include <ONU_QPL_RR.h>
Public Member Functions | |
virtual void | initialize (int stage) |
virtual void | requestPacket () |
This method returns the next frame and removes it from the queue. |
void ONU_QPL_RR::initialize | ( | int | stage | ) | [virtual] |
Reimplemented from ONUQPerLLiDBase.
{ ONUQPerLLiDBase::initialize(stage); }
void ONU_QPL_RR::requestPacket | ( | ) | [virtual] |
This method returns the next frame and removes it from the queue.
Thus this method (and the getNextFrameSize()) control the queue's priorities and QoS. The default behavior is to do Round Robin on the queues. NOTE: RR is per frame...
This could be overridden in a subclass and change the default behavior.
Implements ONUQPerLLiDBase.
{ Enter_Method("requestPacket()"); bool found=false; // if the current Q is empty find the next one if (pon_queues[nextQIndex].isEmpty()){ for (int i=(nextQIndex+1)%pon_queues.size(); i!=nextQIndex; i=((i+1)%pon_queues.size())){ if (!pon_queues[i].isEmpty()) { nextQIndex=i; found=true; break; } } // If not empty.. we have a frame }else found=true; // if all empty return NULL if (!found){ allQsEmpty = true; return; } // Send the next message to lower layer out cPacket * msg = (cPacket *)pon_queues[nextQIndex].pop(); // Point to the next Q (Round Robin) nextQIndex=(nextQIndex+1)%pon_queues.size(); // Check is it was the last one... checkIfAllEmpty(); send(msg,"lowerLayerOut"); }