NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
aggregate-stats-policy.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20
#ifndef AGGREGATE_STATS_POLICY_H_
21
#define AGGREGATE_STATS_POLICY_H_
22
23
#include <boost/intrusive/options.hpp>
24
#include <boost/intrusive/list.hpp>
25
26
namespace
ns3
{
27
namespace
ndn
{
28
namespace
ndnSIM {
29
31
36
struct
aggregate_stats_policy_traits {
38
static
std::string
39
GetName()
40
{
41
return
"AggregateStats"
;
42
}
43
struct
policy_hook_type {
44
};
45
46
template
<
class
Container>
47
struct
container_hook {
48
struct
type {
49
};
50
};
51
52
template
<
class
Base,
class
Container,
class
Hook>
53
struct
policy {
54
// typedef typename boost::intrusive::list< Container, Hook > policy_container;
55
56
// could be just typedef
57
class
type {
58
public
:
59
typedef
Container parent_trie;
60
61
type(Base& base)
62
: base_(base)
63
, m_updates(0)
64
, m_inserts(0)
65
, m_lookups(0)
66
, m_erases(0)
67
{
68
}
69
70
inline
void
71
update(
typename
parent_trie::iterator
item)
72
{
73
m_updates++;
74
// do nothing
75
}
76
77
inline
bool
78
insert(
typename
parent_trie::iterator
item)
79
{
80
m_inserts++;
81
return
true
;
82
}
83
84
inline
void
85
lookup(
typename
parent_trie::iterator
item)
86
{
87
m_lookups++;
88
}
89
90
inline
void
91
erase(
typename
parent_trie::iterator
item)
92
{
93
m_erases++;
94
}
95
96
inline
void
set_max_size(uint32_t)
97
{
98
}
99
100
inline
uint32_t
101
get_max_size()
const
102
{
103
return
0;
104
}
105
106
inline
void
107
clear()
108
{
109
// is called only at the end of simulation
110
}
111
112
inline
void
113
ResetStats()
114
{
115
m_updates = 0;
116
m_inserts = 0;
117
m_lookups = 0;
118
m_erases = 0;
119
}
120
121
inline
uint64_t
122
GetUpdates()
const
123
{
124
return
m_updates;
125
}
126
127
inline
uint64_t
128
GetInserts()
const
129
{
130
return
m_inserts;
131
}
132
133
inline
uint64_t
134
GetLookups()
const
135
{
136
return
m_lookups;
137
}
138
139
inline
uint64_t
140
GetErases()
const
141
{
142
return
m_erases;
143
}
144
145
private
:
146
type()
147
: base_(*((Base*)0)){};
148
149
private
:
150
Base& base_;
151
152
uint64_t m_updates;
153
uint64_t m_inserts;
154
uint64_t m_lookups;
155
uint64_t m_erases;
156
};
157
};
158
};
159
160
}
// ndnSIM
161
}
// ndn
162
}
// ns3
163
165
166
#endif // AGGREGATE_STATS_POLICY_H_
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
nfd::cs::iterator
Table::const_iterator iterator
Definition:
cs-internal.hpp:41
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
content-store-impl.cpp:38
ndnSIM
utils
trie
aggregate-stats-policy.hpp
Generated on Sun Feb 24 2019 22:16:08 for ndnSIM by
1.8.15