![]() |
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 RISE_PLMAPPING_CODERSPECIFICATION_HPP 00029 #define RISE_PLMAPPING_CODERSPECIFICATION_HPP 00030 00031 #include <WNS/service/phy/phymode/PhyModeInterface.hpp> 00032 #include <WNS/service/phy/phymode/MI2PERInterface.hpp> 00033 #include <WNS/container/Registry.hpp> 00034 #include <WNS/Singleton.hpp> 00035 #include <WNS/pyconfig/View.hpp> 00036 #include <string> 00037 #include <vector> 00038 00039 namespace rise { namespace plmapping { 00040 00042 typedef wns::service::phy::phymode::Coding Coding; 00043 const Coding UNDEFINED_CODING = 0u; // global constant 00044 00047 class CoderSpecification : 00048 virtual public wns::service::phy::phymode::CoderSpecInterface 00049 { 00050 public: 00051 CoderSpecification(Coding _coding, double _rate, std::string& _name) : 00052 coding(_coding), 00053 rate(_rate), 00054 name(_name) 00055 {} 00056 virtual ~CoderSpecification(){} 00057 Coding getCoding() const { return coding; } 00058 double getRate() const { return rate; } 00059 bool hasNoCoding() const { return (rate==1.0); } 00060 const std::string& getName() const { return name; } // by reference 00061 protected: 00062 CoderSpecification() {}; // empty constructor needed for inherited class 00063 Coding coding; // integer index 00064 double rate; 00065 std::string name; 00066 }; 00067 00071 class CoderMapping : 00072 virtual public wns::service::phy::phymode::CoderMappingInterface { 00073 protected: 00074 unsigned int maxCodeIndex; 00075 std::vector<CoderSpecification> coderSpecificationVector; 00076 wns::container::Registry<std::string, Coding> codename2int; 00077 public: 00078 /* @brief Constructor */ 00079 CoderMapping(const wns::pyconfig::View& config); 00080 /* @brief Destructor */ 00081 virtual ~CoderMapping(){}; 00082 00084 virtual bool isConfigured() const; 00085 00087 unsigned int 00088 getMaxCodeIndex() const { return maxCodeIndex; }; 00089 00090 /* @brief get coding rate for coder given by name */ 00091 virtual double 00092 getRate(const std::string& s) const; 00093 00094 /* @brief get coding rate */ 00095 virtual double 00096 getRate(Coding coding) const; 00097 00098 /* @brief get coding (int) from name */ 00099 virtual Coding 00100 fromString(const std::string& s) const; 00101 00102 /* @brief get coder name */ 00103 virtual const std::string& 00104 getString(Coding c) const; 00105 00106 /* @brief get coder specification */ 00107 virtual const CoderSpecification& 00108 getCoderSpecification(Coding c) const; 00109 }; 00110 00111 }} 00112 00113 #endif // RISE_PLMAPPING_CODERSPECIFICATION_HPP
1.5.5