RINASim  October 2016
Documentation of framework for OMNeT++
MM_Simple_Out.cc
Go to the documentation of this file.
1 //
2 // Copyright © 2014 - 2015 PRISTINE Consortium (http://ict-pristine.eu)
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program. If not, see http://www.gnu.org/licenses/.
16 //
17 
18 #include <MM_Simple_Out.h>
19 
20 namespace MM_Simple_Out {
21 
23 
24 MM_Simple_Out::~MM_Simple_Out() {
25  for(auto & pQ : portQueues) {
26  pQ.second.clear();
27  }
28  portQueues.clear();
29 }
30 
31 void MM_Simple_Out::pduInsertered(RMTQueue * q, RMTPort * p) {
32  portQueues[p].push_back(q);
33 }
34 
35 void MM_Simple_Out::pduDropped(RMTQueue * q, const cPacket * s, RMTPort * p) {
36  portQueues[p].pop_back();
37 }
38 
39 void MM_Simple_Out::pduReleased(RMTQueue * q, RMTPort * p) {}
40 
41 void MM_Simple_Out::queueCreated(RMTQueue * q, RMTPort * p) {
42  portQueues[p];
43 }
44 
45 RMTQueue * MM_Simple_Out::getnextQueue(RMTPort * p) {
46  auto pQ = &portQueues[p];
47  while(!pQ->empty()) {
48  RMTQueue * q = pQ->front();
49  pQ->pop_front();
50  if(q->getLength() > 0) return q;
51  }
52  return NULL;
53 }
54 
55 simtime_t MM_Simple_Out::getnextTime(RMTPort * p) {
56  return simTime();
57 }
58 
59 }
Define_Module(MM_Simple_Out)
int getLength() const
Definition: RMTQueue.cc:210