|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2004, 2008 Andras Varga 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #ifndef __INET_ABSTRACTQUEUE_H 00019 #define __INET_ABSTRACTQUEUE_H 00020 00021 #include <omnetpp.h> 00022 #include "INETDefs.h" 00023 00024 00030 class INET_API AbstractQueue : public cSimpleModule 00031 { 00032 public: 00033 AbstractQueue(); 00034 virtual ~AbstractQueue(); 00035 00036 private: 00037 cPacket *msgServiced; 00038 cMessage *endServiceMsg; 00039 00040 private: 00041 void doStartService(); 00042 void doEndService(); 00043 00044 protected: 00048 cPacketQueue queue; 00049 00050 virtual void initialize(); 00051 virtual void handleMessage(cMessage *msg); 00052 00064 virtual void arrival(cPacket *msg) = 0; 00065 00078 virtual cPacket *arrivalWhenIdle(cPacket *msg) = 0; 00079 00085 virtual simtime_t startService(cPacket *msg) = 0; 00086 00093 virtual void endService(cPacket *msg) = 0; 00095 }; 00096 00097 #endif 00098 00099