00001 00002 #ifndef PATH_LOSS_H 00003 #define PATH_LOSS_H 00004 00005 #include <math.h> 00006 #include <boost/shared_ptr.hpp> 00007 #include <boost/utility.hpp> 00008 00009 class WirelessCommSignal; 00010 class PhysicalLayer; 00011 00015 class PathLoss : boost::noncopyable { 00016 public: 00018 typedef boost::shared_ptr<PathLoss> PathLossPtr; 00019 00021 virtual ~PathLoss(); 00022 00029 virtual double getRecvdStrength(const WirelessCommSignal& signal, 00030 const PhysicalLayer& receiver) const = 0; 00031 00032 protected: 00033 00035 static const bool m_DEBUG_SIGNAL_STRENGTH = false; 00036 00038 PathLoss(); 00039 00040 private: 00041 00042 }; 00043 typedef boost::shared_ptr<PathLoss> PathLossPtr; 00044 00059 class FreeSpace : public PathLoss { 00060 public: 00062 typedef boost::shared_ptr<FreeSpace> FreeSpacePtr; 00063 00068 static inline FreeSpacePtr create(); 00069 00075 static inline FreeSpacePtr create(double lossFactor); 00076 00083 virtual double getRecvdStrength(const WirelessCommSignal& signal, 00084 const PhysicalLayer& receiver) const; 00085 00086 protected: 00087 00089 FreeSpace(); 00090 00094 FreeSpace(double lossFactor); 00095 00096 protected: 00097 00099 static const double m_DEFAULT_LOSS_FACTOR; 00100 00103 double m_lossFactor; 00104 00105 private: 00106 00107 }; 00108 typedef boost::shared_ptr<FreeSpace> FreeSpacePtr; 00109 00126 class TwoRay : public FreeSpace { 00127 public: 00129 typedef boost::shared_ptr<TwoRay> TwoRayPtr; 00130 00135 static inline TwoRayPtr create(); 00136 00142 static inline TwoRayPtr create(double lossFactor); 00143 00150 virtual double getRecvdStrength(const WirelessCommSignal& signal, 00151 const PhysicalLayer& receiver) const; 00152 00153 protected: 00154 00156 TwoRay(); 00157 00161 TwoRay(double lossFactor); 00162 00163 00164 private: 00165 00166 static const double m_DEFAULT_ANTENNA_HEIGHT; 00167 00169 double m_antennaHeight; 00170 00171 }; 00172 typedef boost::shared_ptr<TwoRay> TwoRayPtr; 00173 00175 // Inline Functions 00177 00178 inline FreeSpacePtr FreeSpace::create() 00179 { 00180 FreeSpacePtr p(new FreeSpace()); 00181 return p; 00182 } 00183 00184 inline FreeSpacePtr FreeSpace::create(double lossFactor) 00185 { 00186 FreeSpacePtr p(new FreeSpace(lossFactor)); 00187 return p; 00188 } 00189 00190 inline TwoRayPtr TwoRay::create() 00191 { 00192 TwoRayPtr p(new TwoRay()); 00193 return p; 00194 } 00195 00196 inline TwoRayPtr TwoRay::create(double lossFactor) 00197 { 00198 TwoRayPtr p(new TwoRay(lossFactor)); 00199 return p; 00200 } 00201 00203 // Overloaded Operators 00205 00206 #endif // PATH_LOSS_H 00207