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 | cd31abd | 2013-09-05 20:45:02 -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 | cd31abd | 2013-09-05 20:45:02 -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 | cd31abd | 2013-09-05 20:45:02 -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 | cd31abd | 2013-09-05 20:45:02 -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 | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 19 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame] | 20 | #include "content-store-with-probability.hpp" |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -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" |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 26 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 27 | #define NS_OBJECT_ENSURE_REGISTERED_TEMPL(type, templ) \ |
| 28 | static struct X##type##templ##RegistrationClass { \ |
| 29 | X##type##templ##RegistrationClass() \ |
| 30 | { \ |
| 31 | ns3::TypeId tid = type<templ>::GetTypeId(); \ |
| 32 | tid.GetParent(); \ |
| 33 | } \ |
| 34 | } x_##type##templ##RegistrationVariable |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 35 | |
| 36 | namespace ns3 { |
| 37 | namespace ndn { |
| 38 | |
| 39 | using namespace ndnSIM; |
| 40 | |
| 41 | namespace cs { |
| 42 | |
| 43 | // explicit instantiation and registering |
| 44 | /** |
| 45 | * @brief ContentStore with freshness and LRU cache replacement policy |
| 46 | **/ |
| 47 | template class ContentStoreWithProbability<lru_policy_traits>; |
| 48 | |
| 49 | /** |
| 50 | * @brief ContentStore with freshness and random cache replacement policy |
| 51 | **/ |
| 52 | template class ContentStoreWithProbability<random_policy_traits>; |
| 53 | |
| 54 | /** |
| 55 | * @brief ContentStore with freshness and FIFO cache replacement policy |
| 56 | **/ |
| 57 | template class ContentStoreWithProbability<fifo_policy_traits>; |
| 58 | |
| 59 | /** |
| 60 | * @brief ContentStore with freshness and Least Frequently Used (LFU) cache replacement policy |
| 61 | **/ |
| 62 | template class ContentStoreWithProbability<lfu_policy_traits>; |
| 63 | |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 64 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithProbability, lru_policy_traits); |
| 65 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithProbability, random_policy_traits); |
| 66 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithProbability, fifo_policy_traits); |
| 67 | |
| 68 | NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithProbability, lfu_policy_traits); |
| 69 | |
| 70 | #ifdef DOXYGEN |
| 71 | // /** |
| 72 | // * \brief Content Store with freshness implementing LRU cache replacement policy |
| 73 | // */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 74 | class Probability::Lru : public ContentStoreWithProbability<lru_policy_traits> { |
| 75 | }; |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * \brief Content Store with freshness implementing FIFO cache replacement policy |
| 79 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 80 | class Probability::Fifo : public ContentStoreWithProbability<fifo_policy_traits> { |
| 81 | }; |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * \brief Content Store with freshness implementing Random cache replacement policy |
| 85 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 86 | class Probability::Random : public ContentStoreWithProbability<random_policy_traits> { |
| 87 | }; |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * \brief Content Store with freshness implementing Least Frequently Used cache replacement policy |
| 91 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 92 | class Probability::Lfu : public ContentStoreWithProbability<lfu_policy_traits> { |
| 93 | }; |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 94 | |
| 95 | #endif |
| 96 | |
Alexander Afanasyev | cd31abd | 2013-09-05 20:45:02 -0700 | [diff] [blame] | 97 | } // namespace cs |
| 98 | } // namespace ndn |
| 99 | } // namespace ns3 |