![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2009 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 5, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #ifndef WNS_SCHEDULER_QUEUE_SIMPLEQUEUE_HPP 00029 #define WNS_SCHEDULER_QUEUE_SIMPLEQUEUE_HPP 00030 00031 #include <WNS/scheduler/SchedulerTypes.hpp> 00032 #include <WNS/scheduler/queue/QueueInterface.hpp> 00033 #include <WNS/StaticFactory.hpp> 00034 #include <WNS/ldk/CommandTypeSpecifier.hpp> 00035 00036 #include <WNS/probe/bus/ContextCollector.hpp> 00037 00038 #include <map> 00039 #include <queue> 00040 00041 namespace wns { namespace ldk { 00042 class HasReceptorInterface; 00043 }} 00044 00045 namespace wns { namespace scheduler { namespace queue { 00046 00049 class SimpleQueue : 00050 public QueueInterface 00051 { 00052 public: 00053 SimpleQueue(wns::ldk::HasReceptorInterface*, const wns::pyconfig::View& config); 00054 virtual ~SimpleQueue(); 00055 00056 bool isAccepting(const wns::ldk::CompoundPtr& compound) const; 00058 void put(const wns::ldk::CompoundPtr& compound); 00059 00060 UserSet getQueuedUsers() const; 00061 ConnectionSet getActiveConnections() const; 00062 00063 unsigned long int numCompoundsForCid(ConnectionID cid) const; 00064 unsigned long int numBitsForCid(ConnectionID cid) const; 00065 00066 QueueStatusContainer getQueueStatus() const; 00067 00069 wns::ldk::CompoundPtr getHeadOfLinePDU(ConnectionID cid); 00070 int getHeadOfLinePDUbits(ConnectionID cid); 00071 00072 bool isEmpty() const; 00073 bool hasQueue(ConnectionID cid); 00074 bool queueHasPDUs(ConnectionID cid) const; 00075 ConnectionSet filterQueuedCids(ConnectionSet connections); 00076 00077 void setColleagues(RegistryProxyInterface* _registry); 00079 void setFUN(wns::ldk::fun::FUN* fun); 00080 00081 std::string printAllQueues(); 00082 00083 ProbeOutput resetAllQueues(); 00084 ProbeOutput resetQueues(UserID user); 00085 ProbeOutput resetQueue(ConnectionID cid); 00086 00087 void frameStarts() {}; 00088 00090 bool supportsDynamicSegmentation() const { return false; } 00092 wns::ldk::CompoundPtr getHeadOfLinePDUSegment(ConnectionID cid, int bits) { throw wns::Exception("getHeadOfLinePDUSegment() is unsupported"); return wns::ldk::CompoundPtr(); } 00094 int getMinimumSegmentSize() const { throw wns::Exception("getHeadOfLinePDUSegment() is unsupported"); return 0; }; 00095 00099 std::queue<wns::ldk::CompoundPtr> 00100 getQueueCopy(ConnectionID cid); 00101 00102 protected: 00103 void 00104 probe(); 00105 00106 private: 00107 wns::probe::bus::contextprovider::Variable* probeContextProviderForCid; 00108 wns::probe::bus::contextprovider::Variable* probeContextProviderForPriority; 00109 wns::probe::bus::ContextCollectorPtr sizeProbeBus; 00110 // Every CID has its own queue. A user might have multiple CIDs 00111 // associated with it. Queue length counters exist for every queue/CID. 00112 struct Queue { 00113 Queue() 00114 : bits(0) 00115 {} 00116 Bits bits; 00117 std::queue<wns::ldk::CompoundPtr> pduQueue; 00118 }; 00119 00120 long int maxSize; 00121 00122 typedef std::map<ConnectionID, Queue> QueueContainer; 00123 QueueContainer queues; 00124 00125 struct Colleagues { 00126 Colleagues() : registry(NULL) {} 00127 RegistryProxyInterface* registry; 00128 } colleagues; 00129 00130 wns::logger::Logger logger; 00131 wns::pyconfig::View config; 00132 wns::ldk::fun::FUN* myFUN; 00133 }; 00134 }}} // namespace wns::scheduler::queue 00135 #endif // WNS_SCHEDULER_QUEUE_SIMPLEQUEUE_HPP
1.5.5