A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
data-rate.h
Go to the documentation of this file.
1
//
2
// Copyright (c) 2006 Georgia Tech Research Corporation
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: Rajib Bhattacharjea<raj.b@gatech.edu>
18
//
19
20
#ifndef DATA_RATE_H
21
#define DATA_RATE_H
22
23
#include "ns3/attribute-helper.h"
24
#include "ns3/attribute.h"
25
#include "ns3/deprecated.h"
26
#include "ns3/nstime.h"
27
28
#include <iostream>
29
#include <stdint.h>
30
#include <string>
31
32
namespace
ns3
33
{
34
89
class
DataRate
90
{
91
public
:
92
DataRate
();
101
DataRate
(uint64_t bps);
120
DataRate
(std::string rate);
121
127
DataRate
operator+
(
DataRate
rhs);
128
134
DataRate
&
operator+=
(
DataRate
rhs);
135
141
DataRate
operator-
(
DataRate
rhs);
142
148
DataRate
&
operator-=
(
DataRate
rhs);
149
159
DataRate
operator*
(
double
rhs);
160
170
DataRate
&
operator*=
(
double
rhs);
171
179
DataRate
operator*
(uint64_t rhs);
180
188
DataRate
&
operator*=
(uint64_t rhs);
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
:
271
static
bool
DoParse
(
const
std::string s, uint64_t* v);
272
273
// Uses DoParse
274
friend
std::istream&
operator>>
(std::istream& is,
DataRate
& rate);
275
276
uint64_t
m_bps
;
277
};
278
286
std::ostream&
operator<<
(std::ostream& os,
const
DataRate
& rate);
287
295
std::istream&
operator>>
(std::istream& is,
DataRate
& rate);
296
297
ATTRIBUTE_HELPER_HEADER
(
DataRate
);
298
307
double
operator*
(
const
DataRate
& lhs,
const
Time
& rhs);
316
double
operator*
(
const
Time
& lhs,
const
DataRate
& rhs);
317
318
namespace
TracedValueCallback
319
{
320
328
typedef
void (*
DataRate
)(
DataRate
oldValue,
DataRate
newValue);
329
330
}
// namespace TracedValueCallback
331
332
}
// namespace ns3
333
334
#endif
/* DATA_RATE_H */
ns3::DataRate
Class for representing data rates.
Definition:
data-rate.h:90
ns3::DataRate::operator*=
DataRate & operator*=(double rhs)
Scales the DataRate.
Definition:
data-rate.cc:235
ns3::DataRate::operator==
bool operator==(const DataRate &rhs) const
Definition:
data-rate.cc:279
ns3::DataRate::operator<
bool operator<(const DataRate &rhs) const
Definition:
data-rate.cc:255
ns3::DataRate::operator>
bool operator>(const DataRate &rhs) const
Definition:
data-rate.cc:267
ns3::DataRate::operator!=
bool operator!=(const DataRate &rhs) const
Definition:
data-rate.cc:285
ns3::DataRate::operator>=
bool operator>=(const DataRate &rhs) const
Definition:
data-rate.cc:273
ns3::DataRate::CalculateBitsTxTime
Time CalculateBitsTxTime(uint32_t bits) const
Calculate transmission time.
Definition:
data-rate.cc:298
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:35
ns3::DataRate::m_bps
uint64_t m_bps
data rate [bps]
Definition:
data-rate.h:276
ns3::DataRate::GetBitRate
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition:
data-rate.cc:305
ns3::DataRate::operator<=
bool operator<=(const DataRate &rhs) const
Definition:
data-rate.cc:261
ns3::DataRate::operator-
DataRate operator-(DataRate rhs)
Definition:
data-rate.cc:214
ns3::DataRate::operator*
DataRate operator*(double rhs)
Scales the DataRate.
Definition:
data-rate.cc:229
ns3::DataRate::operator+
DataRate operator+(DataRate rhs)
Definition:
data-rate.cc:201
ns3::DataRate::operator+=
DataRate & operator+=(DataRate rhs)
Definition:
data-rate.cc:207
ns3::DataRate::DataRate
DataRate()
Definition:
data-rate.cc:188
ns3::DataRate::CalculateBytesTxTime
Time CalculateBytesTxTime(uint32_t bytes) const
Calculate transmission time.
Definition:
data-rate.cc:291
ns3::DataRate::operator-=
DataRate & operator-=(DataRate rhs)
Definition:
data-rate.cc:221
ns3::DataRate::operator>>
friend std::istream & operator>>(std::istream &is, DataRate &rate)
Stream extraction operator.
Definition:
data-rate.cc:331
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
uint32_t
ns3::operator*
int64x64_t operator*(const int64x64_t &lhs, const int64x64_t &rhs)
Multiplication operator.
Definition:
int64x64.h:118
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ATTRIBUTE_HELPER_HEADER
ATTRIBUTE_HELPER_HEADER(ValueClassTest)
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition:
angles.cc:129
ns3::operator>>
std::istream & operator>>(std::istream &is, Angles &a)
Definition:
angles.cc:153
src
network
utils
data-rate.h
Generated on Tue Nov 1 2022 23:00:27 for ns-3 by
1.9.3