src/devices/wifi/propagation-delay-model.h
changeset 6068 a2127017ecb4
parent 6067 ccbdc2b19ea5
parent 6062 f62b76f5c92a
child 6069 c21754b56036
equal deleted inserted replaced
6067:ccbdc2b19ea5 6068:a2127017ecb4
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2005,2006,2007 INRIA
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License version 2 as 
       
     7  * published by the Free Software Foundation;
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    17  *
       
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
       
    19  */
       
    20 #ifndef PROPAGATION_DELAY_MODEL_H
       
    21 #define PROPAGATION_DELAY_MODEL_H
       
    22 
       
    23 #include "ns3/ptr.h"
       
    24 #include "ns3/object.h"
       
    25 #include "ns3/nstime.h"
       
    26 #include "ns3/random-variable.h"
       
    27 
       
    28 namespace ns3 {
       
    29 
       
    30 class MobilityModel;
       
    31 
       
    32 /**
       
    33  * \brief calculate a propagation delay.
       
    34  */
       
    35 class PropagationDelayModel : public Object
       
    36 {
       
    37 public:
       
    38   static TypeId GetTypeId (void);
       
    39   virtual ~PropagationDelayModel ();
       
    40   /**
       
    41    * \param a the source
       
    42    * \param b the destination
       
    43    * \returns the calculated propagation delay
       
    44    *
       
    45    * Calculate the propagation delay between the specified
       
    46    * source and destination.
       
    47    */
       
    48   virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const = 0;
       
    49 };
       
    50 
       
    51 /**
       
    52  * \brief the propagation delay is random
       
    53  */
       
    54 class RandomPropagationDelayModel : public PropagationDelayModel
       
    55 {
       
    56 public:
       
    57   static TypeId GetTypeId (void);
       
    58 
       
    59   /**
       
    60    * Use the default parameters from PropagationDelayRandomDistribution.
       
    61    */
       
    62   RandomPropagationDelayModel ();
       
    63   virtual ~RandomPropagationDelayModel ();
       
    64   virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
       
    65 private:
       
    66   RandomVariable m_variable;
       
    67 };
       
    68 
       
    69 /**
       
    70  * \brief the propagation speed is constant
       
    71  */
       
    72 class ConstantSpeedPropagationDelayModel : public PropagationDelayModel
       
    73 {
       
    74 public:
       
    75   static TypeId GetTypeId (void);
       
    76 
       
    77   /**
       
    78    * Use the default parameters from PropagationDelayConstantSpeed.
       
    79    */
       
    80   ConstantSpeedPropagationDelayModel ();
       
    81   virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
       
    82   /**
       
    83    * \param speed the new speed (m/s)
       
    84    */
       
    85   void SetSpeed (double speed);
       
    86   /**
       
    87    * \returns the current propagation speed (m/s).
       
    88    */
       
    89   double GetSpeed (void) const;
       
    90 private:
       
    91   double m_speed;
       
    92 };
       
    93 
       
    94 } // namespace ns3
       
    95 
       
    96 #endif /* PROPAGATION_DELAY_MODEL_H */