Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -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_CHOICE_ENTRY_HPP |
| 8 | #define NFD_TABLE_STRATEGY_CHOICE_ENTRY_HPP |
| 9 | |
| 10 | #include "common.hpp" |
| 11 | |
| 12 | namespace nfd { |
| 13 | |
| 14 | class NameTree; |
| 15 | namespace name_tree { |
| 16 | class Entry; |
| 17 | } |
| 18 | namespace fw { |
| 19 | class Strategy; |
| 20 | } |
| 21 | |
| 22 | namespace strategy_choice { |
| 23 | |
| 24 | /** \brief represents a Strategy Choice entry |
| 25 | */ |
| 26 | class Entry : noncopyable |
| 27 | { |
| 28 | public: |
| 29 | Entry(const Name& prefix); |
| 30 | |
| 31 | const Name& |
| 32 | getPrefix() const; |
| 33 | |
| 34 | fw::Strategy& |
| 35 | getStrategy() const; |
| 36 | |
| 37 | void |
| 38 | setStrategy(shared_ptr<fw::Strategy> strategy); |
| 39 | |
| 40 | private: |
| 41 | Name m_prefix; |
| 42 | shared_ptr<fw::Strategy> m_strategy; |
| 43 | |
| 44 | shared_ptr<name_tree::Entry> m_nameTreeEntry; |
| 45 | friend class nfd::NameTree; |
| 46 | friend class nfd::name_tree::Entry; |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | inline const Name& |
| 51 | Entry::getPrefix() const |
| 52 | { |
| 53 | return m_prefix; |
| 54 | } |
| 55 | |
| 56 | inline fw::Strategy& |
| 57 | Entry::getStrategy() const |
| 58 | { |
| 59 | BOOST_ASSERT(static_cast<bool>(m_strategy)); |
| 60 | return *m_strategy; |
| 61 | } |
| 62 | |
| 63 | } // namespace strategy_choice |
| 64 | } // namespace nfd |
| 65 | |
| 66 | #endif // NFD_TABLE_STRATEGY_CHOICE_ENTRY_HPP |