![]() |
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 __SCRECEIVER_HPP 00029 #define __SCRECEIVER_HPP 00030 00031 #include <RISE/transceiver/transmitter.hpp> 00032 #include <RISE/misc/pointer.hpp> 00033 #include <RISE/transceiver/receiver.hpp> 00034 #include <RISE/transmissionobjects/broadcasttransmissionobject.hpp> 00035 #include <RISE/misc/RISELogger.hpp> 00036 #include <RISE/receiver/LossCalculation.hpp> 00037 00038 #include <WNS/PowerRatio.hpp> 00039 #include <WNS/DoubleDispatcher.hpp> 00040 #include <WNS/TypeInfo.hpp> 00041 #include <WNS/TimeWeightedAverage.hpp> 00042 #include <WNS/Cache.hpp> 00043 #include <WNS/pyconfig/View.hpp> 00044 00045 #include <sstream> 00046 #include <list> 00047 00048 namespace rise 00049 { 00050 class Transmitter; 00051 class Station; 00052 class Demodulator; 00053 class Decoder; 00054 class PropagationCache; 00055 class PropCacheEntry; 00056 class Scenario; 00057 00062 class SCReceiver : 00063 public Receiver, 00064 protected receiver::LossCalculation 00065 { 00066 00067 public: 00069 00077 SCReceiver(const wns::pyconfig::View& config, 00078 Station* s, 00079 antenna::Antenna* a, 00080 Demodulator *demodulator, 00081 Decoder *decoder, 00082 wns::Ratio rnf); 00083 00085 virtual ~SCReceiver(); 00086 virtual void startReceiving(); 00087 00089 00096 virtual void stopReceiving(); 00097 00099 00106 virtual void notify(TransmissionObjectPtr transmissionObject); 00107 00109 // Receiver is listening to. 00114 virtual wns::Power getTotalRxPower(); 00115 00122 virtual wns::Power getInterference(const TransmissionObjectPtr& t); 00123 00125 virtual wns::Power getRxPower(const TransmissionObjectPtr& t); 00126 00128 virtual wns::Power getNoise(); 00129 00130 virtual wns::Ratio getLoss(Transmitter* t); 00131 00132 virtual void tune(double f, double b); 00133 00140 virtual bool contains(TransmissionObjectPtr); 00141 00142 virtual double getFrequency(); 00143 }; 00144 00145 00146 template<typename DerivedReceiver> 00147 class ReceiverWithDispatcher : public SCReceiver { 00148 typedef wns::DoubleDispatcher<DerivedReceiver, const TransmissionObjectPtr&> D; 00149 public: 00150 ReceiverWithDispatcher(const wns::pyconfig::View& config, 00151 Station* s, 00152 antenna::Antenna* a, 00153 Demodulator *demodulator, 00154 Decoder *decoder, 00155 wns::Ratio rnf) 00156 : SCReceiver(config, s, a, demodulator, decoder, rnf) 00157 { 00158 if(!instantiated) { 00159 DerivedReceiver::initDispatcher(); 00160 instantiated = true; 00161 } 00162 } 00163 protected: 00164 static D* getDispatcher() { 00165 static D d; 00166 return &d; 00167 } 00168 00169 static bool instantiated; 00170 }; 00171 template <typename DerivedReceiver> bool ReceiverWithDispatcher<DerivedReceiver>::instantiated = false; 00172 00173 } 00174 #endif 00175 00176
1.5.5