represents the Strategy Choice table More...
#include <strategy-choice.hpp>
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, Name > | get (const Name &prefix) const |
get strategy Name of prefix More... | |
fw::Strategy & | findEffectiveStrategy (const Name &prefix) const |
get effective strategy for prefix More... | |
fw::Strategy & | findEffectiveStrategy (const pit::Entry &pitEntry) const |
get effective strategy for pitEntry More... | |
fw::Strategy & | findEffectiveStrategy (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 |
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.
nfd::StrategyChoice::StrategyChoice | ( | NameTree & | nameTree, |
shared_ptr< fw::Strategy > | defaultStrategy | ||
) |
bool nfd::StrategyChoice::hasStrategy | ( | const Name & | strategyName, |
bool | isExact = false |
||
) | const |
determines if a strategy is installed
isExact | true to require exact match, false to permit unversioned strategyName |
Definition at line 47 of file strategy-choice.cpp.
Referenced by nfd::TablesConfigSection::ensureTablesAreConfigured(), install(), ns3::ndn::StrategyChoiceHelper::Install(), nfd::fw::installStrategies(), and nfd::StrategyChoiceManager::onStrategyChoiceRequest().
bool nfd::StrategyChoice::install | ( | shared_ptr< fw::Strategy > | strategy | ) |
install a strategy
Definition at line 58 of file strategy-choice.cpp.
References hasStrategy(), ndn::Name::isPrefixOf(), NFD_LOG_ERROR, and ndn::Name::size().
Referenced by findEffectiveStrategy(), ns3::ndn::StrategyChoiceHelper::Install(), and nfd::fw::installStrategies().
set strategy of prefix to be strategyName
strategyName | the strategy to be used |
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::NameTree::lookup(), NFD_LOG_ERROR, NFD_LOG_TRACE, and nfd::fw::Strategy.
Referenced by nfd::TablesConfigSection::ensureTablesAreConfigured(), and nfd::StrategyChoiceManager::onStrategyChoiceRequest().
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(), ndn::Name::size(), and nfd::fw::Strategy.
Referenced by nfd::StrategyChoiceManager::onStrategyChoiceRequest().
get strategy Name of prefix
Definition at line 150 of file strategy-choice.cpp.
References nfd::NameTree::findExactMatch(), ns3::ndn::Name, and nfd::fw::Strategy.
Referenced by nfd::StrategyChoiceManager::onStrategyChoiceRequest().
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(), nfd::name_tree::Entry::getStrategyChoiceEntry(), and nfd::fw::Strategy.
Referenced by erase(), findEffectiveStrategy(), insert(), and nfd::MeasurementsAccessor::~MeasurementsAccessor().
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(), nfd::NameTree::get(), and nfd::fw::Strategy.
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(), nfd::NameTree::get(), install(), nfd::NameTree::lookup(), ns3::ndn::Name, and NFD_LOG_INFO.
|
inline |
number of entries stored
Definition at line 173 of file strategy-choice.hpp.
StrategyChoice::const_iterator nfd::StrategyChoice::begin | ( | ) | const |
Definition at line 278 of file strategy-choice.cpp.
References nfd::NameTree::fullEnumerate(), and nfd::name_tree::Entry::getStrategyChoiceEntry().
Referenced by nfd::StrategyChoicePublisher::generate().
|
inline |
Definition at line 179 of file strategy-choice.hpp.
References nfd::StrategyChoice::const_iterator::const_iterator().
Referenced by nfd::StrategyChoicePublisher::generate().