NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
in-memory-storage-fifo.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#include "
in-memory-storage-fifo.hpp
"
23
24
namespace
ndn
{
25
namespace
util {
26
27
InMemoryStorageFifo::InMemoryStorageFifo
(
size_t
limit)
28
:
InMemoryStorage
(limit)
29
{
30
}
31
32
InMemoryStorageFifo::~InMemoryStorageFifo
()
33
{
34
}
35
36
void
37
InMemoryStorageFifo::afterInsert
(
InMemoryStorageEntry
* entry)
38
{
39
BOOST_ASSERT(m_cleanupIndex.size() <=
size
());
40
m_cleanupIndex.insert(entry);
41
}
42
43
bool
44
InMemoryStorageFifo::evictItem
()
45
{
46
if
(!m_cleanupIndex.get<byArrival>().empty()) {
47
CleanupIndex::index<byArrival>::type::iterator
it = m_cleanupIndex.get<byArrival>().
begin
();
48
eraseImpl
((*it)->getFullName());
49
m_cleanupIndex.get<byArrival>().
erase
(it);
50
return
true
;
51
}
52
53
return
false
;
54
}
55
56
void
57
InMemoryStorageFifo::beforeErase
(
InMemoryStorageEntry
* entry)
58
{
59
CleanupIndex::index<byEntity>::type::iterator
it = m_cleanupIndex.get<byEntity>().
find
(entry);
60
if
(it != m_cleanupIndex.get<byEntity>().end())
61
m_cleanupIndex.get<byEntity>().erase(it);
62
}
63
64
}
// namespace util
65
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::util::InMemoryStorage::find
shared_ptr< const Data > find(const Interest &interest)
Finds the best match Data for an Interest.
Definition:
in-memory-storage.cpp:202
ndn::util::InMemoryStorageFifo::InMemoryStorageFifo
InMemoryStorageFifo(size_t limit=10)
Definition:
in-memory-storage-fifo.cpp:27
ndn::util::InMemoryStorage::begin
InMemoryStorage::const_iterator begin() const
Returns begin iterator of the in-memory storage ordering by name with digest.
Definition:
in-memory-storage.cpp:370
ndn::util::InMemoryStorage::evictItem
virtual bool evictItem()=0
Removes one Data packet from in-memory storage based on derived class implemented replacement policy...
ndn::util::InMemoryStorage::size
size_t size() const
Definition:
in-memory-storage.hpp:182
in-memory-storage-fifo.hpp
ndn::util::InMemoryStorage::eraseImpl
void eraseImpl(const Name &name)
deletes in-memory storage entries by the Name with implicit digest.
Definition:
in-memory-storage.cpp:359
nfd::cs::iterator
Table::const_iterator iterator
Definition:
cs-internal.hpp:41
ndn::util::InMemoryStorage
Represents in-memory storage.
Definition:
in-memory-storage.hpp:46
ndn::util::InMemoryStorageEntry
Represents an in-memory storage entry.
Definition:
in-memory-storage-entry.hpp:34
ndn::util::InMemoryStorageFifo::~InMemoryStorageFifo
virtual ~InMemoryStorageFifo()
Definition:
in-memory-storage-fifo.cpp:32
ndn::util::InMemoryStorageFifo::afterInsert
virtual void afterInsert(InMemoryStorageEntry *entry)
Update the entry after a entry is successfully inserted, add it to the cleanupIndex.
Definition:
in-memory-storage-fifo.cpp:37
ndn::util::InMemoryStorageFifo::beforeErase
virtual void beforeErase(InMemoryStorageEntry *entry)
Update the entry or other data structures before a entry is successfully erased, erase it from the cl...
Definition:
in-memory-storage-fifo.cpp:57
ndn::util::InMemoryStorage::erase
void erase(const Name &prefix, const bool isPrefix=true)
Deletes in-memory storage entry by prefix by default.
Definition:
in-memory-storage.cpp:332
ndnSIM
ndn-cxx
src
util
in-memory-storage-fifo.cpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11