Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame] | 21 | #include "content-store-with-stats.hpp" |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 22 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame] | 23 | #include "../../utils/trie/random-policy.hpp" |
| 24 | #include "../../utils/trie/lru-policy.hpp" |
| 25 | #include "../../utils/trie/fifo-policy.hpp" |
| 26 | #include "../../utils/trie/lfu-policy.hpp" |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 27 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 28 | #define NS_OBJECT_ENSURE_REGISTERED_TEMPL(type, templ) \ |
| 29 | static struct X##type##templ##RegistrationClass { \ |
| 30 | X##type##templ##RegistrationClass() \ |
| 31 | { \ |
| 32 | ns3::TypeId tid = type<templ>::GetTypeId(); \ |
| 33 | tid.GetParent(); \ |
| 34 | } \ |
| 35 | } x_##type##templ##RegistrationVariable |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 36 | |
| 37 | namespace ns3 { |
| 38 | namespace ndn { |
| 39 | |
| 40 | using namespace ndnSIM; |
| 41 | |
| 42 | namespace cs { |
| 43 | |
| 44 | // explicit instantiation and registering |
| 45 | /** |
| 46 | * @brief ContentStore with stats and LRU cache replacement policy |
| 47 | **/ |
| 48 | template class ContentStoreWithStats<lru_policy_traits>; |
| 49 | |
| 50 | /** |
| 51 | * @brief ContentStore with stats and random cache replacement policy |
| 52 | **/ |
| 53 | template class ContentStoreWithStats<random_policy_traits>; |
| 54 | |
| 55 | /** |
| 56 | * @brief ContentStore with stats and FIFO cache replacement policy |
| 57 | **/ |
| 58 | template class ContentStoreWithStats<fifo_policy_traits>; |
| 59 | |
Alexander Afanasyev | 41824bd | 2013-01-23 23:57:59 -0800 | [diff] [blame] | 60 | /** |
| 61 | * @brief ContentStore with stats and Least Frequently Used (LFU) cache replacement policy |
| 62 | **/ |
| 63 | template class ContentStoreWithStats<lfu_policy_traits>; |
| 64 | |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 65 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithStats, lru_policy_traits); |
| 66 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithStats, random_policy_traits); |
| 67 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithStats, fifo_policy_traits); |
| 68 | |
Alexander Afanasyev | 41824bd | 2013-01-23 23:57:59 -0800 | [diff] [blame] | 69 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithStats, lfu_policy_traits); |
| 70 | |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 71 | #ifdef DOXYGEN |
| 72 | // /** |
Alexander Afanasyev | c3cc0b3 | 2012-12-12 18:41:20 -0800 | [diff] [blame] | 73 | // * \brief Content Store with stats implementing LRU cache replacement policy |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 74 | // */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 75 | class Stats::Lru : public ContentStoreWithStats<lru_policy_traits> { |
| 76 | }; |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 77 | |
| 78 | /** |
Alexander Afanasyev | c3cc0b3 | 2012-12-12 18:41:20 -0800 | [diff] [blame] | 79 | * \brief Content Store with stats implementing FIFO cache replacement policy |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 80 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 81 | class Stats::Fifo : public ContentStoreWithStats<fifo_policy_traits> { |
| 82 | }; |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 83 | |
| 84 | /** |
Alexander Afanasyev | c3cc0b3 | 2012-12-12 18:41:20 -0800 | [diff] [blame] | 85 | * \brief Content Store with stats implementing Random cache replacement policy |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 86 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 87 | class Stats::Random : public ContentStoreWithStats<random_policy_traits> { |
| 88 | }; |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 89 | |
Alexander Afanasyev | 41824bd | 2013-01-23 23:57:59 -0800 | [diff] [blame] | 90 | /** |
| 91 | * \brief Content Store with stats implementing Least Frequently Used cache replacement policy |
| 92 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 93 | class Stats::Lfu : public ContentStoreWithStats<lfu_policy_traits> { |
| 94 | }; |
Alexander Afanasyev | 41824bd | 2013-01-23 23:57:59 -0800 | [diff] [blame] | 95 | |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 96 | #endif |
| 97 | |
Alexander Afanasyev | 8566f45 | 2012-12-10 15:21:51 -0800 | [diff] [blame] | 98 | } // namespace cs |
| 99 | } // namespace ndn |
| 100 | } // namespace ns3 |