#include <AbstractQueue.h>
Inheritance diagram for AbstractQueue:
Public Member Functions | |
AbstractQueue () | |
virtual | ~AbstractQueue () |
Protected Member Functions | |
virtual void | initialize () |
virtual void | handleMessage (cMessage *msg) |
virtual void | arrival (cMessage *msg)=0 |
virtual cMessage * | arrivalWhenIdle (cMessage *msg)=0 |
virtual simtime_t | startService (cMessage *msg)=0 |
virtual void | endService (cMessage *msg)=0 |
Protected Attributes | |
cQueue | queue |
Private Attributes | |
cMessage * | msgServiced |
cMessage * | endServiceMsg |
|
00025 { 00026 msgServiced = endServiceMsg = NULL; 00027 }
|
|
00030 { 00031 delete msgServiced; 00032 cancelAndDelete(endServiceMsg); 00033 }
|
|
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: Implemented in QueueBase, and QueueWithQoS. |
|
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 immmediately. This method may:
Most straightforward implementation: Implemented in QueueBase, and QueueWithQoS. |
|
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: |
|
00043 { 00044 if (msg==endServiceMsg) 00045 { 00046 endService( msgServiced ); 00047 if (queue.empty()) 00048 { 00049 msgServiced = NULL; 00050 } 00051 else 00052 { 00053 msgServiced = (cMessage *) queue.getTail(); 00054 simtime_t serviceTime = startService( msgServiced ); 00055 scheduleAt( simTime()+serviceTime, endServiceMsg ); 00056 } 00057 } 00058 else if (!msgServiced) 00059 { 00060 cMessage *msg2 = arrivalWhenIdle( msg ); 00061 if (msg2) 00062 { 00063 msgServiced = msg2; 00064 simtime_t serviceTime = startService( msgServiced ); 00065 scheduleAt( simTime()+serviceTime, endServiceMsg ); 00066 } 00067 00068 } 00069 else 00070 { 00071 arrival( msg ); 00072 } 00073 }
|
|
Reimplemented in QueueBase, QueueWithQoS, IP, and IPv6. 00036 { 00037 msgServiced = NULL; 00038 endServiceMsg = new cMessage("end-service"); 00039 queue.setName("queue"); 00040 }
|
|
Called when a message starts service, and should return the service time.
Example implementation: Implemented in QueueBase, and QueueWithQoS. |
|
|
|
|
|
The queue. May be configured into a priority queue in initialize() if needed. |