A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
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/nstime.h"
26
27
#include <iostream>
28
#include <stdint.h>
29
#include <string>
30
31
namespace
ns3
32
{
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)
const
;
127
133
DataRate
&
operator+=
(
DataRate
rhs);
134
140
DataRate
operator-
(
DataRate
rhs)
const
;
141
147
DataRate
&
operator-=
(
DataRate
rhs);
148
158
DataRate
operator*
(
double
rhs)
const
;
159
169
DataRate
&
operator*=
(
double
rhs);
170
178
DataRate
operator*
(uint64_t rhs)
const
;
179
187
DataRate
&
operator*=
(uint64_t rhs);
188
194
bool
operator<
(
const
DataRate
& rhs)
const
;
195
201
bool
operator<=
(
const
DataRate
& rhs)
const
;
202
208
bool
operator>
(
const
DataRate
& rhs)
const
;
209
215
bool
operator>=
(
const
DataRate
& rhs)
const
;
216
222
bool
operator==
(
const
DataRate
& rhs)
const
;
223
229
bool
operator!=
(
const
DataRate
& rhs)
const
;
230
238
Time
CalculateBytesTxTime
(uint32_t bytes)
const
;
239
247
Time
CalculateBitsTxTime
(uint32_t bits)
const
;
248
253
uint64_t
GetBitRate
()
const
;
254
255
private
:
270
static
bool
DoParse
(
const
std::string s, uint64_t* v);
271
272
// Uses DoParse
273
friend
std::istream&
operator>>
(std::istream& is,
DataRate
& rate);
274
275
uint64_t
m_bps
;
276
};
277
285
std::ostream&
operator<<
(std::ostream& os,
const
DataRate
& rate);
286
294
std::istream&
operator>>
(std::istream& is,
DataRate
& rate);
295
296
ATTRIBUTE_HELPER_HEADER
(
DataRate
);
297
306
double
operator*
(
const
DataRate
& lhs,
const
Time
& rhs);
315
double
operator*
(
const
Time
& lhs,
const
DataRate
& rhs);
316
317
namespace
TracedValueCallback
318
{
319
327
typedef
void (*
DataRate
)(
DataRate
oldValue,
DataRate
newValue);
328
329
}
// namespace TracedValueCallback
330
331
}
// namespace ns3
332
333
#endif
/* DATA_RATE_H */
ns3::DataRate
Class for representing data rates.
Definition:
data-rate.h:89
ns3::DataRate::operator*=
DataRate & operator*=(double rhs)
Scales the DataRate.
Definition:
data-rate.cc:235
ns3::DataRate::operator>>
friend std::istream & operator>>(std::istream &is, DataRate &rate)
Stream extraction operator.
Definition:
data-rate.cc:331
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::operator-
DataRate operator-(DataRate rhs) const
Definition:
data-rate.cc:214
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:275
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:207
ns3::DataRate::operator+
DataRate operator+(DataRate rhs) const
Definition:
data-rate.cc:201
ns3::DataRate::DataRate
DataRate()
Definition:
data-rate.cc:188
ns3::DataRate::operator*
DataRate operator*(double rhs) const
Scales the DataRate.
Definition:
data-rate.cc:229
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::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
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::istream & operator>>(std::istream &is, Angles &a)
Definition:
angles.cc:183
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition:
angles.cc:159
src
network
utils
data-rate.h
Generated on Sun Mar 3 2024 17:11:06 for ns-3 by
1.9.1