NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
available-strategies.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #include "best-route-strategy.hpp"
27 #include "broadcast-strategy.hpp"
29 #include "ncc-strategy.hpp"
30 #include "best-route-strategy2.hpp"
31 
32 namespace nfd {
33 namespace fw {
34 
35 shared_ptr<Strategy>
37 {
38  return make_shared<BestRouteStrategy2>(ref(forwarder));
39 }
40 
41 template<typename S>
42 inline void
44 {
45  StrategyChoice& strategyChoice = forwarder.getStrategyChoice();
46  if (!strategyChoice.hasStrategy(S::STRATEGY_NAME)) {
47  strategyChoice.install(make_shared<S>(ref(forwarder)));
48  }
49 }
50 
51 void
53 {
54  installStrategy<BestRouteStrategy>(forwarder);
55  installStrategy<BroadcastStrategy>(forwarder);
56  installStrategy<ClientControlStrategy>(forwarder);
57  installStrategy<NccStrategy>(forwarder);
58  installStrategy<BestRouteStrategy2>(forwarder);
59 }
60 
61 } // namespace fw
62 } // namespace nfd
represents the Strategy Choice table
StrategyChoice & getStrategyChoice()
Definition: forwarder.hpp:297
void installStrategies(Forwarder &forwarder)
main class of NFD
Definition: forwarder.hpp:54
shared_ptr< Strategy > makeDefaultStrategy(Forwarder &forwarder)
void installStrategy(Forwarder &forwarder)
bool install(shared_ptr< fw::Strategy > strategy)
install a strategy
bool hasStrategy(const Name &strategyName, bool isExact=false) const
determines if a strategy is installed