NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
face-counters.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FACE_FACE_COUNTERS_HPP
27
#define NFD_DAEMON_FACE_FACE_COUNTERS_HPP
28
29
#include "
common.hpp
"
30
31
namespace
nfd {
32
35
// PacketCounter is noncopyable, because increment should be called on the counter,
36
// not a copy of it; it's implicitly convertible to uint64_t to be observed
37
class
PacketCounter
: noncopyable
38
{
39
public
:
40
typedef
uint64_t
rep
;
41
42
PacketCounter
()
43
: m_value(0)
44
{
45
}
46
47
operator
rep
()
const
48
{
49
return
m_value;
50
}
51
52
PacketCounter
&
53
operator++
()
54
{
55
++m_value;
56
return
*
this
;
57
}
58
// postfix ++ operator is not provided because it's not needed
59
60
void
61
set
(
rep
value)
62
{
63
m_value = value;
64
}
65
66
private
:
67
rep
m_value;
68
};
69
72
// ByteCounter is noncopyable, because increment should be called on the counter,
73
// not a copy of it; it's implicitly convertible to uint64_t to be observed
74
class
ByteCounter
: noncopyable
75
{
76
public
:
77
typedef
uint64_t
rep
;
78
79
ByteCounter
()
80
: m_value(0)
81
{
82
}
83
84
operator
rep
()
const
85
{
86
return
m_value;
87
}
88
89
ByteCounter
&
90
operator+=
(
rep
n)
91
{
92
m_value += n;
93
return
*
this
;
94
}
95
96
void
97
set
(
rep
value)
98
{
99
m_value = value;
100
}
101
102
private
:
103
rep
m_value;
104
};
105
108
class
NetworkLayerCounters
: noncopyable
109
{
110
public
:
112
const
PacketCounter
&
113
getNInInterests
()
const
114
{
115
return
m_nInInterests;
116
}
117
118
PacketCounter
&
119
getNInInterests
()
120
{
121
return
m_nInInterests;
122
}
123
125
const
PacketCounter
&
126
getNInDatas
()
const
127
{
128
return
m_nInDatas;
129
}
130
131
PacketCounter
&
132
getNInDatas
()
133
{
134
return
m_nInDatas;
135
}
136
138
const
PacketCounter
&
139
getNOutInterests
()
const
140
{
141
return
m_nOutInterests;
142
}
143
144
PacketCounter
&
145
getNOutInterests
()
146
{
147
return
m_nOutInterests;
148
}
149
151
const
PacketCounter
&
152
getNOutDatas
()
const
153
{
154
return
m_nOutDatas;
155
}
156
157
PacketCounter
&
158
getNOutDatas
()
159
{
160
return
m_nOutDatas;
161
}
162
163
protected
:
167
template
<
typename
R>
168
void
169
copyTo
(R& recipient)
const
170
{
171
recipient.setNInInterests(this->
getNInInterests
());
172
recipient.setNInDatas(this->
getNInDatas
());
173
recipient.setNOutInterests(this->
getNOutInterests
());
174
recipient.setNOutDatas(this->
getNOutDatas
());
175
}
176
177
private
:
178
PacketCounter
m_nInInterests;
179
PacketCounter
m_nInDatas;
180
PacketCounter
m_nOutInterests;
181
PacketCounter
m_nOutDatas;
182
};
183
186
class
LinkLayerCounters
: noncopyable
187
{
188
public
:
190
const
ByteCounter
&
191
getNInBytes
()
const
192
{
193
return
m_nInBytes;
194
}
195
196
ByteCounter
&
197
getNInBytes
()
198
{
199
return
m_nInBytes;
200
}
201
203
const
ByteCounter
&
204
getNOutBytes
()
const
205
{
206
return
m_nOutBytes;
207
}
208
209
ByteCounter
&
210
getNOutBytes
()
211
{
212
return
m_nOutBytes;
213
}
214
215
protected
:
219
template
<
typename
R>
220
void
221
copyTo
(R& recipient)
const
222
{
223
recipient.setNInBytes(this->
getNInBytes
());
224
recipient.setNOutBytes(this->
getNOutBytes
());
225
}
226
227
private
:
228
ByteCounter
m_nInBytes;
229
ByteCounter
m_nOutBytes;
230
};
231
234
class
FaceCounters
:
public
NetworkLayerCounters
,
public
LinkLayerCounters
235
{
236
public
:
240
template
<
typename
R>
241
void
242
copyTo
(R& recipient)
const
243
{
244
this->
NetworkLayerCounters::copyTo
(recipient);
245
this->
LinkLayerCounters::copyTo
(recipient);
246
}
247
};
248
249
}
// namespace nfd
250
251
#endif // NFD_DAEMON_FACE_FACE_COUNTERS_HPP
nfd::LinkLayerCounters::getNOutBytes
ByteCounter & getNOutBytes()
Definition:
face-counters.hpp:210
nfd::ByteCounter::ByteCounter
ByteCounter()
Definition:
face-counters.hpp:79
nfd::FaceCounters
contains counters on face
Definition:
face-counters.hpp:234
nfd::PacketCounter::set
void set(rep value)
Definition:
face-counters.hpp:61
nfd::PacketCounter
represents a counter of number of packets
Definition:
face-counters.hpp:37
nfd::NetworkLayerCounters::getNOutDatas
const PacketCounter & getNOutDatas() const
outgoing Data
Definition:
face-counters.hpp:152
nfd::NetworkLayerCounters::getNOutInterests
const PacketCounter & getNOutInterests() const
outgoing Interest
Definition:
face-counters.hpp:139
nfd::NetworkLayerCounters::getNInDatas
PacketCounter & getNInDatas()
Definition:
face-counters.hpp:132
common.hpp
nfd::NetworkLayerCounters::getNOutInterests
PacketCounter & getNOutInterests()
Definition:
face-counters.hpp:145
nfd::ByteCounter
represents a counter of number of bytes
Definition:
face-counters.hpp:74
nfd::FaceCounters::copyTo
void copyTo(R &recipient) const
copy current obseverations to a struct
Definition:
face-counters.hpp:242
nfd::NetworkLayerCounters::copyTo
void copyTo(R &recipient) const
copy current obseverations to a struct
Definition:
face-counters.hpp:169
nfd::LinkLayerCounters::getNInBytes
ByteCounter & getNInBytes()
Definition:
face-counters.hpp:197
nfd::PacketCounter::operator++
PacketCounter & operator++()
Definition:
face-counters.hpp:53
nfd::LinkLayerCounters::getNInBytes
const ByteCounter & getNInBytes() const
received bytes
Definition:
face-counters.hpp:191
nfd::LinkLayerCounters
contains link layer byte counters
Definition:
face-counters.hpp:186
nfd::ByteCounter::rep
uint64_t rep
Definition:
face-counters.hpp:77
nfd::NetworkLayerCounters::getNInDatas
const PacketCounter & getNInDatas() const
incoming Data
Definition:
face-counters.hpp:126
nfd::LinkLayerCounters::copyTo
void copyTo(R &recipient) const
copy current obseverations to a struct
Definition:
face-counters.hpp:221
nfd::PacketCounter::PacketCounter
PacketCounter()
Definition:
face-counters.hpp:42
nfd::NetworkLayerCounters
contains network layer packet counters
Definition:
face-counters.hpp:108
nfd::NetworkLayerCounters::getNInInterests
const PacketCounter & getNInInterests() const
incoming Interest
Definition:
face-counters.hpp:113
nfd::ByteCounter::set
void set(rep value)
Definition:
face-counters.hpp:97
nfd::PacketCounter::rep
uint64_t rep
Definition:
face-counters.hpp:40
nfd::NetworkLayerCounters::getNOutDatas
PacketCounter & getNOutDatas()
Definition:
face-counters.hpp:158
nfd::NetworkLayerCounters::getNInInterests
PacketCounter & getNInInterests()
Definition:
face-counters.hpp:119
nfd::LinkLayerCounters::getNOutBytes
const ByteCounter & getNOutBytes() const
sent bytes
Definition:
face-counters.hpp:204
nfd::ByteCounter::operator+=
ByteCounter & operator+=(rep n)
Definition:
face-counters.hpp:90
ndnSIM
NFD
daemon
face
face-counters.hpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7