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
counting-policy.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20
#ifndef COUNTING_POLICY_H_
21
#define COUNTING_POLICY_H_
22
24
25
#include <boost/intrusive/options.hpp>
26
#include <boost/intrusive/list.hpp>
27
28
namespace
ns3
{
29
namespace
ndn
{
30
namespace
ndnSIM
{
31
36
struct
counting_policy_traits {
38
static
std::string
39
GetName()
40
{
41
return
"Counting"
;
42
}
43
44
struct
policy_hook_type :
public
boost::intrusive::list_member_hook<> {
45
};
46
47
template
<
class
Container>
48
struct
container_hook {
49
// could be class/struct implementation
50
typedef
boost::intrusive::member_hook<Container, policy_hook_type, &Container::policy_hook_>
51
type;
52
};
53
54
template
<
class
Base,
class
Container,
class
Hook>
55
struct
policy {
56
typedef
typename
boost::intrusive::list<Container, Hook> policy_container;
57
58
// could be just typedef
59
class
type :
public
policy_container {
60
public
:
61
typedef
Container parent_trie;
62
63
type(Base& base)
64
: base_(base)
65
{
66
}
67
68
inline
void
69
update(
typename
parent_trie::iterator
item)
70
{
71
// do nothing
72
}
73
74
inline
bool
75
insert(
typename
parent_trie::iterator
item)
76
{
77
policy_container::push_back(*item);
78
return
true
;
79
}
80
81
inline
void
82
lookup(
typename
parent_trie::iterator
item)
83
{
84
// do nothing
85
}
86
87
inline
void
88
erase(
typename
parent_trie::iterator
item)
89
{
90
policy_container::erase(policy_container::s_iterator_to(*item));
91
}
92
93
inline
void
94
clear()
95
{
96
policy_container::clear();
97
}
98
99
private
:
100
type()
101
: base_(*((Base*)0)){};
102
103
private
:
104
Base& base_;
105
};
106
};
107
};
108
109
}
// ndnSIM
110
}
// ndn
111
}
// ns3
112
114
115
#endif // COUNTING_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
ndnSIM
utils
trie
counting-policy.hpp
Generated on Tue Feb 23 2016 22:18:45 for ndnSIM by
1.8.11