NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ndnSIM
ndnSIM documentation
All Attributes
All GlobalValues
All LogComponents
All TraceSources
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
counter.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_CORE_COUNTER_HPP
27
#define NFD_CORE_COUNTER_HPP
28
29
#include "
common.hpp
"
30
31
namespace
nfd
{
32
38
class
SimpleCounter
39
{
40
public
:
41
typedef
uint64_t
rep
;
42
43
constexpr
44
SimpleCounter
()
45
:
m_value
(0)
46
{
47
}
48
49
SimpleCounter
(
const
SimpleCounter
&) =
delete
;
50
51
SimpleCounter
&
52
operator=
(
const
SimpleCounter
&) =
delete
;
53
56
operator
rep
()
const
57
{
58
return
m_value
;
59
}
60
63
void
64
set
(rep
value
)
65
{
66
m_value
=
value
;
67
}
68
69
protected
:
70
rep
m_value
;
71
};
72
77
class
PacketCounter
:
public
SimpleCounter
78
{
79
public
:
82
PacketCounter
&
83
operator++
()
84
{
85
++
m_value
;
86
return
*
this
;
87
}
88
// postfix ++ operator is not provided because it's not needed
89
};
90
95
class
ByteCounter
:
public
SimpleCounter
96
{
97
public
:
100
ByteCounter
&
101
operator+=
(
rep
n)
102
{
103
m_value
+= n;
104
return
*
this
;
105
}
106
};
107
113
template
<
typename
T>
114
class
SizeCounter
115
{
116
public
:
117
typedef
size_t
Rep
;
118
119
explicit
constexpr
120
SizeCounter
(
const
T* table =
nullptr
)
121
: m_table(table)
122
{
123
}
124
125
SizeCounter
(
const
SizeCounter
&) =
delete
;
126
127
SizeCounter
&
128
operator=
(
const
SizeCounter
&) =
delete
;
129
130
void
131
observe
(
const
T* table)
132
{
133
m_table = table;
134
}
135
138
operator
Rep()
const
139
{
140
BOOST_ASSERT(m_table !=
nullptr
);
141
return
m_table->size();
142
}
143
144
private
:
145
const
T* m_table;
146
};
147
148
}
// namespace nfd
149
150
#endif // NFD_CORE_COUNTER_HPP
nfd::SizeCounter::observe
void observe(const T *table)
Definition:
counter.hpp:131
nfd::SimpleCounter::m_value
rep m_value
Definition:
counter.hpp:70
nfd::PacketCounter
represents a counter of number of packets
Definition:
counter.hpp:77
nfd::SizeCounter::SizeCounter
constexpr SizeCounter(const T *table=nullptr)
Definition:
counter.hpp:120
common.hpp
nfd::SimpleCounter::rep
uint64_t rep
Definition:
counter.hpp:41
nfd::ByteCounter
represents a counter of number of bytes
Definition:
counter.hpp:95
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::SizeCounter::Rep
size_t Rep
Definition:
counter.hpp:117
nfd::PacketCounter::operator++
PacketCounter & operator++()
increment the counter by one
Definition:
counter.hpp:83
nfd::SizeCounter
provides a counter that observes the size of a table
Definition:
counter.hpp:114
nfd::SimpleCounter::SimpleCounter
constexpr SimpleCounter()
Definition:
counter.hpp:44
websocketpp::session::state::value
value
Definition:
connection.hpp:179
nfd::SimpleCounter::operator=
SimpleCounter & operator=(const SimpleCounter &)=delete
nfd::SimpleCounter
represents a counter that encloses an integer value
Definition:
counter.hpp:38
nfd::ByteCounter::operator+=
ByteCounter & operator+=(rep n)
increase the counter
Definition:
counter.hpp:101
ndnSIM
NFD
core
counter.hpp
Generated on Thu Nov 2 2017 03:30:29 for ndnSIM by
1.8.11