本文整理汇总了C++中Strategy::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Strategy::getName方法的具体用法?C++ Strategy::getName怎么用?C++ Strategy::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strategy
的用法示例。
在下文中一共展示了Strategy::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
StrategyChoice::insert(const Name& prefix, const Name& strategyName)
{
Strategy* strategy = this->getStrategy(strategyName);
if (strategy == nullptr) {
NFD_LOG_ERROR("insert(" << prefix << "," << strategyName << ") strategy not installed");
return false;
}
shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(prefix);
shared_ptr<Entry> entry = nte->getStrategyChoiceEntry();
Strategy* oldStrategy = nullptr;
if (entry != nullptr) {
if (entry->getStrategy().getName() == strategy->getName()) {
NFD_LOG_TRACE("insert(" << prefix << ") not changing " << strategy->getName());
return true;
}
oldStrategy = &entry->getStrategy();
NFD_LOG_TRACE("insert(" << prefix << ") changing from " << oldStrategy->getName() <<
" to " << strategy->getName());
}
if (entry == nullptr) {
oldStrategy = &this->findEffectiveStrategy(prefix);
entry = make_shared<Entry>(prefix);
nte->setStrategyChoiceEntry(entry);
++m_nItems;
NFD_LOG_TRACE("insert(" << prefix << ") new entry " << strategy->getName());
}
this->changeStrategy(*entry, *oldStrategy, *strategy);
entry->setStrategy(*strategy);
return true;
}
示例2: addStrategy
void Engine::addStrategy(string name)
{
removeStrategy(name);
Strategy* strategy = aiObjectContext->GetStrategy(name);
if (strategy)
{
set<string> siblings = aiObjectContext->GetSiblingStrategy(name);
for (set<string>::iterator i = siblings.begin(); i != siblings.end(); i++)
removeStrategy(*i);
LogAction("S:+%s", strategy->getName().c_str());
strategies[strategy->getName()] = strategy;
}
Init();
}