AggrPkt.cc

00001 #include "AggrPkt.h"
00002 
00003 Register_Class(AggrPkt);
00004 
00005 void AggrPkt::setStoredPacketsArraySize(unsigned int size) { }
00006 
00007 unsigned int AggrPkt::getStoredPacketsArraySize() const {
00008   return storedPackets.size();
00009 }
00010 
00011 // should not be used -- implemented only because omnet++ expects it
00012 pApplPkt& AggrPkt::getStoredPackets(unsigned int k) {
00013   pApplPkt& pkt = storedPackets.front();
00014   return pkt ;
00015 }
00016 
00017 // should not be used -- implemented only because omnet++ expects it
00018 void AggrPkt::setStoredPackets(unsigned int k, const pApplPkt& storedPackets_var) {
00019 
00020 }
00021 
00022 // use these functions instead
00023 
00024 void AggrPkt::storePacket(pApplPkt& msg) {
00025   take(msg); // update ownership
00026   storedPackets.push_back(msg);
00027 }
00028 
00029 pApplPkt& AggrPkt::popFrontPacket() {
00030   pApplPkt& pkt = storedPackets.front();
00031   storedPackets.pop_front();
00032   drop(pkt); // update ownership
00033   return pkt;
00034 }
00035 
00036 bool AggrPkt::isEmpty() {
00037   return storedPackets.size() == 0;
00038 }