Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2011-2015 Regents of the University of California. |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 4 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 5 | * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and |
| 6 | * contributors. |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 7 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 8 | * ndnSIM is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 11 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 12 | * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 15 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | **/ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 19 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame] | 20 | #include "content-store-impl.hpp" |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 21 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame] | 22 | #include "../../utils/trie/random-policy.hpp" |
| 23 | #include "../../utils/trie/lru-policy.hpp" |
| 24 | #include "../../utils/trie/fifo-policy.hpp" |
| 25 | #include "../../utils/trie/lfu-policy.hpp" |
| 26 | #include "../../utils/trie/multi-policy.hpp" |
| 27 | #include "../../utils/trie/aggregate-stats-policy.hpp" |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 28 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 29 | #define NS_OBJECT_ENSURE_REGISTERED_TEMPL(type, templ) \ |
| 30 | static struct X##type##templ##RegistrationClass { \ |
| 31 | X##type##templ##RegistrationClass() \ |
| 32 | { \ |
| 33 | ns3::TypeId tid = type<templ>::GetTypeId(); \ |
| 34 | tid.GetParent(); \ |
| 35 | } \ |
| 36 | } x_##type##templ##RegistrationVariable |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 37 | |
| 38 | namespace ns3 { |
| 39 | namespace ndn { |
| 40 | |
| 41 | using namespace ndnSIM; |
| 42 | |
| 43 | namespace cs { |
| 44 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 45 | // explicit instantiation and registering |
Alexander Afanasyev | 1cd79ae | 2012-10-05 22:42:12 -0700 | [diff] [blame] | 46 | /** |
| 47 | * @brief ContentStore with LRU cache replacement policy |
| 48 | **/ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 49 | template class ContentStoreImpl<lru_policy_traits>; |
Alexander Afanasyev | 1cd79ae | 2012-10-05 22:42:12 -0700 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * @brief ContentStore with random cache replacement policy |
| 53 | **/ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 54 | template class ContentStoreImpl<random_policy_traits>; |
Alexander Afanasyev | 1cd79ae | 2012-10-05 22:42:12 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * @brief ContentStore with FIFO cache replacement policy |
| 58 | **/ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 59 | template class ContentStoreImpl<fifo_policy_traits>; |
| 60 | |
Alexander Afanasyev | 41824bd | 2013-01-23 23:57:59 -0800 | [diff] [blame] | 61 | /** |
| 62 | * @brief ContentStore with Least Frequently Used (LFU) cache replacement policy |
| 63 | **/ |
| 64 | template class ContentStoreImpl<lfu_policy_traits>; |
| 65 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 66 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, lru_policy_traits); |
| 67 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, random_policy_traits); |
| 68 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, fifo_policy_traits); |
Alexander Afanasyev | 41824bd | 2013-01-23 23:57:59 -0800 | [diff] [blame] | 69 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, lfu_policy_traits); |
| 70 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 71 | typedef multi_policy_traits<boost::mpl::vector2<lru_policy_traits, aggregate_stats_policy_traits>> |
| 72 | LruWithCountsTraits; |
| 73 | typedef multi_policy_traits<boost::mpl::vector2<random_policy_traits, |
| 74 | aggregate_stats_policy_traits>> |
| 75 | RandomWithCountsTraits; |
| 76 | typedef multi_policy_traits<boost::mpl::vector2<fifo_policy_traits, aggregate_stats_policy_traits>> |
| 77 | FifoWithCountsTraits; |
| 78 | typedef multi_policy_traits<boost::mpl::vector2<lfu_policy_traits, aggregate_stats_policy_traits>> |
| 79 | LfuWithCountsTraits; |
Alexander Afanasyev | e091bea | 2014-02-14 15:27:25 -0800 | [diff] [blame] | 80 | |
| 81 | template class ContentStoreImpl<LruWithCountsTraits>; |
| 82 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, LruWithCountsTraits); |
| 83 | |
| 84 | template class ContentStoreImpl<RandomWithCountsTraits>; |
| 85 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, RandomWithCountsTraits); |
| 86 | |
| 87 | template class ContentStoreImpl<FifoWithCountsTraits>; |
| 88 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, FifoWithCountsTraits); |
| 89 | |
| 90 | template class ContentStoreImpl<LfuWithCountsTraits>; |
| 91 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, LfuWithCountsTraits); |
| 92 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 93 | #ifdef DOXYGEN |
| 94 | // /** |
| 95 | // * \brief Content Store implementing LRU cache replacement policy |
| 96 | // */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 97 | class Lru : public ContentStoreImpl<lru_policy_traits> { |
| 98 | }; |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 99 | |
| 100 | /** |
| 101 | * \brief Content Store implementing FIFO cache replacement policy |
| 102 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 103 | class Fifo : public ContentStoreImpl<fifo_policy_traits> { |
| 104 | }; |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 105 | |
| 106 | /** |
| 107 | * \brief Content Store implementing Random cache replacement policy |
| 108 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 109 | class Random : public ContentStoreImpl<random_policy_traits> { |
| 110 | }; |
Alexander Afanasyev | 41824bd | 2013-01-23 23:57:59 -0800 | [diff] [blame] | 111 | |
| 112 | /** |
| 113 | * \brief Content Store implementing Least Frequently Used cache replacement policy |
| 114 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 115 | class Lfu : public ContentStoreImpl<lfu_policy_traits> { |
| 116 | }; |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 117 | #endif |
| 118 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 119 | } // namespace cs |
| 120 | } // namespace ndn |
| 121 | } // namespace ns3 |