![]() |
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 _MI2PER_HPP 00029 #define _MI2PER_HPP 00030 00031 #include <limits.h> 00032 #include <WNS/PyConfigViewCreator.hpp> 00033 #include <WNS/Enum.hpp> 00034 #include <WNS/logger/Logger.hpp> 00035 #include <WNS/container/Registry.hpp> 00036 #include <WNS/container/Mapping.hpp> 00037 #include <WNS/Singleton.hpp> 00038 #include <WNS/pyconfig/View.hpp> 00039 00040 #include <RISE/plmapping/PhyMode.hpp> 00041 #include <RISE/plmapping/CodeRates.hpp> 00042 00043 namespace rise { namespace plmapping { 00044 00045 namespace tests { 00046 class MI2PERTest; 00047 class CoderFullTests; 00048 } 00049 00051 typedef std::vector< int > CodeWordLengths; 00052 00056 class CoderFullSpecification : 00057 virtual public wns::service::phy::phymode::CoderFullSpecInterface, 00058 public CoderSpecification // base class 00059 { 00060 public: 00061 CoderFullSpecification(const wns::pyconfig::View&){} 00062 virtual ~CoderFullSpecification(){} 00063 00065 virtual double mapMI2PER(double mi, unsigned int blockLength) const = 0; 00068 virtual double PER2MIB(double per, unsigned int blockLength) const = 0; 00069 }; 00070 00071 typedef wns::PyConfigViewCreator<CoderFullSpecification> CoderSpecCreator; 00072 typedef wns::StaticFactory<CoderSpecCreator> CoderSpecFactory; 00073 00077 class TableCoder : 00078 public CoderFullSpecification 00079 { 00080 friend class tests::MI2PERTest; 00081 friend class tests::CoderFullTests; 00082 00084 typedef std::vector< double > LookupTable; 00086 //typedef wns::container::Registry< int, LookupTable > SizeRegistry; 00088 typedef std::vector< LookupTable > VectorOfTablesByCWLSize; 00089 public: 00090 TableCoder(const wns::pyconfig::View& config); 00091 virtual ~TableCoder(){} 00093 virtual double mapMI2PER(double mi, unsigned int blockLength) const; 00096 virtual double PER2MIB(double per, unsigned int blockLength) const; 00097 private: 00105 virtual unsigned int suitableCWL(unsigned int CWL) const; 00107 virtual const CodeWordLengths& getCWLvector() const; 00109 virtual unsigned int suitableCWLposition(unsigned int CWL) const; 00110 00111 unsigned int numberOfCWLs; 00113 VectorOfTablesByCWLSize vectorOfTablesByCWLSize; 00115 CodeWordLengths codeWordLengths; 00117 wns::logger::Logger logger; 00118 }; 00119 00123 class FormulaCoder : 00124 public CoderFullSpecification 00125 { 00126 public: 00127 FormulaCoder(const wns::pyconfig::View& config) : 00128 CoderFullSpecification(config) 00129 {} 00130 00131 virtual ~FormulaCoder(){} 00132 00134 virtual double mapMI2PER(double mi, unsigned int blockLength) const; 00137 virtual double PER2MIB(double per, unsigned int blockLength) const; 00138 }; 00139 00145 class CoderFullMapping : 00146 virtual public wns::service::phy::phymode::CoderFullMappingInterface, 00147 public CoderMapping 00148 { 00149 friend class tests::MI2PERTest; 00150 friend class tests::CoderFullTests; 00151 public: 00152 CoderFullMapping(const wns::pyconfig::View& config); 00153 virtual ~CoderFullMapping(); 00154 00156 double mapMI2PER(double mi, 00157 unsigned int blockLength, 00158 Coding coding) const; 00159 00162 double PER2MIB(double per, unsigned int blockLength, Coding coding) const; 00163 00164 private: 00166 virtual bool isConfigured() const; 00167 00168 /* @brief get coder full specification */ 00169 virtual const CoderFullSpecification& 00170 getCoderFullSpecification(Coding c) const; 00171 00173 typedef std::vector< CoderFullSpecification* > CoderFullSpecVector; 00174 CoderFullSpecVector coderFullSpecVector; 00175 00177 wns::logger::Logger logger; 00178 }; 00179 00180 00184 class GENERICM2P : 00185 virtual public wns::service::phy::phymode::MI2PERMappingInterface 00186 { 00187 public: 00188 GENERICM2P(const wns::pyconfig::View& config); 00189 virtual ~GENERICM2P(){} 00190 00192 virtual double mapMI2PER(double mi, 00193 unsigned int blockLength, 00194 Coding coding) const; 00195 00196 private: 00197 wns::service::phy::phymode::MI2PERMappingInterface* coderFullMapping; 00198 }; 00199 00203 typedef GENERICM2P WINNERM2P; 00204 00208 class FixedM2P : 00209 virtual public wns::service::phy::phymode::MI2PERMappingInterface 00210 { 00211 public: 00212 explicit FixedM2P(const wns::pyconfig::View& config) : 00213 fixedPER(config.get<double>("PER")) 00214 {} 00215 virtual ~FixedM2P(){} 00216 virtual double mapMI2PER(double, unsigned int, Coding) const 00217 { 00218 return fixedPER; 00219 } 00220 private: 00221 double fixedPER; 00222 }; 00223 00227 class FormulaM2P : 00228 virtual public wns::service::phy::phymode::MI2PERMappingInterface 00229 { 00230 public: 00231 explicit FormulaM2P(const wns::pyconfig::View&){} 00232 virtual ~FormulaM2P(){} 00233 virtual double mapMI2PER(double, unsigned int, Coding) const 00234 { 00235 return 0.0; // TODO 00236 } 00237 }; 00238 00239 }} // namespaces 00240 00241 #endif //MI2PER_HPP 00242 00243
1.5.5