Public Member Functions

ns3::DataRate Class Reference
[Data Rate]

Class for representing data rates. More...

#include <data-rate.h>

List of all members.

Public Member Functions

 DataRate (uint64_t bps)
 Integer constructor.
double CalculateTxTime (uint32_t bytes) const
 Calculate transmission time.
uint64_t GetBitRate () const

Detailed Description

Class for representing data rates.

Allows for natural and familiar use of data rates. Allows construction from strings, natural multiplication e.g.:

 DataRate x("56kbps");
 double nBits = x*ns3::Seconds(19.2);
 uint32_t nBytes = 20;
 double txtime = x.CalclulateTxTime(nBytes);

This class also supports the regular comparison operators <, >, <=, >=, ==, and !=


Constructor & Destructor Documentation

ns3::DataRate::DataRate ( uint64_t  bps  ) 

Integer constructor.

Construct a data rate from an integer. This class only supports positive integer data rates in units of bits/s, meaning 1bit/s is the smallest non-trivial bitrate availiable.


Member Function Documentation

double ns3::DataRate::CalculateTxTime ( uint32_t  bytes  )  const

Calculate transmission time.

Calculates the transmission time at this data rate

Parameters:
bytes The number of bytes (not bits) for which to calculate
Returns:
The tranmission time in seconds for the number of bytes specified
uint64_t ns3::DataRate::GetBitRate (  )  const

Get the underlying bitrate

Returns:
The underlying bitrate in bits per second

The documentation for this class was generated from the following file: