![]() |
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_SAR_DYNAMICSAR_HPP 00029 #define WNS_LDK_SAR_DYNAMICSAR_HPP 00030 00031 #include <WNS/ldk/fu/Plain.hpp> 00032 #include <WNS/pyconfig/View.hpp> 00033 #include <WNS/logger/Logger.hpp> 00034 #include <WNS/SmartPtr.hpp> 00035 #include <WNS/RefCountable.hpp> 00036 00037 #include <list> 00038 00039 namespace wns { namespace search { 00040 class ISearch; 00041 } 00042 00043 namespace ldk { namespace sar { 00044 00045 class DynamicSARCommand 00046 : public Command 00047 { 00048 public: 00049 struct SegmentationInfo 00050 : public RefCountable 00051 { 00052 SegmentationInfo() 00053 : RefCountable(), 00054 numberSegments(0), 00055 receivedSegments() 00056 {} 00057 00058 int numberSegments; 00059 std::list<int> receivedSegments; 00060 }; 00061 00062 typedef SmartPtr<SegmentationInfo> SegmentationInfoPtr; 00063 00064 DynamicSARCommand() 00065 { 00066 local.segmentNumber = 0; 00067 magic.segmentSize = 1; 00068 magic.segInfoPtr = SegmentationInfoPtr(); 00069 } 00070 00071 struct { 00072 int segmentNumber; 00073 } local; 00074 struct {} peer; 00075 struct { 00076 int segmentSize; 00077 SegmentationInfoPtr segInfoPtr; 00078 } magic; 00079 00080 }; 00081 00082 00087 class DynamicSAR 00088 : public fu::Plain<DynamicSAR, DynamicSARCommand> 00089 { 00090 public: 00091 // FUNConfigCreator interface realisation 00092 DynamicSAR(fun::FUN* fuNet, const wns::pyconfig::View& config); 00093 ~DynamicSAR(); 00094 00095 // SDU and PCI size calculation 00096 void calculateSizes(const CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const; 00097 00098 bool 00099 compare(Bit currentSegmentSize); 00100 00101 private: 00102 virtual void 00103 doSendData(const CompoundPtr& compound); 00104 00105 virtual void 00106 doOnData(const CompoundPtr& compound); 00107 00108 virtual bool 00109 doIsAccepting(const CompoundPtr& compound) const; 00110 00111 virtual void 00112 doWakeup(); 00113 00114 void 00115 sendSegments(); 00116 00117 Bit maxSegmentSize_; 00118 wns::search::ISearch* searchAlgo_; 00119 00120 CompoundPtr currentCompound_; 00121 Bit currentCompoundSize_; 00122 Bit currentCompoundSentSize_; 00123 int segmentNumber_; 00124 int test; 00125 DynamicSARCommand::SegmentationInfoPtr currentSegInfoPtr_; 00126 00127 logger::Logger logger_; 00128 00129 }; 00130 00131 } // sar 00132 } // ldk 00133 } // wns 00134 00135 #endif // NOT defined WNS_LDK_SAR_DYNAMICSAR_HPP 00136 00137
1.5.5