blob: ec29cddd534743ca5b6d42046eb7bed85de2eef3 [file] [log] [blame]
Junxiao Shif3c07812014-03-11 21:48:49 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#include "best-route-strategy.hpp"
8#include "broadcast-strategy.hpp"
9#include "client-control-strategy.hpp"
10#include "ncc-strategy.hpp"
11
12namespace nfd {
13namespace fw {
14
15shared_ptr<Strategy>
16makeDefaultStrategy(Forwarder& forwarder)
17{
18 return make_shared<BestRouteStrategy>(boost::ref(forwarder));
19}
20
21template<typename S>
22inline void
23installStrategy(Forwarder& forwarder)
24{
25 StrategyChoice& strategyChoice = forwarder.getStrategyChoice();
26 if (!strategyChoice.hasStrategy(S::STRATEGY_NAME)) {
27 strategyChoice.install(make_shared<S>(boost::ref(forwarder)));
28 }
29}
30
31void
32installStrategies(Forwarder& forwarder)
33{
34 installStrategy<BestRouteStrategy>(forwarder);
35 installStrategy<BroadcastStrategy>(forwarder);
36 installStrategy<ClientControlStrategy>(forwarder);
37 installStrategy<NccStrategy>(forwarder);
38}
39
40} // namespace fw
41} // namespace nfd