blob: a93018113c128ee60e842d44060c95d8d041d58c [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
26namespace ndnSIM
27{
28
29class LoadStatsFace
30{
31public:
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 Afanasyev1c0248b2012-07-24 15:59:50 -070052
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 Afanasyev0845c092012-07-13 17:45:33 -070064
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 Afanasyev0560eec2012-07-16 15:44:31 -070074
75 bool
76 IsZero () const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070077
78private:
79 LoadStats m_count;
80 LoadStats m_satisfied;
81 LoadStats m_unsatisfied;
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070082 LoadStats m_rx;
83 LoadStats m_tx;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070084
85 friend std::ostream &
86 operator << (std::ostream &os, const LoadStatsFace &stats);
87};
88
89inline LoadStats&
90LoadStatsFace::count ()
91{ return m_count; }
92
93inline const LoadStats&
94LoadStatsFace::count () const
95{ return m_count; }
96
97inline LoadStats&
98LoadStatsFace::satisfied ()
99{ return m_satisfied; }
100
101inline const LoadStats&
102LoadStatsFace::satisfied () const
103{ return m_satisfied; }
104
105inline LoadStats&
106LoadStatsFace::unsatisfied ()
107{ return m_unsatisfied; }
108
109inline const LoadStats&
110LoadStatsFace::unsatisfied () const
111{ return m_unsatisfied; }
112
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -0700113inline LoadStats&
114LoadStatsFace::tx ()
115{ return m_tx; }
116
117inline const LoadStats&
118LoadStatsFace::tx () const
119{ return m_tx; }
120
121inline LoadStats&
122LoadStatsFace::rx ()
123{ return m_rx; }
124
125inline const LoadStats&
126LoadStatsFace::rx () const
127{ return m_rx; }
128
129
Alexander Afanasyev0845c092012-07-13 17:45:33 -0700130std::ostream &
131operator << (std::ostream &os, const LoadStatsFace &stats);
132
133}
134
135#endif // LOAD_STATS_FACE_H