User Manual, Developers Guide and API Documentation

MI2PERInterface.hpp

Go to the documentation of this file.
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 #include <WNS/service/phy/phymode/PhyModeInterface.hpp>
00029 #include <WNS/StaticFactory.hpp>
00030 #include <WNS/pyconfig/View.hpp>
00031 
00032 #ifndef WNS_SERVICE_PHY_PHYMODE_MI2PER_HPP
00033 #define WNS_SERVICE_PHY_PHYMODE_MI2PER_HPP
00034 
00035 namespace wns { namespace service { namespace phy { namespace phymode {
00036 
00042     class MI2PERInterface
00043     {
00044     public:
00045         virtual ~MI2PERInterface(){}
00046 
00047         virtual double mapMI2PER(double mi,
00048                                  unsigned int blockLength) const = 0;
00049     };
00050 
00052     class CoderSpecInterface
00053     {
00054     public:
00055         virtual
00056         ~CoderSpecInterface() {};
00057 
00058         virtual Coding
00059         getCoding() const = 0;
00060 
00061         virtual double
00062         getRate() const = 0;
00063 
00064         virtual bool
00065         hasNoCoding() const = 0;
00066 
00067         virtual const std::string&
00068         getName() const = 0;
00069     };
00070 
00072     class CoderMappingInterface
00073     {
00074     public:
00075         virtual ~CoderMappingInterface() {};
00076 
00077         /* @brief get coding rate for coder given by name */
00078         virtual double
00079         getRate(const std::string& s) const = 0;
00080 
00081         /* @brief get coding rate */
00082         virtual double
00083         getRate(Coding coding) const = 0;
00084 
00085         /* @brief get coding (int) from name */
00086         virtual Coding
00087         fromString(const std::string& s) const = 0;
00088 
00089         /* @brief get coder name */
00090         virtual const std::string&
00091         getString(Coding c) const = 0;
00092 
00093         /* @brief get coder specification */
00094         virtual const CoderSpecInterface&
00095         getCoderSpecification(Coding c) const = 0;
00096 
00098         static CoderMappingInterface*
00099         getCoderMapping(const wns::pyconfig::View& config);
00100 
00102         virtual unsigned int
00103         getMaxCodeIndex() const = 0;
00104     };
00105 
00107     class CoderFullSpecInterface :
00108         virtual public CoderSpecInterface,
00109         virtual public MI2PERInterface
00110     {
00111     public:
00112         virtual ~CoderFullSpecInterface() {}
00113     };
00114 
00115     class MI2PERMappingInterface
00116     {
00117     public:
00118         virtual ~MI2PERMappingInterface() {}
00119 
00121         virtual double
00122         mapMI2PER(double mi,
00123                   unsigned int blockLength,
00124                   Coding coding) const = 0;
00125     };
00126 
00127     typedef wns::PyConfigViewCreator<MI2PERMappingInterface, MI2PERMappingInterface> MI2PERMappingCreator;
00128     typedef wns::StaticFactory<MI2PERMappingCreator> MI2PERMappingFactory;
00129 
00131     inline MI2PERMappingInterface*
00132     createMI2PERMappingInterface(const wns::pyconfig::View& config)
00133     {
00134         std::string name = config.get<std::string>("mapperName");
00135         return MI2PERMappingFactory::creator(name)->create(config);
00136     }
00137 
00139     class CoderFullMappingInterface :
00140         virtual public MI2PERMappingInterface,
00141         virtual public CoderMappingInterface
00142     {
00143     public:
00144         virtual ~CoderFullMappingInterface() {}
00145 
00146         /* @brief get coder full specification */
00147         virtual const CoderFullSpecInterface&
00148         getCoderFullSpecification(Coding c) const = 0;
00149 
00151         static CoderFullMappingInterface*
00152         getCoderFullMapping(const wns::pyconfig::View& config);
00153     };
00154 
00155     typedef PyConfigViewCreator<MI2PERMappingInterface> MI2PERMappingCreator;
00156 
00157 } // phymode
00158 } // phy
00159 } // service
00160 } // wns
00161 
00162 #endif // WNS_SERVICE_PHY_PHYMODE_MI2PER_HPP

Generated on Fri May 25 03:31:56 2012 for openWNS by  doxygen 1.5.5