User Manual, Developers Guide and API Documentation

propagationcache.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 #ifndef __PROPCACHE_HPP
00029 #define __PROPCACHE_HPP
00030 
00031 #include <RISE/misc/RISELogger.hpp>
00032 #include <WNS/PowerRatio.hpp>
00033 #include <WNS/Position.hpp>
00034 #include <string>
00035 #include <algorithm>
00036 
00037 #include <boost/version.hpp>
00038 
00039 // From Boost 1.38 on the unordered_map container is present
00040 // at the same time hash_map becomes deprecated in GNU C++
00041 #if BOOST_VERSION < 103800
00042     #define WNS_USE_OLD_HASH_MAP
00043     #include <ext/hash_map>
00044 #else
00045     #include <boost/unordered_map.hpp>
00046 #endif
00047 
00048 namespace rise {
00049     class PropCacheEntry;
00050     class Transmitter;
00051     namespace receiver {
00052         class ReceiverInterface;
00053     }
00054 
00058     class FreqHashFunctor :
00059 #ifdef WNS_USE_OLD_HASH_MAP
00060         public __gnu_cxx::hash<double const>
00061 #else
00062         public boost::hash<double const>
00063 #endif
00064     {
00065     public:
00066         size_t operator()(double const k) const {
00067             return ((size_t)(k));
00068         }
00069     };
00070 
00074     template<class Value>
00075     class FreqHash :
00076 #ifdef WNS_USE_OLD_HASH_MAP
00077         public __gnu_cxx::hash_map<double const,
00078 #else
00079         public boost::unordered_map<double const,
00080 #endif
00081                              Value,
00082                              FreqHashFunctor,
00083                              std::equal_to<double> >
00084     {};
00085 
00101     class PropagationCache {
00102     public:
00106         PropagationCache(receiver::ReceiverInterface* r, const std::string& name);
00107 
00111         virtual ~PropagationCache();
00112 
00127         virtual wns::Ratio getLoss(Transmitter* txA, double freq)=0;
00128 
00132         virtual void invalidatePropagationEntries(Transmitter* t)=0;
00133 
00138         virtual void invalidatePropagationEntries()=0;
00139     protected:
00145         virtual void updatePropEntry(PropCacheEntry& cacheEntry,
00146                                      Transmitter* t,
00147                                      double freq);
00151         receiver::ReceiverInterface* receiver;
00155         RISELogger log;
00156     };
00157 }
00158 
00159 #endif // __PROPCACHE_HPP
00160 
00161 

Generated on Sun May 27 03:31:58 2012 for openWNS by  doxygen 1.5.5