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

represents the Strategy Choice table More...

#include <strategy-choice.hpp>

Inheritance diagram for nfd::StrategyChoice:
Collaboration diagram for nfd::StrategyChoice:

Classes

class  const_iterator
 

Public Member Functions

 StrategyChoice (NameTree &nameTree, shared_ptr< fw::Strategy > defaultStrategy)
 
bool hasStrategy (const Name &strategyName, bool isExact=false) const
 determines if a strategy is installed More...
 
bool install (shared_ptr< fw::Strategy > strategy)
 install a strategy More...
 
bool insert (const Name &prefix, const Name &strategyName)
 set strategy of prefix to be strategyName More...
 
void erase (const Name &prefix)
 make prefix to inherit strategy from its parent More...
 
std::pair< bool, Nameget (const Name &prefix) const
 get strategy Name of prefix More...
 
fw::StrategyfindEffectiveStrategy (const Name &prefix) const
 get effective strategy for prefix More...
 
fw::StrategyfindEffectiveStrategy (const pit::Entry &pitEntry) const
 get effective strategy for pitEntry More...
 
fw::StrategyfindEffectiveStrategy (const measurements::Entry &measurementsEntry) const
 get effective strategy for measurementsEntry More...
 
size_t size () const
 number of entries stored More...
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

represents the Strategy Choice table

The Strategy Choice table maintains available Strategy types, and associates Name prefixes with Strategy types.

Each strategy is identified by a strategyName. It's recommended to include a version number as the last component of strategyName.

A Name prefix is owned by a strategy if a longest prefix match on the Strategy Choice table returns that strategy.

Definition at line 45 of file strategy-choice.hpp.

Constructor & Destructor Documentation

◆ StrategyChoice()

nfd::StrategyChoice::StrategyChoice ( NameTree nameTree,
shared_ptr< fw::Strategy defaultStrategy 
)

Definition at line 39 of file strategy-choice.cpp.

Member Function Documentation

◆ hasStrategy()

bool nfd::StrategyChoice::hasStrategy ( const Name strategyName,
bool  isExact = false 
) const

determines if a strategy is installed

Parameters
isExacttrue to require exact match, false to permit unversioned strategyName
Returns
true if strategy is installed

Definition at line 47 of file strategy-choice.cpp.

Referenced by install(), and nfd::fw::installStrategies().

◆ install()

bool nfd::StrategyChoice::install ( shared_ptr< fw::Strategy strategy)

install a strategy

Returns
true if installed; false if not installed due to duplicate strategyName
Note
shared_ptr is passed by value because StrategyChoice takes ownership of strategy

Definition at line 58 of file strategy-choice.cpp.

References hasStrategy(), and NFD_LOG_ERROR.

Referenced by nfd::fw::installStrategies().

◆ insert()

bool nfd::StrategyChoice::insert ( const Name prefix,
const Name strategyName 
)

set strategy of prefix to be strategyName

Parameters
strategyNamethe strategy to be used
Returns
true on success

This method set a strategy onto a Name prefix. The strategy must have been installed. The strategyName can either be exact (contains version component), or omit the version component to pick the latest version.

Definition at line 90 of file strategy-choice.cpp.

References findEffectiveStrategy(), nfd::fw::Strategy::getName(), nfd::NameTree::lookup(), NFD_LOG_ERROR, and NFD_LOG_TRACE.

◆ erase()

void nfd::StrategyChoice::erase ( const Name prefix)

make prefix to inherit strategy from its parent

not allowed for root prefix (ndn:/)

Definition at line 125 of file strategy-choice.cpp.

References nfd::NameTree::eraseEntryIfEmpty(), findEffectiveStrategy(), nfd::NameTree::findExactMatch(), ndn::Name::getPrefix(), and ndn::Name::size().

◆ get()

std::pair< bool, Name > nfd::StrategyChoice::get ( const Name prefix) const

get strategy Name of prefix

Returns
true and strategyName at exact match, or false

Definition at line 150 of file strategy-choice.cpp.

References nfd::NameTree::findExactMatch(), and ns3::ndn::Name.

◆ findEffectiveStrategy() [1/3]

Strategy & nfd::StrategyChoice::findEffectiveStrategy ( const Name prefix) const

get effective strategy for prefix

Definition at line 166 of file strategy-choice.cpp.

References nfd::NameTree::findLongestPrefixMatch(), and nfd::name_tree::Entry::getStrategyChoiceEntry().

Referenced by erase(), findEffectiveStrategy(), and insert().

◆ findEffectiveStrategy() [2/3]

Strategy & nfd::StrategyChoice::findEffectiveStrategy ( const pit::Entry pitEntry) const

get effective strategy for pitEntry

Definition at line 194 of file strategy-choice.cpp.

References findEffectiveStrategy(), and nfd::NameTree::get().

◆ findEffectiveStrategy() [3/3]

Strategy & nfd::StrategyChoice::findEffectiveStrategy ( const measurements::Entry measurementsEntry) const

get effective strategy for measurementsEntry

Definition at line 203 of file strategy-choice.cpp.

References findEffectiveStrategy(), and nfd::NameTree::get().

◆ size()

size_t nfd::StrategyChoice::size ( ) const
inline

number of entries stored

Definition at line 173 of file strategy-choice.hpp.

◆ begin()

◆ end()

StrategyChoice::const_iterator nfd::StrategyChoice::end ( ) const
inline

Definition at line 179 of file strategy-choice.hpp.

References nfd::NameTree::end().

Referenced by nfd::StrategyChoicePublisher::generate().


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