/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
 * Copyright (c) 2014-2016,  Regents of the University of California,
 *                           Arizona Board of Regents,
 *                           Colorado State University,
 *                           University Pierre & Marie Curie, Sorbonne University,
 *                           Washington University in St. Louis,
 *                           Beijing Institute of Technology,
 *                           The University of Memphis.
 *
 * This file is part of NFD (Named Data Networking Forwarding Daemon).
 * See AUTHORS.md for complete list of NFD authors and contributors.
 *
 * NFD is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef NFD_DAEMON_FW_STRATEGY_REGISTRY_HPP
#define NFD_DAEMON_FW_STRATEGY_REGISTRY_HPP

#include "core/common.hpp"

namespace nfd {

class Forwarder;

namespace fw {

class Strategy;

unique_ptr<Strategy>
makeDefaultStrategy(Forwarder& forwarder);

void
installStrategies(Forwarder& forwarder);


typedef std::function<unique_ptr<Strategy>(Forwarder&)> StrategyCreateFunc;

void
registerStrategyImpl(const Name& strategyName, const StrategyCreateFunc& createFunc);

/** \brief registers a strategy to be installed later
 */
template<typename S>
void
registerStrategy()
{
  registerStrategyImpl(S::STRATEGY_NAME,
                       [] (Forwarder& forwarder) { return make_unique<S>(ref(forwarder)); });
}

/** \brief registers a built-in strategy
 *
 *  This macro should appear once in .cpp of each built-in strategy.
 */
#define NFD_REGISTER_STRATEGY(StrategyType)                       \
static class NfdAuto ## StrategyType ## StrategyRegistrationClass \
{                                                                 \
public:                                                           \
  NfdAuto ## StrategyType ## StrategyRegistrationClass()          \
  {                                                               \
    ::nfd::fw::registerStrategy<StrategyType>();                  \
  }                                                               \
} g_nfdAuto ## StrategyType ## StrategyRegistrationVariable

} // namespace fw
} // namespace nfd

#endif // NFD_DAEMON_FW_STRATEGY_REGISTRY_HPP
