NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::cs::Cs Class Reference

represents the ContentStore More...

#include <cs.hpp>

Inheritance diagram for nfd::cs::Cs:
Collaboration diagram for nfd::cs::Cs:

Classes

struct  EntryFromEntryImpl
 

Public Types

typedef std::function< void(const Interest &, const Data &data)> HitCallback
 
typedef std::function< void(const Interest &)> MissCallback
 
typedef boost::transform_iterator< EntryFromEntryImpl, iterator, const Entry & > const_iterator
 ContentStore iterator (public API) More...
 

Public Member Functions

 Cs (size_t nMaxPackets=10)
 
void insert (const Data &data, bool isUnsolicited=false)
 inserts a Data packet More...
 
void find (const Interest &interest, const HitCallback &hitCallback, const MissCallback &missCallback) const
 finds the best matching Data packet More...
 
void erase (const Name &exactName)
 
void setLimit (size_t nMaxPackets)
 changes capacity (in number of packets) More...
 
size_t getLimit () const
 
void setPolicy (unique_ptr< Policy > policy)
 changes cs replacement policy More...
 
PolicygetPolicy () const
 
size_t size () const
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

represents the ContentStore

Definition at line 62 of file cs.hpp.

Member Typedef Documentation

typedef std::function<void(const Interest&, const Data& data)> nfd::cs::Cs::HitCallback

Definition at line 73 of file cs.hpp.

typedef std::function<void(const Interest&)> nfd::cs::Cs::MissCallback

Definition at line 74 of file cs.hpp.

typedef boost::transform_iterator<EntryFromEntryImpl, iterator, const Entry&> nfd::cs::Cs::const_iterator

ContentStore iterator (public API)

Definition at line 144 of file cs.hpp.

Constructor & Destructor Documentation

nfd::cs::Cs::Cs ( size_t  nMaxPackets = 10)
explicit

Definition at line 46 of file cs.cpp.

References nfd::cs::makeDefaultPolicy().

Member Function Documentation

void nfd::cs::Cs::insert ( const Data data,
bool  isUnsolicited = false 
)
void nfd::cs::Cs::find ( const Interest interest,
const HitCallback hitCallback,
const MissCallback missCallback 
) const

finds the best matching Data packet

Parameters
interestthe Interest for lookup
hitCallbacka callback if a match is found; must not be empty
missCallbacka callback if there's no match; must not be empty
Note
A lookup invokes either callback exactly once. The callback may be invoked either before or after find() returns

Definition at line 115 of file cs.cpp.

References nfd::cs::Entry::canSatisfy(), nfd::find_last_if(), ndn::Interest::getChildSelector(), ndn::Interest::getName(), ndn::Name::getPrefix(), ndn::Name::getSuccessor(), NFD_LOG_DEBUG, NFD_LOG_TRACE, and ndn::Name::size().

void nfd::cs::Cs::erase ( const Name exactName)
inline

Definition at line 89 of file cs.hpp.

References getLimit(), setLimit(), and setPolicy().

void nfd::cs::Cs::setLimit ( size_t  nMaxPackets)

changes capacity (in number of packets)

Definition at line 53 of file cs.cpp.

Referenced by erase().

size_t nfd::cs::Cs::getLimit ( ) const
Returns
capacity (in number of packets)

Definition at line 59 of file cs.cpp.

Referenced by erase().

void nfd::cs::Cs::setPolicy ( unique_ptr< Policy policy)

changes cs replacement policy

Precondition
size() == 0

Definition at line 65 of file cs.cpp.

Referenced by erase().

Policy* nfd::cs::Cs::getPolicy ( ) const
inline
Returns
cs replacement policy

Definition at line 113 of file cs.hpp.

size_t nfd::cs::Cs::size ( ) const
inline
Returns
number of stored packets

Definition at line 121 of file cs.hpp.

References PUBLIC_WITH_TESTS_ELSE_PRIVATE.

const_iterator nfd::cs::Cs::begin ( ) const
inline

Definition at line 147 of file cs.hpp.

const_iterator nfd::cs::Cs::end ( ) const
inline

Definition at line 153 of file cs.hpp.


The documentation for this class was generated from the following files: