A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
data-rate.h
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 
31 namespace ns3 {
32 
71 class DataRate
72 {
73 public:
74  DataRate ();
83  DataRate (uint64_t bps);
84  DataRate (std::string rate);
85 
86  bool operator < (const DataRate& rhs) const;
87  bool operator <= (const DataRate& rhs) const;
88  bool operator > (const DataRate& rhs) const;
89  bool operator >= (const DataRate& rhs) const;
90  bool operator == (const DataRate& rhs) const;
91  bool operator != (const DataRate& rhs) const;
92 
100  double CalculateTxTime (uint32_t bytes) const;
101 
106  uint64_t GetBitRate () const;
107 
108 private:
109  uint64_t m_bps;
110  static uint64_t Parse (const std::string);
111 };
112 
113 std::ostream &operator << (std::ostream &os, const DataRate &rate);
114 std::istream &operator >> (std::istream &is, DataRate &rate);
115 
122 
128 double operator* (const DataRate& lhs, const Time& rhs);
129 double operator* (const Time& lhs, const DataRate& rhs);
130 
131 } // namespace ns3
132 
133 #endif /* DATA_RATE_H */
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:49
keep track of time unit.
Definition: nstime.h:149
Class for representing data rates.
Definition: data-rate.h:71
double CalculateTxTime(uint32_t bytes) const
Calculate transmission time.
Definition: data-rate.cc:229
#define ATTRIBUTE_HELPER_HEADER(type)
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:43
uint64_t GetBitRate() const
Definition: data-rate.cc:235