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
content-store-with-probability.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_PROBABILITY_H_
21
#define NDN_CONTENT_STORE_WITH_PROBABILITY_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/probability-policy.hpp
"
29
#include "ns3/double.h"
30
#include "ns3/type-id.h"
31
32
namespace
ns3
{
33
namespace
ndn
{
34
namespace
cs {
35
41
template
<
class
Policy>
42
class
ContentStoreWithProbability
43
:
public
ContentStoreImpl
<ndnSIM::multi_policy_traits<boost::mpl::
44
vector2<ndnSIM::probability_policy_traits,
45
Policy>>> {
46
public
:
47
typedef
ContentStoreImpl
<ndnSIM::multi_policy_traits<boost::mpl::
48
vector2<ndnSIM::probability_policy_traits,
49
Policy>>>
super
;
50
51
typedef
typename
super::policy_container::template index<0>::type
probability_policy_container
;
52
53
ContentStoreWithProbability
(){};
54
55
static
TypeId
56
GetTypeId
();
57
58
private
:
59
void
60
SetCacheProbability(
double
probability)
61
{
62
this->getPolicy().template get<probability_policy_container>().set_probability(probability);
63
}
64
65
double
66
GetCacheProbability()
const
67
{
68
return
this->getPolicy().template get<probability_policy_container>().get_probability();
69
}
70
};
71
75
76
template
<
class
Policy>
77
TypeId
78
ContentStoreWithProbability<Policy>::GetTypeId
()
79
{
80
static
TypeId tid =
81
TypeId((
"ns3::ndn::cs::Probability::"
+ Policy::GetName()).c_str())
82
.SetGroupName(
"Ndn"
)
83
.SetParent<
super
>()
84
.
template
AddConstructor<
ContentStoreWithProbability<Policy>
>()
85
86
.AddAttribute(
"CacheProbability"
,
87
"Set probability of caching in ContentStore. "
88
"If 1, every content is cached. If 0, no content is cached."
,
89
DoubleValue(1.0),
//(+)
90
MakeDoubleAccessor(&
ContentStoreWithProbability<Policy>::GetCacheProbability
,
91
&
ContentStoreWithProbability<Policy>::SetCacheProbability
),
92
MakeDoubleChecker<double>());
93
94
return
tid;
95
}
96
97
}
// namespace cs
98
}
// namespace ndn
99
}
// namespace ns3
100
101
#endif // NDN_CONTENT_STORE_WITH_PROBABILITY_H_
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ns3::ndn::cs::ContentStoreWithProbability::probability_policy_container
super::policy_container::template index< 0 >::type probability_policy_container
Definition:
content-store-with-probability.hpp:51
ns3::ndn::cs::ContentStoreWithProbability
Special content store realization that probabilistically accepts data packet into CS (placement polic...
Definition:
content-store-with-probability.hpp:42
ns3::ndn::cs::ContentStoreWithProbability::GetTypeId
static TypeId GetTypeId()
Definition:
content-store-with-probability.hpp:78
probability-policy.hpp
ns3::ndn::cs::ContentStoreWithProbability::super
ContentStoreImpl< ndnSIM::multi_policy_traits< boost::mpl::vector2< ndnSIM::probability_policy_traits, Policy > > > super
Definition:
content-store-with-probability.hpp:49
content-store-impl.hpp
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
content-store-impl.cpp:38
ns3::ndn::cs::ContentStoreWithProbability::ContentStoreWithProbability
ContentStoreWithProbability()
Definition:
content-store-with-probability.hpp:53
ns3::ndn::cs::ContentStoreImpl
Base implementation of NDN content store.
Definition:
content-store-impl.hpp:82
ndnSIM
model
cs
content-store-with-probability.hpp
Generated on Tue Feb 23 2016 22:18:43 for ndnSIM by
1.8.11