User Manual, Developers Guide and API Documentation

Queues.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiMeMac                                                                    *
00003  * This file is part of openWNS (open Wireless Network Simulator)
00004  * _____________________________________________________________________________
00005  *
00006  * Copyright (C) 2004-2011
00007  * Chair of Communication Networks (ComNets)
00008  * Kopernikusstr. 5, D-52074 Aachen, Germany
00009  * phone: ++49-241-80-27910,
00010  * fax: ++49-241-80-22242
00011  * email: info@openwns.org
00012  * www: http://www.openwns.org
00013  * _____________________________________________________________________________
00014  *
00015  * openWNS is free software; you can redistribute it and/or modify it under the
00016  * terms of the GNU Lesser General Public License version 2 as published by the
00017  * Free Software Foundation;
00018  *
00019  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00020  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00021  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00022  * details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00026  *
00027  ******************************************************************************/
00028  
00029 #ifndef WIMEMAC_HELPER_QUEUES_H
00030 #define WIMEMAC_HELPER_QUEUES_H
00031 
00032 #include <WNS/service/dll/Address.hpp>
00033 
00034 #include <WNS/scheduler/SchedulerTypes.hpp>
00035 #include <WNS/StaticFactory.hpp>
00036 #include <WNS/ldk/CommandTypeSpecifier.hpp>
00037 #include <WNS/probe/bus/ContextCollector.hpp>
00038 #include <map>
00039 #include <queue>
00040 #include <WIMEMAC/helper/IQueueInterface.hpp>
00041 
00042 #include <boost/bind.hpp>
00043 #include <WNS/events/scheduler/Callable.hpp>
00044 
00045 
00046 namespace wimemac {namespace helper {
00047 
00048 class Queues:
00049     public IQueueInterface
00050 {
00051     public:
00052         Queues(const wns::pyconfig::View& _config, wns::ldk::fun::FUN* fun);
00053 
00054         virtual
00055         bool isAccepting(const wns::ldk::CompoundPtr& compound) const;
00056 
00057         virtual
00058         void put(const wns::ldk::CompoundPtr& compound);
00059 
00060         virtual
00061         void putFront(const wns::ldk::CompoundPtr& compound, wns::service::dll::UnicastAddress rx);
00062 
00063         virtual
00064         wns::ldk::CompoundPtr getHeadOfLinePDU(wns::service::dll::UnicastAddress macaddress);
00065 
00066         virtual
00067         int getHeadOfLinePDUbits(wns::service::dll::UnicastAddress macaddress);
00068 
00069         virtual
00070         bool hasQueue(wns::service::dll::UnicastAddress macaddress);
00071 
00072         virtual
00073         bool queueHasPDUs(wns::service::dll::UnicastAddress macaddress);
00074 
00075         virtual
00076         std::string printAllQueues();
00077 
00078         virtual
00079         void RemoveCompounds(wns::service::dll::UnicastAddress rx);
00080 
00081         wns::service::dll::UnicastAddress
00082         getNextPCAReceiver();
00083 
00084         void
00085         changePCAreceiver();
00086 
00087     private:
00088 
00089         struct Friends
00090         {
00091             wns::ldk::CommandReaderInterface* keyReader;
00092         } friends;
00093 
00094 
00095         struct Queue
00096         {
00097             Queue():
00098             bits(0),
00099             isNewQueue(true)
00100             {}
00101 
00102             Bit bits;
00103             wns::service::dll::UnicastAddress macaddress;
00104             bool isNewQueue;
00105             bool RemoveCompounds;
00106             std::deque<wns::ldk::CompoundPtr> pduQueue;
00107         };
00108 
00109         long int maxSize;
00110         bool deleteQueues;
00111         wns::service::dll::UnicastAddress nextPCAReceiver;
00112 
00113         typedef std::map<wns::service::dll::UnicastAddress, Queue> QueueContainer;
00114         QueueContainer queues;
00115 
00116         wns::events::scheduler::Interface* scheduler;
00117         wns::events::scheduler::Callable call;
00118         wns::simulator::Time FrameDuration;
00119         wns::logger::Logger logger;
00120         wns::pyconfig::View config;
00121 
00122 };
00123 
00124 
00125 
00126 }//helper
00127 }//wimemac
00128 
00129 
00130 #endif
00131 

Generated on Fri May 25 03:32:15 2012 for openWNS by  doxygen 1.5.5