Project

General

Profile

Task #1309

Updated by Junxiao Shi about 10 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, const StrategyCreator& strategyCreator, const Name& defaultStrategyName); strategyCreator); 
      
       // 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<const Name> get(const Name& prefix); 
      
       // get effective strategy for prefix 
       shared_ptr<Strategy> findEffectiveStrategy(const Strategy& findLongestPrefixMatch(const Name& prefix); 
      
       // get effective strategy for pitEntry (NameTree shortcut) pitEntry.getName(), NameTree shortcut 
       shared_ptr<Strategy> findEffectiveStrategy(const Strategy& findLongestPrefixMatch(const pit::Entry& pitEntry); 
     }; 

Back