Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef LOAD_STATS_FACE_H |
| 22 | #define LOAD_STATS_FACE_H |
| 23 | |
| 24 | #include "load-stats.h" |
| 25 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 26 | namespace ns3 { |
| 27 | namespace ndn { |
| 28 | namespace ndnSIM { |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 29 | |
| 30 | class LoadStatsFace |
| 31 | { |
| 32 | public: |
| 33 | void |
| 34 | Step (); |
| 35 | |
| 36 | inline LoadStats& |
| 37 | count (); |
| 38 | |
| 39 | inline const LoadStats& |
| 40 | count () const; |
| 41 | |
| 42 | inline LoadStats& |
| 43 | satisfied (); |
| 44 | |
| 45 | inline const LoadStats& |
| 46 | satisfied () const; |
| 47 | |
| 48 | inline LoadStats& |
| 49 | unsatisfied (); |
| 50 | |
| 51 | inline const LoadStats& |
| 52 | unsatisfied () const; |
Alexander Afanasyev | 1c0248b | 2012-07-24 15:59:50 -0700 | [diff] [blame] | 53 | |
| 54 | inline LoadStats& |
| 55 | tx (); |
| 56 | |
| 57 | inline const LoadStats& |
| 58 | tx () const; |
| 59 | |
| 60 | inline LoadStats& |
| 61 | rx (); |
| 62 | |
| 63 | inline const LoadStats& |
| 64 | rx () const; |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 65 | |
| 66 | // |
| 67 | LoadStats::stats_tuple |
| 68 | GetSatisfiedRatio () const; |
| 69 | |
| 70 | LoadStats::stats_tuple |
| 71 | GetUnsatisfiedRatio () const; |
| 72 | |
| 73 | LoadStatsFace & |
| 74 | operator += (const LoadStatsFace &load); |
Alexander Afanasyev | 0560eec | 2012-07-16 15:44:31 -0700 | [diff] [blame] | 75 | |
| 76 | bool |
| 77 | IsZero () const; |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 78 | |
| 79 | private: |
| 80 | LoadStats m_count; |
| 81 | LoadStats m_satisfied; |
| 82 | LoadStats m_unsatisfied; |
Alexander Afanasyev | 1c0248b | 2012-07-24 15:59:50 -0700 | [diff] [blame] | 83 | LoadStats m_rx; |
| 84 | LoadStats m_tx; |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 85 | |
| 86 | friend std::ostream & |
| 87 | operator << (std::ostream &os, const LoadStatsFace &stats); |
| 88 | }; |
| 89 | |
| 90 | inline LoadStats& |
| 91 | LoadStatsFace::count () |
| 92 | { return m_count; } |
| 93 | |
| 94 | inline const LoadStats& |
| 95 | LoadStatsFace::count () const |
| 96 | { return m_count; } |
| 97 | |
| 98 | inline LoadStats& |
| 99 | LoadStatsFace::satisfied () |
| 100 | { return m_satisfied; } |
| 101 | |
| 102 | inline const LoadStats& |
| 103 | LoadStatsFace::satisfied () const |
| 104 | { return m_satisfied; } |
| 105 | |
| 106 | inline LoadStats& |
| 107 | LoadStatsFace::unsatisfied () |
| 108 | { return m_unsatisfied; } |
| 109 | |
| 110 | inline const LoadStats& |
| 111 | LoadStatsFace::unsatisfied () const |
| 112 | { return m_unsatisfied; } |
| 113 | |
Alexander Afanasyev | 1c0248b | 2012-07-24 15:59:50 -0700 | [diff] [blame] | 114 | inline LoadStats& |
| 115 | LoadStatsFace::tx () |
| 116 | { return m_tx; } |
| 117 | |
| 118 | inline const LoadStats& |
| 119 | LoadStatsFace::tx () const |
| 120 | { return m_tx; } |
| 121 | |
| 122 | inline LoadStats& |
| 123 | LoadStatsFace::rx () |
| 124 | { return m_rx; } |
| 125 | |
| 126 | inline const LoadStats& |
| 127 | LoadStatsFace::rx () const |
| 128 | { return m_rx; } |
| 129 | |
| 130 | |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 131 | std::ostream & |
| 132 | operator << (std::ostream &os, const LoadStatsFace &stats); |
| 133 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 134 | } // namespace ndnSIM |
| 135 | } // namespace ndn |
| 136 | } // namespace ns3 |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 137 | |
| 138 | #endif // LOAD_STATS_FACE_H |