blob: b4d2eae13fa00e008f2dab16a37954bcc6973774 [file] [log] [blame]
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -07001/* -*- 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 Afanasyev0c395372014-12-20 15:54:02 -080021#include "content-store-impl.hpp"
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070022
Alexander Afanasyev0c395372014-12-20 15:54:02 -080023#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"
27#include "../../utils/trie/multi-policy.hpp"
28#include "../../utils/trie/aggregate-stats-policy.hpp"
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070029
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080030#define NS_OBJECT_ENSURE_REGISTERED_TEMPL(type, templ) \
31 static struct X##type##templ##RegistrationClass { \
32 X##type##templ##RegistrationClass() \
33 { \
34 ns3::TypeId tid = type<templ>::GetTypeId(); \
35 tid.GetParent(); \
36 } \
37 } x_##type##templ##RegistrationVariable
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070038
39namespace ns3 {
40namespace ndn {
41
42using namespace ndnSIM;
43
44namespace cs {
45
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070046// explicit instantiation and registering
Alexander Afanasyev1cd79ae2012-10-05 22:42:12 -070047/**
48 * @brief ContentStore with LRU cache replacement policy
49 **/
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070050template class ContentStoreImpl<lru_policy_traits>;
Alexander Afanasyev1cd79ae2012-10-05 22:42:12 -070051
52/**
53 * @brief ContentStore with random cache replacement policy
54 **/
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070055template class ContentStoreImpl<random_policy_traits>;
Alexander Afanasyev1cd79ae2012-10-05 22:42:12 -070056
57/**
58 * @brief ContentStore with FIFO cache replacement policy
59 **/
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070060template class ContentStoreImpl<fifo_policy_traits>;
61
Alexander Afanasyev41824bd2013-01-23 23:57:59 -080062/**
63 * @brief ContentStore with Least Frequently Used (LFU) cache replacement policy
64 **/
65template class ContentStoreImpl<lfu_policy_traits>;
66
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070067NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, lru_policy_traits);
68NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, random_policy_traits);
69NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, fifo_policy_traits);
Alexander Afanasyev41824bd2013-01-23 23:57:59 -080070NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, lfu_policy_traits);
71
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080072typedef multi_policy_traits<boost::mpl::vector2<lru_policy_traits, aggregate_stats_policy_traits>>
73 LruWithCountsTraits;
74typedef multi_policy_traits<boost::mpl::vector2<random_policy_traits,
75 aggregate_stats_policy_traits>>
76 RandomWithCountsTraits;
77typedef multi_policy_traits<boost::mpl::vector2<fifo_policy_traits, aggregate_stats_policy_traits>>
78 FifoWithCountsTraits;
79typedef multi_policy_traits<boost::mpl::vector2<lfu_policy_traits, aggregate_stats_policy_traits>>
80 LfuWithCountsTraits;
Alexander Afanasyeve091bea2014-02-14 15:27:25 -080081
82template class ContentStoreImpl<LruWithCountsTraits>;
83NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, LruWithCountsTraits);
84
85template class ContentStoreImpl<RandomWithCountsTraits>;
86NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, RandomWithCountsTraits);
87
88template class ContentStoreImpl<FifoWithCountsTraits>;
89NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, FifoWithCountsTraits);
90
91template class ContentStoreImpl<LfuWithCountsTraits>;
92NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, LfuWithCountsTraits);
93
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080094#ifdef DOXYGEN
95// /**
96// * \brief Content Store implementing LRU cache replacement policy
97// */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080098class Lru : public ContentStoreImpl<lru_policy_traits> {
99};
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800100
101/**
102 * \brief Content Store implementing FIFO cache replacement policy
103 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800104class Fifo : public ContentStoreImpl<fifo_policy_traits> {
105};
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800106
107/**
108 * \brief Content Store implementing Random cache replacement policy
109 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800110class Random : public ContentStoreImpl<random_policy_traits> {
111};
Alexander Afanasyev41824bd2013-01-23 23:57:59 -0800112
113/**
114 * \brief Content Store implementing Least Frequently Used cache replacement policy
115 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800116class Lfu : public ContentStoreImpl<lfu_policy_traits> {
117};
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800118#endif
119
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700120} // namespace cs
121} // namespace ndn
122} // namespace ns3