![]() |
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_LDK_BUFFER_DROPPING_HPP 00029 #define WNS_LDK_BUFFER_DROPPING_HPP 00030 00031 #include <WNS/ldk/buffer/Buffer.hpp> 00032 00033 #include <WNS/ldk/fu/Plain.hpp> 00034 #include <WNS/ldk/Delayed.hpp> 00035 00036 #include <WNS/pyconfig/View.hpp> 00037 #include <WNS/StaticFactory.hpp> 00038 00039 #include <WNS/logger/Logger.hpp> 00040 00041 #include <list> 00042 #include <memory> 00043 00044 namespace wns { namespace ldk { namespace buffer { 00045 00050 namespace dropping 00051 { 00052 typedef std::list<CompoundPtr> ContainerType; 00053 00058 class Drop : 00059 public virtual CloneableInterface 00060 { 00061 public: 00062 typedef wns::Creator<Drop> Creator; 00063 typedef wns::StaticFactory<Creator> Factory; 00064 00065 virtual CompoundPtr 00066 operator()(ContainerType& container) const = 0; 00067 00068 virtual 00069 ~Drop() 00070 {} 00071 }; 00072 00077 namespace drop 00078 { 00083 class Tail : 00084 public Drop, 00085 public Cloneable<Tail> 00086 { 00087 virtual CompoundPtr 00088 operator()(ContainerType& container) const; 00089 }; 00090 00095 class Front : 00096 public Drop, 00097 public Cloneable<Front> 00098 { 00099 virtual CompoundPtr 00100 operator()(ContainerType& container) const; 00101 }; 00102 00103 /* TODO: 00104 * class Random... 00105 */ 00106 } 00107 } 00108 00117 class Dropping : 00118 public Buffer, 00119 public fu::Plain<Dropping>, 00120 public Delayed<Dropping> 00121 { 00122 typedef unsigned long int PDUCounter; 00123 00124 public: 00125 00129 Dropping(fun::FUN* fuNet, const wns::pyconfig::View& config); 00130 00134 Dropping(const Dropping& other); 00135 00139 virtual 00140 ~Dropping(); 00141 00142 // 00143 // Delayed interface 00144 // 00145 virtual void 00146 processIncoming(const CompoundPtr& compound); 00147 00148 virtual bool 00149 hasCapacity() const; 00150 00151 virtual void 00152 processOutgoing(const CompoundPtr& compound); 00153 00154 virtual const CompoundPtr 00155 hasSomethingToSend() const; 00156 00157 virtual CompoundPtr 00158 getSomethingToSend(); 00159 00160 // 00161 // Buffer interface 00162 // 00163 virtual unsigned long int 00164 getSize(); 00165 00166 virtual unsigned long int 00167 getMaxSize(); 00168 00169 protected: 00170 dropping::ContainerType buffer; 00171 00172 private: 00173 unsigned long int maxSize; 00174 unsigned long int currentSize; 00175 00176 std::auto_ptr<SizeCalculator> sizeCalculator; 00177 std::auto_ptr<dropping::Drop> dropper; 00178 00179 PDUCounter totalPDUs; 00180 PDUCounter droppedPDUs; 00181 00182 logger::Logger logger; 00183 }; 00184 00185 }}} 00186 00187 00188 #endif // NOT defined WNS_LDK_BUFFER_DROPPING_HPP 00189 00190
1.5.5