NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
aggregate-stats-policy.h
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011-2013 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 AGGREGATE_STATS_POLICY_H_
22
#define AGGREGATE_STATS_POLICY_H_
23
24
#include <boost/intrusive/options.hpp>
25
#include <boost/intrusive/list.hpp>
26
27
namespace
ns3 {
28
namespace
ndn {
29
namespace
ndnSIM {
30
35
struct
aggregate_stats_policy_traits
36
{
38
static
std::string
GetName
() {
return
"AggregateStats"
; }
39
struct
policy_hook_type
{ };
40
41
template
<
class
Container>
42
struct
container_hook
43
{
44
struct
type
{ };
45
};
46
47
template
<
class
Base,
48
class
Container,
49
class
Hook>
50
struct
policy
51
{
52
// typedef typename boost::intrusive::list< Container, Hook > policy_container;
53
54
// could be just typedef
55
class
type
56
{
57
public
:
58
typedef
Container parent_trie;
59
60
type
(Base &base)
61
: base_ (base)
62
, m_updates (0)
63
, m_inserts (0)
64
, m_lookups (0)
65
, m_erases (0)
66
{
67
}
68
69
inline
void
70
update (
typename
parent_trie::iterator item)
71
{
72
m_updates ++;
73
// do nothing
74
}
75
76
inline
bool
77
insert (
typename
parent_trie::iterator item)
78
{
79
m_inserts ++;
80
return
true
;
81
}
82
83
inline
void
84
lookup (
typename
parent_trie::iterator item)
85
{
86
m_lookups ++;
87
}
88
89
inline
void
90
erase (
typename
parent_trie::iterator item)
91
{
92
m_erases ++;
93
}
94
95
inline
void
96
set_max_size (uint32_t) {}
97
98
inline
uint32_t
99
get_max_size ()
const
{
return
0; }
100
101
inline
void
102
clear ()
103
{
104
// is called only at the end of simulation
105
}
106
107
inline
void
108
ResetStats ()
109
{
110
m_updates = 0;
111
m_inserts = 0;
112
m_lookups = 0;
113
m_erases = 0;
114
}
115
116
inline
uint64_t
117
GetUpdates ()
const
{
return
m_updates; }
118
119
inline
uint64_t
120
GetInserts ()
const
{
return
m_inserts; }
121
122
inline
uint64_t
123
GetLookups ()
const
{
return
m_lookups; }
124
125
inline
uint64_t
126
GetErases ()
const
{
return
m_erases; }
127
128
private
:
129
type
() : base_(*((Base*)0)) { };
130
131
private
:
132
Base &base_;
133
134
uint64_t m_updates;
135
uint64_t m_inserts;
136
uint64_t m_lookups;
137
uint64_t m_erases;
138
};
139
};
140
};
141
142
}
// ndnSIM
143
}
// ndn
144
}
// ns3
145
146
#endif // AGGREGATE_STATS_POLICY_H_
ns3::ndn::ndnSIM::aggregate_stats_policy_traits::policy_hook_type
Definition:
aggregate-stats-policy.h:39
ns3::ndn::ndnSIM::aggregate_stats_policy_traits::container_hook
Definition:
aggregate-stats-policy.h:42
ns3::ndn::ndnSIM::aggregate_stats_policy_traits::policy
Definition:
aggregate-stats-policy.h:50
ns3::ndn::ndnSIM::aggregate_stats_policy_traits::policy::type
Definition:
aggregate-stats-policy.h:55
ns3::ndn::ndnSIM::aggregate_stats_policy_traits
Traits for policy that just keeps track of number of elements It's doing a rather expensive job...
Definition:
aggregate-stats-policy.h:35
ns3::ndn::ndnSIM::aggregate_stats_policy_traits::container_hook::type
Definition:
aggregate-stats-policy.h:44
ns3::ndn::ndnSIM::aggregate_stats_policy_traits::GetName
static std::string GetName()
Name that can be used to identify the policy (for NS-3 object model and logging)
Definition:
aggregate-stats-policy.h:38
ndnSIM
utils
trie
aggregate-stats-policy.h
Generated on Mon Jan 19 2015 11:27:04 for ndnSIM by
1.8.7