blob: 70a4c365230790ad11e790a1aebf7f895022024c [file] [log] [blame]
Alexander Afanasyev0845c092012-07-13 17:45:33 -07001/* -*- 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 Afanasyev2b4c9472012-08-09 15:00:38 -070026namespace ns3 {
27namespace ndn {
28namespace ndnSIM {
Alexander Afanasyev0845c092012-07-13 17:45:33 -070029
30class LoadStatsFace
31{
32public:
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 Afanasyev1c0248b2012-07-24 15:59:50 -070053
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 Afanasyev0845c092012-07-13 17:45:33 -070065
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 Afanasyev0560eec2012-07-16 15:44:31 -070075
76 bool
77 IsZero () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070078
79private:
80 LoadStats m_count;
81 LoadStats m_satisfied;
82 LoadStats m_unsatisfied;
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070083 LoadStats m_rx;
84 LoadStats m_tx;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070085
86 friend std::ostream &
87 operator << (std::ostream &os, const LoadStatsFace &stats);
88};
89
90inline LoadStats&
91LoadStatsFace::count ()
92{ return m_count; }
93
94inline const LoadStats&
95LoadStatsFace::count () const
96{ return m_count; }
97
98inline LoadStats&
99LoadStatsFace::satisfied ()
100{ return m_satisfied; }
101
102inline const LoadStats&
103LoadStatsFace::satisfied () const
104{ return m_satisfied; }
105
106inline LoadStats&
107LoadStatsFace::unsatisfied ()
108{ return m_unsatisfied; }
109
110inline const LoadStats&
111LoadStatsFace::unsatisfied () const
112{ return m_unsatisfied; }
113
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -0700114inline LoadStats&
115LoadStatsFace::tx ()
116{ return m_tx; }
117
118inline const LoadStats&
119LoadStatsFace::tx () const
120{ return m_tx; }
121
122inline LoadStats&
123LoadStatsFace::rx ()
124{ return m_rx; }
125
126inline const LoadStats&
127LoadStatsFace::rx () const
128{ return m_rx; }
129
130
Alexander Afanasyev0845c092012-07-13 17:45:33 -0700131std::ostream &
132operator << (std::ostream &os, const LoadStatsFace &stats);
133
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700134} // namespace ndnSIM
135} // namespace ndn
136} // namespace ns3
Alexander Afanasyev0845c092012-07-13 17:45:33 -0700137
138#endif // LOAD_STATS_FACE_H