A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
propagation-delay-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006,2007 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19#ifndef PROPAGATION_DELAY_MODEL_H
20#define PROPAGATION_DELAY_MODEL_H
21
22#include "ns3/nstime.h"
23#include "ns3/object.h"
24#include "ns3/ptr.h"
25#include "ns3/random-variable-stream.h"
26
27namespace ns3
28{
29
30class MobilityModel;
31
32/**
33 * \ingroup propagation
34 *
35 * \brief calculate a propagation delay.
36 */
38{
39 public:
40 /**
41 * \brief Get the type ID.
42 * \return the object TypeId
43 */
44 static TypeId GetTypeId();
45 ~PropagationDelayModel() override;
46 /**
47 * \param a the source
48 * \param b the destination
49 * \returns the calculated propagation delay
50 *
51 * Calculate the propagation delay between the specified
52 * source and destination.
53 */
55 /**
56 * If this delay model uses objects of type RandomVariableStream,
57 * set the stream numbers to the integers starting with the offset
58 * 'stream'. Return the number of streams (possibly zero) that
59 * have been assigned.
60 *
61 * \param stream first stream index to use
62 * \return the number of stream indices assigned by this model
63 */
64 int64_t AssignStreams(int64_t stream);
65
66 protected:
67 /**
68 * Assign a fixed random variable stream number to the random variables used by this model.
69 *
70 * Subclasses must implement this; those not using random variables
71 * can return zero.
72 *
73 * \param stream first stream index to use
74 * \return the number of stream indices assigned by this model
75 */
76 virtual int64_t DoAssignStreams(int64_t stream) = 0;
77};
78
79/**
80 * \ingroup propagation
81 *
82 * \brief the propagation delay is random
83 */
85{
86 public:
87 /**
88 * \brief Get the type ID.
89 * \return the object TypeId
90 */
91 static TypeId GetTypeId();
92
93 /**
94 * Use the default parameters from PropagationDelayRandomDistribution.
95 */
99
100 private:
101 int64_t DoAssignStreams(int64_t stream) override;
103};
104
105/**
106 * \ingroup propagation
107 *
108 * \brief the propagation speed is constant
109 */
111{
112 public:
113 /**
114 * \brief Get the type ID.
115 * \return the object TypeId
116 */
117 static TypeId GetTypeId();
118
119 /**
120 * Use the default parameters from PropagationDelayConstantSpeed.
121 */
124 /**
125 * \param speed the new speed (m/s)
126 */
127 void SetSpeed(double speed);
128 /**
129 * \returns the current propagation speed (m/s).
130 */
131 double GetSpeed() const;
132
133 private:
134 int64_t DoAssignStreams(int64_t stream) override;
135 double m_speed; //!< speed
136};
137
138} // namespace ns3
139
140#endif /* PROPAGATION_DELAY_MODEL_H */
Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
ConstantSpeedPropagationDelayModel()
Use the default parameters from PropagationDelayConstantSpeed.
static TypeId GetTypeId()
Get the type ID.
A base class which provides memory management and object aggregation.
Definition: object.h:89
calculate a propagation delay.
static TypeId GetTypeId()
Get the type ID.
virtual int64_t DoAssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
int64_t AssignStreams(int64_t stream)
If this delay model uses objects of type RandomVariableStream, set the stream numbers to the integers...
virtual Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
the propagation delay is random
RandomPropagationDelayModel()
Use the default parameters from PropagationDelayRandomDistribution.
Ptr< RandomVariableStream > m_variable
random generator
static TypeId GetTypeId()
Get the type ID.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.