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