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
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
content-store-with-stats.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20
#ifndef NDN_CONTENT_STORE_WITH_STATS_H_
21
#define NDN_CONTENT_STORE_WITH_STATS_H_
22
23
#include "ns3/ndnSIM/model/ndn-common.hpp"
24
25
#include "
content-store-impl.hpp
"
26
27
#include "../../utils/trie/multi-policy.hpp"
28
#include "
custom-policies/lifetime-stats-policy.hpp
"
29
30
namespace
ns3 {
31
namespace
ndn {
32
namespace
cs {
33
38
template
<
class
Policy>
39
class
ContentStoreWithStats
40
:
public
ContentStoreImpl
<ndnSIM::
41
multi_policy_traits<boost::mpl::
42
vector2<Policy,
43
ndnSIM::
44
lifetime_stats_policy_traits>>> {
45
public
:
46
typedef
ContentStoreImpl
<ndnSIM::
47
multi_policy_traits<boost::mpl::
48
vector2<Policy,
49
ndnSIM::lifetime_stats_policy_traits>>>
50
super
;
51
52
typedef
typename
super::policy_container::template index<1>::type
lifetime_stats_container
;
53
54
ContentStoreWithStats
()
55
{
56
// connect traceback to the policy
57
super::getPolicy().template get<1>().set_traced_callback(&m_willRemoveEntry);
58
}
59
60
static
TypeId
61
GetTypeId
();
62
63
virtual
inline
void
64
Print
(std::ostream& os)
const
;
65
66
private
:
67
static
LogComponent g_log;
68
71
TracedCallback<Ptr<const Entry>, Time> m_willRemoveEntry;
72
};
73
77
78
template
<
class
Policy>
79
LogComponent ContentStoreWithStats<Policy>::g_log = LogComponent((
"ndn.cs.Stats."
80
+ Policy::GetName()).c_str());
81
82
template
<
class
Policy>
83
TypeId
84
ContentStoreWithStats<Policy>::GetTypeId
()
85
{
86
static
TypeId tid =
87
TypeId((
"ns3::ndn::cs::Stats::"
+ Policy::GetName()).c_str())
88
.SetGroupName(
"Ndn"
)
89
.SetParent<
super
>()
90
.
template
AddConstructor<
ContentStoreWithStats<Policy>
>()
91
92
.AddTraceSource(
"WillRemoveEntry"
,
93
"Trace called just before content store entry will be removed"
,
94
MakeTraceSourceAccessor(&
ContentStoreWithStats<Policy>::m_willRemoveEntry
))
95
96
// trace stuff here
97
;
98
99
return
tid;
100
}
101
102
template
<
class
Policy>
103
void
104
ContentStoreWithStats<Policy>::Print
(std::ostream& os)
const
105
{
106
// const freshness_policy_container &freshness = this->getPolicy ().template
107
// get<freshness_policy_container> ();
108
109
for
(
typename
super::policy_container::const_iterator item = this->getPolicy().begin();
110
item != this->getPolicy().end(); item++) {
111
Time alive = lifetime_stats_container::policy_base::get_time(&(*item)) - Simulator::Now();
112
os << item->payload()->GetName() <<
"(alive: "
<< alive.ToDouble(Time::S) <<
"s)"
<< std::endl;
113
}
114
}
115
116
}
// namespace cs
117
}
// namespace ndn
118
}
// namespace ns3
119
120
#endif // NDN_CONTENT_STORE_IMPL_H_
ns3::ndn::cs::ContentStoreWithStats::Print
virtual void Print(std::ostream &os) const
Print out content store entries.
Definition:
content-store-with-stats.hpp:104
ns3::ndn::cs::ContentStoreWithStats::lifetime_stats_container
super::policy_container::template index< 1 >::type lifetime_stats_container
Definition:
content-store-with-stats.hpp:52
ns3::ndn::cs::ContentStoreWithStats::GetTypeId
static TypeId GetTypeId()
Definition:
content-store-with-stats.hpp:84
content-store-impl.hpp
ns3::ndn::cs::ContentStoreWithStats
Special content store realization that provides ability to track stats of CS operations.
Definition:
content-store-with-stats.hpp:39
ns3::ndn::cs::ContentStoreWithStats::super
ContentStoreImpl< ndnSIM::multi_policy_traits< boost::mpl::vector2< Policy, ndnSIM::lifetime_stats_policy_traits > > > super
Definition:
content-store-with-stats.hpp:50
lifetime-stats-policy.hpp
ns3::ndn::cs::ContentStoreImpl
Base implementation of NDN content store.
Definition:
content-store-impl.hpp:82
ns3::ndn::cs::ContentStoreWithStats::ContentStoreWithStats
ContentStoreWithStats()
Definition:
content-store-with-stats.hpp:54
ndnSIM
model
cs
content-store-with-stats.hpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7