00001 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2005,2006,2007 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 00019 */ 00020 #ifndef PROPAGATION_DELAY_MODEL_H 00021 #define PROPAGATION_DELAY_MODEL_H 00022 00023 #include "ns3/ptr.h" 00024 #include "ns3/object.h" 00025 #include "ns3/nstime.h" 00026 #include "ns3/random-variable.h" 00027 00028 namespace ns3 { 00029 00030 class MobilityModel; 00031 00032 /** 00033 * \brief calculate a propagation delay. 00034 */ 00035 class PropagationDelayModel : public Object 00036 { 00037 public: 00038 static TypeId GetTypeId (void); 00039 virtual ~PropagationDelayModel (); 00040 /** 00041 * \param a the source 00042 * \param b the destination 00043 * \returns the calculated propagation delay 00044 * 00045 * Calculate the propagation delay between the specified 00046 * source and destination. 00047 */ 00048 virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const = 0; 00049 }; 00050 00051 /** 00052 * \brief the propagation delay is random 00053 */ 00054 class RandomPropagationDelayModel : public PropagationDelayModel 00055 { 00056 public: 00057 static TypeId GetTypeId (void); 00058 00059 /** 00060 * Use the default parameters from PropagationDelayRandomDistribution. 00061 */ 00062 RandomPropagationDelayModel (); 00063 virtual ~RandomPropagationDelayModel (); 00064 virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const; 00065 private: 00066 RandomVariable m_variable; 00067 }; 00068 00069 /** 00070 * \brief the propagation speed is constant 00071 */ 00072 class ConstantSpeedPropagationDelayModel : public PropagationDelayModel 00073 { 00074 public: 00075 static TypeId GetTypeId (void); 00076 00077 /** 00078 * Use the default parameters from PropagationDelayConstantSpeed. 00079 */ 00080 ConstantSpeedPropagationDelayModel (); 00081 virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const; 00082 /** 00083 * \param speed the new speed (m/s) 00084 */ 00085 void SetSpeed (double speed); 00086 /** 00087 * \returns the current propagation speed (m/s). 00088 */ 00089 double GetSpeed (void) const; 00090 private: 00091 double m_speed; 00092 }; 00093 00094 } // namespace ns3 00095 00096 #endif /* PROPAGATION_DELAY_MODEL_H */