NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
in-memory-storage-fifo.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
23 #define NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
24 
25 #include "in-memory-storage.hpp"
26 
27 #include <boost/multi_index_container.hpp>
28 #include <boost/multi_index/sequenced_index.hpp>
29 #include <boost/multi_index/hashed_index.hpp>
30 
31 namespace ndn {
32 namespace util {
33 
38 {
39 public:
40  explicit
41  InMemoryStorageFifo(size_t limit = 10);
42 
43  explicit
44  InMemoryStorageFifo(boost::asio::io_service& ioService, size_t limit = 10);
45 
46  virtual
48 
53  virtual bool
55 
58  virtual void
60 
64  virtual void
66 
67 private:
68  //multi_index_container to implement FIFO
69  class byArrival;
70  class byEntity;
71 
72  typedef boost::multi_index_container<
74  boost::multi_index::indexed_by<
75 
76  // by Entry itself
77  boost::multi_index::hashed_unique<
78  boost::multi_index::tag<byEntity>,
79  boost::multi_index::identity<InMemoryStorageEntry*>
80  >,
81 
82  // by arrival (FIFO)
83  boost::multi_index::sequenced<
84  boost::multi_index::tag<byArrival>
85  >
86 
87  >
88  > CleanupIndex;
89 
90  CleanupIndex m_cleanupIndex;
91 };
92 
93 } // namespace util
94 } // namespace ndn
95 
96 #endif // NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Provides in-memory storage employing FIFO replacement policy, which is first in first out...
virtual bool evictItem()=0
Removes one Data packet from in-memory storage based on derived class implemented replacement policy...
Represents in-memory storage.
Represents an in-memory storage entry.
virtual void afterInsert(InMemoryStorageEntry *entry)
Update the entry after a entry is successfully inserted, add it to the cleanupIndex.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
Definition: common.hpp:42
virtual void beforeErase(InMemoryStorageEntry *entry)
Update the entry or other data structures before a entry is successfully erased, erase it from the cl...