NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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
shared_ptr<Strategy>
33
makeDefaultStrategy
(
Forwarder
& forwarder)
34
{
35
return
make_shared<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::StrategyChoice
represents the Strategy Choice table
Definition:
strategy-choice.hpp:45
nfd::fw::registerStrategyImpl
void registerStrategyImpl(const Name &strategyName, const StrategyCreateFunc &createFunc)
Definition:
strategy-registry.cpp:46
nfd::StrategyChoice::hasStrategy
bool hasStrategy(const Name &strategyName, bool isExact=false) const
determines if a strategy is installed
Definition:
strategy-choice.cpp:47
nfd::Forwarder::getStrategyChoice
StrategyChoice & getStrategyChoice()
Definition:
forwarder.hpp:325
nfd::fw::installStrategies
void installStrategies(Forwarder &forwarder)
Definition:
strategy-registry.cpp:52
nfd::Forwarder
main class of NFD
Definition:
forwarder.hpp:55
best-route-strategy2.hpp
nfd::fw::makeDefaultStrategy
shared_ptr< Strategy > makeDefaultStrategy(Forwarder &forwarder)
Definition:
strategy-registry.cpp:33
nfd::fw::StrategyCreateFunc
std::function< shared_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::StrategyChoice::install
bool install(shared_ptr< fw::Strategy > strategy)
install a strategy
Definition:
strategy-choice.cpp:58
ndnSIM
NFD
daemon
fw
strategy-registry.cpp
Generated on Sat Nov 12 2016 16:02:54 for ndnSIM by
1.8.12