blob: 41199b204d08adc89682f2f79f8610da8c2e021b [file] [log] [blame]
Junxiao Shie5e2fce2014-02-10 20:01:53 -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#ifndef NFD_TABLE_STRATEGY_INFO_HOST_HPP
8#define NFD_TABLE_STRATEGY_INFO_HOST_HPP
9
10#include "fw/strategy-info.hpp"
11
12namespace nfd {
13
14/** \class StrategyInfoHost
15 * \brief base class for an entity onto which StrategyInfo may be placed
16 */
17class StrategyInfoHost
18{
19public:
20 template<typename T>
21 void
22 setStrategyInfo(shared_ptr<T> strategyInfo);
23
24 template<typename T>
25 shared_ptr<T>
26 getStrategyInfo();
27
28 void
29 clearStrategyInfo();
30
31private:
32 shared_ptr<fw::StrategyInfo> m_strategyInfo;
33};
34
35
36template<typename T>
37void
38StrategyInfoHost::setStrategyInfo(shared_ptr<T> strategyInfo)
39{
40 m_strategyInfo = strategyInfo;
41}
42
43template<typename T>
44shared_ptr<T>
45StrategyInfoHost::getStrategyInfo()
46{
47 return static_pointer_cast<T, fw::StrategyInfo>(m_strategyInfo);
48}
49
50} // namespace nfd
51
52#endif // NFD_TABLE_STRATEGY_INFO_HOST_HPP