RINASim  October 2016
Documentation of framework for OMNeT++
DQSch.cc
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU Lesser General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 #include "DQSch.h"
17 
19 
21 {
22  monitor= getRINAModule<DQMonitor::DQMonitor*>(this, 1, {MOD_POL_RMT_QMONITOR});
23  if (monitor == NULL)
24  {
25  EV << "!!! DQMonitor has to be used in conjecture with DQSch!" << endl;
26  }
27 }
28 
29 
30 void DQSch::processQueues(RMTPort* port, RMTQueueType direction) {
31  if (direction == RMTQueue::OUTPUT) {
32  if (port->isOutputReady() && port->getWaiting(RMTQueue::OUTPUT)) {
33  RMTQueue* outQ = monitor->getNextOutput(port);
34  if(outQ && outQ->getLength()>0) {
35  outQ->releasePDU();
36  }
37  }
38  } else if (direction == RMTQueue::INPUT) {
39  if (port->isInputReady() && port->getWaiting(RMTQueue::INPUT)) {
40  RMTQueue* inQ = monitor->getNextInput(port);
41  if(inQ && inQ->getLength()>0) {
42  inQ->releasePDU();
43  } else {
44  simtime_t t = monitor->getNextInputTime(port);
45  if(t > simTime()){
47  }
48  }
49  }
50  }
51 }
void scheduleReinvocation(simtime_t time, RMTPort *port, RMTQueueType direction)
Definition: DQSch.h:24
void releasePDU()
Definition: RMTQueue.cc:162
const char * MOD_POL_RMT_QMONITOR
Definition: ExternConsts.cc:74
RMTQueue * getNextInput(RMTPort *port)
Definition: DQMonitor.cc:500
virtual void onPolicyInit()
Definition: DQSch.cc:20
Define_Module(DQSch)
int getLength() const
Definition: RMTQueue.cc:210
DQMonitor::DQMonitor * monitor
Definition: DQSch.h:31
virtual void processQueues(RMTPort *port, RMTQueueType direction)
Definition: DQSch.cc:30
unsigned long getWaiting(RMTQueueType direction)
Definition: RMTPort.cc:315
simtime_t getNextInputTime(RMTPort *port)
Definition: DQMonitor.cc:532
RMTQueue * getNextOutput(RMTPort *port)
Definition: DQMonitor.cc:550
bool isOutputReady()
Definition: RMTPort.cc:261
bool isInputReady()
Definition: RMTPort.cc:282