![]() |
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-2007 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_DETAIL_INNERQUEUE_HPP 00029 #define WNS_SCHEDULER_QUEUE_DETAIL_INNERQUEUE_HPP 00030 00031 #include <WNS/simulator/Bit.hpp> 00032 #include <WNS/ldk/Compound.hpp> 00033 #include <WNS/probe/bus/ContextCollector.hpp> 00034 #include <queue> 00035 00036 namespace wns { namespace scheduler { namespace queue { namespace detail { 00037 00038 class InnerQueue 00039 { 00040 public: 00044 class RequestBelowMinimumSize : 00045 public Exception 00046 { 00047 public: 00048 explicit 00049 RequestBelowMinimumSize(const Bit size, const Bit headerSize) : 00050 Exception("Request is below minimum size.\n") 00051 { 00052 (*this) << "The minimum size to request is " 00053 << headerSize << " but " << size << " bits were requested."; 00054 } 00055 00056 virtual 00057 ~RequestBelowMinimumSize() throw() 00058 { 00059 } 00060 }; 00061 00065 class RetrieveException : 00066 public Exception 00067 { 00068 public: 00069 explicit 00070 RetrieveException(std::string reason) : 00071 Exception("An exception occured when trying to retrieve data from InnerQueue:\n") 00072 { 00073 (*this) << "Reason : " << reason; 00074 } 00075 00076 virtual 00077 ~RetrieveException() throw() 00078 { 00079 } 00080 }; 00081 00082 InnerQueue(); 00083 00088 Bit 00089 queuedNettoBits() const; 00090 00103 Bit 00104 queuedBruttoBits(Bit fixedHeaderSize, Bit extensionHeaderSize, bool byteAlignHeader) const; 00105 00109 int 00110 queuedCompounds() const; 00111 00115 bool 00116 empty() const; 00117 00121 void 00122 put(const wns::ldk::CompoundPtr& compound); 00123 00127 wns::ldk::CompoundPtr 00128 retrieve(Bit requestedBits, 00129 Bit fixedHeaderSize, 00130 Bit extensionHeaderSize, 00131 bool usePadding, 00132 bool byteAlignHeader, 00133 wns::ldk::CommandReaderInterface* reader, 00134 const wns::probe::bus::ContextCollectorPtr& = wns::probe::bus::ContextCollectorPtr(), 00135 wns::ldk::CommandReaderInterface* = NULL); 00136 00140 std::queue<wns::ldk::CompoundPtr> 00141 getQueueCopy(); 00142 00143 private: 00144 void 00145 probe(const wns::ldk::CompoundPtr& compound, 00146 const wns::probe::bus::ContextCollectorPtr& probeCC, 00147 wns::ldk::CommandReaderInterface* cmdReader); 00148 00149 typedef std::queue<wns::ldk::CompoundPtr> CompoundContainer; 00150 00151 CompoundContainer pduQueue_; 00152 00153 Bit nettoBits_; 00154 00155 long sequenceNumber_; 00156 00157 Bit frontSegmentSentBits_; 00158 }; 00159 00160 } // detail 00161 } // queue 00162 } // scheduler 00163 } // wns 00164 00165 #endif // WNS_SCHEDULER_QUEUE_DETAIL_INNERQUEUE_HPP
1.5.5