Junxiao Shi | e5e2fce | 2014-02-10 20:01:53 -0700 | [diff] [blame^] | 1 | /* -*- 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 | |
| 12 | namespace nfd { |
| 13 | |
| 14 | /** \class StrategyInfoHost |
| 15 | * \brief base class for an entity onto which StrategyInfo may be placed |
| 16 | */ |
| 17 | class StrategyInfoHost |
| 18 | { |
| 19 | public: |
| 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 | |
| 31 | private: |
| 32 | shared_ptr<fw::StrategyInfo> m_strategyInfo; |
| 33 | }; |
| 34 | |
| 35 | |
| 36 | template<typename T> |
| 37 | void |
| 38 | StrategyInfoHost::setStrategyInfo(shared_ptr<T> strategyInfo) |
| 39 | { |
| 40 | m_strategyInfo = strategyInfo; |
| 41 | } |
| 42 | |
| 43 | template<typename T> |
| 44 | shared_ptr<T> |
| 45 | StrategyInfoHost::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 |