00001 00002 #ifndef FADING_H 00003 #define FADING_H 00004 00005 #include <map> 00006 using namespace std; 00007 #include <boost/shared_ptr.hpp> 00008 #include <boost/utility.hpp> 00009 00010 #include "utility.hpp" 00011 00012 class WirelessCommSignal; 00013 class PhysicalLayer; 00014 class NodeId; 00015 00019 class Fading : boost::noncopyable { 00020 public: 00022 typedef boost::shared_ptr<Fading> FadingPtr; 00023 00025 virtual ~Fading(); 00026 00034 virtual double fadingFactor(const WirelessCommSignal& signal, 00035 const NodeId& nodeId) = 0; 00036 00037 protected: 00038 00041 map<NodeId,int> m_nodeOffset; 00042 00044 Fading(); 00045 00047 Fading(const Fading& rhs); 00048 00049 private: 00050 00052 Fading& operator= (const Fading& rhs); 00053 00054 }; 00055 typedef boost::shared_ptr<Fading> FadingPtr; 00056 00064 class Ricean : public Fading { 00065 public: 00067 typedef boost::shared_ptr<Ricean> RiceanPtr; 00068 00073 static inline RiceanPtr create(); 00074 00079 static inline RiceanPtr create(const Ricean& rhs); 00080 00088 static inline RiceanPtr create(double maxVelocity, double k); 00089 00097 virtual double fadingFactor(const WirelessCommSignal& signal, 00098 const NodeId& nodeId); 00099 00100 protected: 00101 00103 Ricean(); 00104 00109 Ricean(double maxVelocity, double k); 00110 00112 Ricean(const Ricean& rhs); 00113 00116 static const double m_DEFAULT_MAX_VELOCITY; 00117 00118 private: 00119 00121 static const double m_DEFAULT_K; 00122 00125 static const t_uint m_NUMBER_OF_POINTS; 00126 00129 static const double m_MAX_DOPPLER_FREQUENCY; 00130 00132 static const double m_MAX_SAMPLE_RATE; 00133 00135 static const double m_GAUSSIAN_DATA1[]; 00136 00138 static const double m_GAUSSIAN_DATA2[]; 00139 00142 double m_maxVelocity; 00143 00145 double m_kParameter; 00146 00148 Ricean& operator= (const Ricean& rhs); 00149 00150 }; 00151 typedef boost::shared_ptr<Ricean> RiceanPtr; 00152 00156 class Rayleigh : public Ricean { 00157 public: 00159 typedef boost::shared_ptr<Rayleigh> RayleighPtr; 00160 00165 static inline RayleighPtr create(); 00166 00171 static inline RayleighPtr create(const Rayleigh& rhs); 00172 00179 static inline RayleighPtr create(double maxVelocity); 00180 00181 protected: 00182 00184 Rayleigh(); 00185 00189 Rayleigh(double maxVelocity); 00190 00192 Rayleigh(const Rayleigh& rhs); 00193 00194 private: 00195 00197 Rayleigh& operator= (const Rayleigh& rhs); 00198 00199 }; 00200 typedef boost::shared_ptr<Rayleigh> RayleighPtr; 00201 00203 // Inline Functions 00205 00206 inline RiceanPtr Ricean::create() 00207 { 00208 RiceanPtr p(new Ricean()); 00209 return p; 00210 } 00211 00212 inline RiceanPtr Ricean::create(double maxVelocity, double k) 00213 { 00214 RiceanPtr p(new Ricean(maxVelocity, k)); 00215 return p; 00216 } 00217 00218 inline RiceanPtr Ricean::create(const Ricean& rhs) 00219 { 00220 RiceanPtr p(new Ricean(rhs)); 00221 return p; 00222 } 00223 00224 inline RayleighPtr Rayleigh::create() 00225 { 00226 RayleighPtr p(new Rayleigh()); 00227 return p; 00228 } 00229 00230 inline RayleighPtr Rayleigh::create(double maxVelocity) 00231 { 00232 RayleighPtr p(new Rayleigh(maxVelocity)); 00233 return p; 00234 } 00235 00236 inline RayleighPtr Rayleigh::create(const Rayleigh& rhs) 00237 { 00238 RayleighPtr p(new Rayleigh(rhs)); 00239 return p; 00240 } 00241 00243 // Overloaded Operators 00245 00246 #endif // FADING_H 00247