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
payload-with-policy.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20
#ifndef PAYLOAD_WITH_INDEX_H_
21
#define PAYLOAD_WITH_INDEX_H_
22
24
25
namespace
ns3
{
26
namespace
ndn
{
27
namespace
ndnSIM
{
28
29
template
<
typename
PayloadTraits,
typename
IndexTraits>
30
class
payload_with_index {
31
public
:
32
typedef
PayloadTraits::pointer_type
iterator
;
33
34
typedef
typename
IndexTraits::
35
template index<PayloadTraits,
36
typename
IndexTraits::template container_hook<parent_trie>::type>::type
37
index_container;
38
39
inline
payload_with_index()
40
: index_(*this)
41
{
42
}
43
44
inline
std::pair<iterator, bool>
45
insert(
typename
iterator payload)
46
{
47
bool
ok
= policy_.insert(s_iterator_to(item.first));
48
if
(!ok) {
49
item.first->erase();
// cannot insert
50
return
std::make_pair(end(),
false
);
51
}
52
53
return
item;
54
}
55
56
// inline void
57
// erase (const FullKey &key)
58
// {
59
// iterator foundItem, lastItem;
60
// bool reachLast;
61
// std::tie (foundItem, reachLast, lastItem) = trie_.find (key);
62
63
// if (!reachLast || lastItem->payload () == PayloadTraits::empty_payload)
64
// return; // nothing to invalidate
65
66
// erase (lastItem);
67
// }
68
69
// inline void
70
// erase (iterator node)
71
// {
72
// if (node == end ()) return;
73
74
// policy_.erase (s_iterator_to (node));
75
// node->erase (); // will do cleanup here
76
// }
77
78
// inline void
79
// clear ()
80
// {
81
// policy_.clear ();
82
// trie_.clear ();
83
// }
84
85
// template<typename Modifier>
86
// bool
87
// modify (iterator position, Modifier mod)
88
// {
89
// if (position == end ()) return false;
90
// if (position->payload () == PayloadTraits::empty_payload) return false;
91
92
// mod (*position->payload ());
93
// policy_.update (position);
94
// return true;
95
// }
96
97
private
:
98
mutable
index_container policy_;
99
};
100
101
}
// ndnSIM
102
}
// ndn
103
}
// ns3
104
106
107
#endif // PAYLOAD_WITH_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
websocketpp::http::status_code::ok
Definition:
constants.hpp:128
ndnSIM
utils
trie
payload-with-policy.hpp
Generated on Thu Nov 2 2017 03:30:30 for ndnSIM by
1.8.11