blob: b8202f9213cbd1b68b7d9a82956db20f087b0eac [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 Afanasyeve77db792012-08-09 11:10:58 -070026namespace ns3
27{
Alexander Afanasyev0845c092012-07-13 17:45:33 -070028namespace ndnSIM
29{
30
31class LoadStatsFace
32{
33public:
34 void
35 Step ();
36
37 inline LoadStats&
38 count ();
39
40 inline const LoadStats&
41 count () const;
42
43 inline LoadStats&
44 satisfied ();
45
46 inline const LoadStats&
47 satisfied () const;
48
49 inline LoadStats&
50 unsatisfied ();
51
52 inline const LoadStats&
53 unsatisfied () const;
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070054
55 inline LoadStats&
56 tx ();
57
58 inline const LoadStats&
59 tx () const;
60
61 inline LoadStats&
62 rx ();
63
64 inline const LoadStats&
65 rx () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070066
67 //
68 LoadStats::stats_tuple
69 GetSatisfiedRatio () const;
70
71 LoadStats::stats_tuple
72 GetUnsatisfiedRatio () const;
73
74 LoadStatsFace &
75 operator += (const LoadStatsFace &load);
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070076
77 bool
78 IsZero () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070079
80private:
81 LoadStats m_count;
82 LoadStats m_satisfied;
83 LoadStats m_unsatisfied;
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070084 LoadStats m_rx;
85 LoadStats m_tx;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070086
87 friend std::ostream &
88 operator << (std::ostream &os, const LoadStatsFace &stats);
89};
90
91inline LoadStats&
92LoadStatsFace::count ()
93{ return m_count; }
94
95inline const LoadStats&
96LoadStatsFace::count () const
97{ return m_count; }
98
99inline LoadStats&
100LoadStatsFace::satisfied ()
101{ return m_satisfied; }
102
103inline const LoadStats&
104LoadStatsFace::satisfied () const
105{ return m_satisfied; }
106
107inline LoadStats&
108LoadStatsFace::unsatisfied ()
109{ return m_unsatisfied; }
110
111inline const LoadStats&
112LoadStatsFace::unsatisfied () const
113{ return m_unsatisfied; }
114
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -0700115inline LoadStats&
116LoadStatsFace::tx ()
117{ return m_tx; }
118
119inline const LoadStats&
120LoadStatsFace::tx () const
121{ return m_tx; }
122
123inline LoadStats&
124LoadStatsFace::rx ()
125{ return m_rx; }
126
127inline const LoadStats&
128LoadStatsFace::rx () const
129{ return m_rx; }
130
131
Alexander Afanasyev0845c092012-07-13 17:45:33 -0700132std::ostream &
133operator << (std::ostream &os, const LoadStatsFace &stats);
134
Alexander Afanasyeve77db792012-08-09 11:10:58 -0700135} // ndnSIM
136} // ns3
Alexander Afanasyev0845c092012-07-13 17:45:33 -0700137
138#endif // LOAD_STATS_FACE_H