![]() |
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_INNERCOPYQUEUE_HPP 00029 #define WNS_SCHEDULER_QUEUE_DETAIL_INNERCOPYQUEUE_HPP 00030 00031 #include <WNS/ldk/Compound.hpp> 00032 #include <WNS/simulator/Bit.hpp> 00033 #include <WNS/scheduler/SchedulerTypes.hpp> 00034 #include <WNS/scheduler/queue/detail/InnerQueue.hpp> 00035 #include <WNS/ldk/CommandTypeSpecifier.hpp> 00036 #include <queue> 00037 #include <map> 00038 00039 namespace wns { namespace scheduler { namespace queue { namespace detail { 00040 00041 class IInnerCopyQueue 00042 { 00043 public: 00044 virtual void 00045 setFUN(wns::ldk::fun::FUN* fun) = 0; 00046 00047 virtual bool 00048 knowsCID(ConnectionID cid) = 0; 00049 00050 virtual bool 00051 isEmpty(ConnectionID cid) = 0; 00052 00053 virtual wns::ldk::CompoundPtr 00054 getPDU(ConnectionID cid, Bit bit = 0) = 0; 00055 00056 virtual Bit 00057 getHeadofLinePDUBit(ConnectionID cid) = 0; 00058 00059 virtual void 00060 reset(ConnectionID cid) = 0; 00061 00062 virtual int 00063 getSize(ConnectionID cid) = 0; 00064 00065 virtual int 00066 getSizeInBit(ConnectionID cid) = 0; 00067 00068 virtual void 00069 setQueue(ConnectionID cid, std::queue<wns::ldk::CompoundPtr> queue) = 0; 00070 }; 00071 00072 class SimpleInnerCopyQueue: 00073 public IInnerCopyQueue 00074 { 00075 public: 00076 SimpleInnerCopyQueue(); 00077 00078 ~SimpleInnerCopyQueue(); 00079 00080 virtual void 00081 setFUN(wns::ldk::fun::FUN* fun){}; 00082 00083 virtual bool 00084 knowsCID(ConnectionID cid); 00085 00086 virtual bool 00087 isEmpty(ConnectionID cid); 00088 00089 virtual wns::ldk::CompoundPtr 00090 getPDU(ConnectionID cid, Bit bit = 0); 00091 00092 virtual Bit 00093 getHeadofLinePDUBit(ConnectionID cid); 00094 00095 virtual void 00096 reset(ConnectionID cid); 00097 00098 virtual int 00099 getSize(ConnectionID cid); 00100 00101 virtual int 00102 getSizeInBit(ConnectionID cid); 00103 00104 virtual void 00105 setQueue(ConnectionID cid, std::queue<wns::ldk::CompoundPtr> queue); 00106 00107 private: 00108 std::map<wns::scheduler::ConnectionID, std::queue<wns::ldk::CompoundPtr> > queue_; 00109 std::map<wns::scheduler::ConnectionID, int > queueSize_; 00110 }; 00111 00112 class SegmentingInnerCopyQueue: 00113 public IInnerCopyQueue 00114 { 00115 public: 00116 SegmentingInnerCopyQueue(const wns::pyconfig::View& _config); 00117 00118 ~SegmentingInnerCopyQueue(); 00119 00120 virtual void 00121 setFUN(wns::ldk::fun::FUN* fun); 00122 00123 virtual bool 00124 knowsCID(ConnectionID cid); 00125 00126 virtual bool 00127 isEmpty(ConnectionID cid); 00128 00129 virtual wns::ldk::CompoundPtr 00130 getPDU(ConnectionID cid, Bit bit); 00131 00132 virtual Bit 00133 getHeadofLinePDUBit(ConnectionID cid); 00134 00135 virtual void 00136 reset(ConnectionID cid); 00137 00138 virtual int 00139 getSize(ConnectionID cid); 00140 00141 virtual int 00142 getSizeInBit(ConnectionID cid); 00143 00144 virtual void 00145 setQueue(ConnectionID cid, std::queue<wns::ldk::CompoundPtr> queue); 00146 00147 unsigned long int 00148 getMinimumSegmentSize(); 00149 00150 private: 00151 std::map<ConnectionID, InnerQueue> queue_; 00152 00153 Bit fixedHeaderSize_; 00154 Bit extensionHeaderSize_; 00155 unsigned long int minimumSegmentSize_; 00156 bool usePadding_; 00157 bool byteAlignHeader_; 00158 std::string segmentHeaderCommandName_; 00159 00160 wns::ldk::CommandReaderInterface* segmentHeaderReader_; 00161 }; 00162 00163 } // detail 00164 } // queue 00165 } // scheduler 00166 } // wns 00167 00168 #endif // WNS_SCHEDULER_QUEUE_DETAIL_INNERCOPYQUEUE_HPP
1.5.5