Task #1309
Updated by Junxiao Shi over 11 years ago
Implement the **Strategy Choice table**.
class StrategyChoice
{
public:
// a function that creates a strategy instance by strategy Name
typedef function<shared_ptr<Strategy>(const Name&)> StrategyCreator;
// constructor
StrategyChoice(NameTree& nameTree, shared_ptr<Strategy> defaultStrategy);
// install strategy
// Strategy::getName() gives its strategyName, which must be unique
bool install(shared_ptr<Strategy> strategy); const StrategyCreator& strategyCreator, const Name& defaultStrategyName);
// set strategy of prefix to be strategyName
bool insert(const Name& prefix, const Name& strategyName);
// make prefix to inherit strategy from its parent
// not allowed for root prefix (ndn:/)
void erase(const Name& prefix);
// get strategy Name of prefix (exact match)
shared_ptr<Name> shared_ptr<const Name> get(const Name& prefix);
// get effective strategy for prefix
Strategy& shared_ptr<Strategy> findEffectiveStrategy(const Name& prefix);
// get effective strategy for pitEntry (NameTree shortcut)
Strategy& shared_ptr<Strategy> findEffectiveStrategy(const pit::Entry& pitEntry);
};