NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
strategy-registry.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
strategy-registry.hpp
"
27
#include "
best-route-strategy2.hpp
"
28
29
namespace
nfd
{
30
namespace
fw {
31
32
unique_ptr<Strategy>
33
makeDefaultStrategy
(
Forwarder
& forwarder)
34
{
35
return
make_unique<BestRouteStrategy2>(ref(forwarder));
36
}
37
38
static
std::map<Name, StrategyCreateFunc>&
39
getStrategyFactories
()
40
{
41
static
std::map<Name, StrategyCreateFunc> strategyFactories;
42
return
strategyFactories;
43
}
44
45
void
46
registerStrategyImpl
(
const
Name
& strategyName,
const
StrategyCreateFunc
& createFunc)
47
{
48
getStrategyFactories
().insert({strategyName, createFunc});
49
}
50
51
void
52
installStrategies
(
Forwarder
& forwarder)
53
{
54
StrategyChoice
& sc = forwarder.
getStrategyChoice
();
55
for
(
const
auto
& pair :
getStrategyFactories
()) {
56
if
(!sc.
hasStrategy
(pair.first,
true
)) {
57
sc.
install
(pair.second(forwarder));
58
}
59
}
60
}
61
62
}
// namespace fw
63
}
// namespace nfd
nfd::strategy_choice::StrategyChoice::hasStrategy
bool hasStrategy(const Name &strategyName, bool isExact=false) const
determines if a strategy is installed
Definition:
strategy-choice.cpp:53
nfd::fw::makeDefaultStrategy
unique_ptr< Strategy > makeDefaultStrategy(Forwarder &forwarder)
Definition:
strategy-registry.cpp:33
nfd::fw::registerStrategyImpl
void registerStrategyImpl(const Name &strategyName, const StrategyCreateFunc &createFunc)
Definition:
strategy-registry.cpp:46
nfd::fw::installStrategies
void installStrategies(Forwarder &forwarder)
Definition:
strategy-registry.cpp:52
nfd::Forwarder
main class of NFD
Definition:
forwarder.hpp:54
nfd::Forwarder::getStrategyChoice
StrategyChoice & getStrategyChoice()
Definition:
forwarder.hpp:161
nfd::strategy_choice::StrategyChoice::install
std::pair< bool, fw::Strategy * > install(unique_ptr< fw::Strategy > strategy)
install a strategy
Definition:
strategy-choice.cpp:64
best-route-strategy2.hpp
nfd::fw::StrategyCreateFunc
std::function< unique_ptr< Strategy >Forwarder &)> StrategyCreateFunc
Definition:
strategy-registry.hpp:46
strategy-registry.hpp
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::fw::getStrategyFactories
static std::map< Name, StrategyCreateFunc > & getStrategyFactories()
Definition:
strategy-registry.cpp:39
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
nfd::strategy_choice::StrategyChoice
represents the Strategy Choice table
Definition:
strategy-choice.hpp:48
ndnSIM
NFD
daemon
fw
strategy-registry.cpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13