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
counting-policy.h
1
/* -*- 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 COUNTING_POLICY_H_
22
#define COUNTING_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
counting_policy_traits
36
{
38
static
std::string
GetName
() {
return
"Counting"
; }
39
40
struct
policy_hook_type
:
public
boost::intrusive::list_member_hook<> {};
41
42
template
<
class
Container>
43
struct
container_hook
44
{
45
// could be class/struct implementation
46
typedef
boost::intrusive::member_hook< Container,
47
policy_hook_type
,
48
&Container::policy_hook_ > type;
49
};
50
51
template
<
class
Base,
52
class
Container,
53
class
Hook>
54
struct
policy
55
{
56
typedef
typename
boost::intrusive::list< Container, Hook > policy_container;
57
58
// could be just typedef
59
class
type
:
public
policy_container
60
{
61
public
:
62
typedef
Container parent_trie;
63
64
type
(Base &base)
65
: base_ (base)
66
{
67
}
68
69
inline
void
70
update (
typename
parent_trie::iterator item)
71
{
72
// do nothing
73
}
74
75
inline
bool
76
insert (
typename
parent_trie::iterator item)
77
{
78
policy_container::push_back (*item);
79
return
true
;
80
}
81
82
inline
void
83
lookup (
typename
parent_trie::iterator item)
84
{
85
// do nothing
86
}
87
88
inline
void
89
erase (
typename
parent_trie::iterator item)
90
{
91
policy_container::erase (policy_container::s_iterator_to (*item));
92
}
93
94
inline
void
95
clear ()
96
{
97
policy_container::clear ();
98
}
99
100
private
:
101
type
() : base_(*((Base*)0)) { };
102
103
private
:
104
Base &base_;
105
};
106
};
107
};
108
109
}
// ndnSIM
110
}
// ndn
111
}
// ns3
112
113
#endif // COUNTING_POLICY_H_
ns3::ndn::ndnSIM::counting_policy_traits::container_hook
Definition:
counting-policy.h:43
ns3::ndn::ndnSIM::counting_policy_traits::policy
Definition:
counting-policy.h:54
ns3::ndn::ndnSIM::counting_policy_traits::GetName
static std::string GetName()
Name that can be used to identify the policy (for NS-3 object model and logging)
Definition:
counting-policy.h:38
ns3::ndn::ndnSIM::counting_policy_traits
Traits for policy that just keeps track of number of elements It's doing a rather expensive job...
Definition:
counting-policy.h:35
ns3::ndn::ndnSIM::counting_policy_traits::policy::type
Definition:
counting-policy.h:59
ns3::ndn::ndnSIM::counting_policy_traits::policy_hook_type
Definition:
counting-policy.h:40
ndnSIM
utils
trie
counting-policy.h
Generated on Mon Jan 19 2015 11:27:04 for ndnSIM by
1.8.7