A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
data-rate.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
//
3
// Copyright (c) 2006 Georgia Tech Research Corporation
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: Rajib Bhattacharjea<raj.b@gatech.edu>
19
//
20
21
#ifndef DATA_RATE_H
22
#define DATA_RATE_H
23
24
#include <string>
25
#include <iostream>
26
#include <stdint.h>
27
#include "ns3/nstime.h"
28
#include "ns3/attribute.h"
29
#include "ns3/attribute-helper.h"
30
#include "ns3/deprecated.h"
31
32
namespace
ns3
{
33
88
class
DataRate
89
{
90
public
:
91
DataRate
();
100
DataRate
(uint64_t bps);
119
DataRate
(std::string rate);
120
126
DataRate
operator +
(
DataRate
rhs);
127
133
DataRate
&
operator +=
(
DataRate
rhs);
134
140
DataRate
operator -
(
DataRate
rhs);
141
147
DataRate
&
operator -=
(
DataRate
rhs);
148
158
DataRate
operator *
(
double
rhs);
159
169
DataRate
&
operator *=
(
double
rhs);
170
178
DataRate
operator *
(uint64_t rhs);
179
187
DataRate
&
operator *=
(uint64_t rhs);
188
189
195
bool
operator <
(
const
DataRate
& rhs)
const
;
196
202
bool
operator <=
(
const
DataRate
& rhs)
const
;
203
209
bool
operator >
(
const
DataRate
& rhs)
const
;
210
216
bool
operator >=
(
const
DataRate
& rhs)
const
;
217
223
bool
operator ==
(
const
DataRate
& rhs)
const
;
224
230
bool
operator !=
(
const
DataRate
& rhs)
const
;
231
239
Time
CalculateBytesTxTime
(uint32_t bytes)
const
;
240
248
Time
CalculateBitsTxTime
(uint32_t bits)
const
;
249
254
uint64_t
GetBitRate
()
const
;
255
256
private
:
257
272
static
bool
DoParse
(
const
std::string s, uint64_t *v);
273
274
// Uses DoParse
275
friend
std::istream &
operator >>
(std::istream &is,
DataRate
&rate);
276
277
uint64_t
m_bps
;
278
};
279
287
std::ostream &
operator <<
(std::ostream &os,
const
DataRate
&rate);
288
296
std::istream &
operator >>
(std::istream &is,
DataRate
&rate);
297
298
ATTRIBUTE_HELPER_HEADER
(
DataRate
);
299
300
309
double
operator*
(
const
DataRate
& lhs,
const
Time
& rhs);
318
double
operator*
(
const
Time
& lhs,
const
DataRate
& rhs);
319
320
namespace
TracedValueCallback {
321
329
typedef
void (*
DataRate
)(
DataRate
oldValue,
330
DataRate
newValue);
331
332
}
// namespace TracedValueCallback
333
334
}
// namespace ns3
335
336
#endif
/* DATA_RATE_H */
ns3::DataRate::operator-=
DataRate & operator-=(DataRate rhs)
Definition:
data-rate.cc:216
ns3::DataRate::CalculateBytesTxTime
Time CalculateBytesTxTime(uint32_t bytes) const
Calculate transmission time.
Definition:
data-rate.cc:275
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator*
int64x64_t operator*(const int64x64_t &lhs, const int64x64_t &rhs)
Multiplication operator.
Definition:
int64x64.h:117
ns3::DataRate::operator*=
DataRate & operator*=(double rhs)
Scales the DataRate.
Definition:
data-rate.cc:228
ns3::DataRate
Class for representing data rates.
Definition:
data-rate.h:89
ns3::DataRate::DoParse
static bool DoParse(const std::string s, uint64_t *v)
Parse a string representing a DataRate into an uint64_t.
Definition:
data-rate.cc:34
ns3::DataRate::CalculateBitsTxTime
Time CalculateBitsTxTime(uint32_t bits) const
Calculate transmission time.
Definition:
data-rate.cc:281
ns3::DataRate::operator*
DataRate operator*(double rhs)
Scales the DataRate.
Definition:
data-rate.cc:223
ns3::DataRate::operator<
bool operator<(const DataRate &rhs) const
Definition:
data-rate.cc:245
ns3::DataRate::operator-
DataRate operator-(DataRate rhs)
Definition:
data-rate.cc:210
ns3::DataRate::DataRate
DataRate()
Definition:
data-rate.cc:187
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:104
ns3::DataRate::operator>
bool operator>(const DataRate &rhs) const
Definition:
data-rate.cc:255
ns3::DataRate::GetBitRate
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition:
data-rate.cc:287
ns3::DataRate::operator+=
DataRate & operator+=(DataRate rhs)
Definition:
data-rate.cc:204
ns3::DataRate::m_bps
uint64_t m_bps
data rate [bps]
Definition:
data-rate.h:277
ns3::DataRate::operator==
bool operator==(const DataRate &rhs) const
Definition:
data-rate.cc:265
ns3::DataRate::operator>>
friend std::istream & operator>>(std::istream &is, DataRate &rate)
Stream extraction operator.
Definition:
data-rate.cc:310
ns3::DataRate::operator!=
bool operator!=(const DataRate &rhs) const
Definition:
data-rate.cc:270
ns3::DataRate::operator>=
bool operator>=(const DataRate &rhs) const
Definition:
data-rate.cc:260
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition:
angles.cc:137
ns3::DataRate::operator<=
bool operator<=(const DataRate &rhs) const
Definition:
data-rate.cc:250
ns3::DataRate::operator+
DataRate operator+(DataRate rhs)
Definition:
data-rate.cc:199
ATTRIBUTE_HELPER_HEADER
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type
Definition:
attribute-helper.h:390
ns3::operator>>
std::istream & operator>>(std::istream &is, Angles &a)
Definition:
angles.cc:160
src
network
utils
data-rate.h
Generated on Fri Oct 1 2021 17:03:30 for ns-3 by
1.8.20