NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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, unique_ptr< Policy > policy=makeDefaultPolicy())
 
bool 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 65 of file cs.hpp.

Member Typedef Documentation

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

Definition at line 77 of file cs.hpp.

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

Definition at line 78 of file cs.hpp.

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

ContentStore iterator (public API)

Definition at line 148 of file cs.hpp.

Constructor & Destructor Documentation

nfd::cs::Cs::Cs ( size_t  nMaxPackets = 10,
unique_ptr< Policy policy = makeDefaultPolicy() 
)
explicit

Definition at line 53 of file cs.cpp.

Member Function Documentation

bool 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 120 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 93 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 60 of file cs.cpp.

Referenced by erase().

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

Definition at line 66 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 72 of file cs.cpp.

Referenced by erase().

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

Definition at line 117 of file cs.hpp.

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

Definition at line 125 of file cs.hpp.

References PUBLIC_WITH_TESTS_ELSE_PRIVATE.

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

Definition at line 151 of file cs.hpp.

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

Definition at line 157 of file cs.hpp.


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