本文整理汇总了C++中basic::Pair::slot方法的典型用法代码示例。如果您正苦于以下问题:C++ Pair::slot方法的具体用法?C++ Pair::slot怎么用?C++ Pair::slot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类basic::Pair
的用法示例。
在下文中一共展示了Pair::slot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSlotBehaviors
bool Arbiter::setSlotBehaviors(Basic::PairStream* const x)
{
bool ok = true;
// First, make sure they are all behaviors
{
Basic::List::Item* item = x->getFirstItem();
while (item != nullptr && ok) {
Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
item = item->getNext();
Behavior* b = dynamic_cast<Behavior*>( pair->object() );
if (b == nullptr) {
// Item is NOT a behavior
std::cerr << "setSlotBehaviors: slot: " << *pair->slot() << " is NOT of a Behavior type!" << std::endl;
ok = false;
}
}
}
// next, add behaviors to our list
if (ok) {
Basic::List::Item* item = x->getFirstItem();
while (item != nullptr) {
Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
item = item->getNext();
Behavior* b = static_cast<Behavior*>(pair->object());
addBehavior(b);
}
}
return ok;
}
示例2: setSlotAgentList
// Sets the actor/behavior list
bool MultiActorAgent::setSlotAgentList(Basic::PairStream* const msg)
{
bool ok = false;
if (msg != nullptr) {
// First clear the old list
clearAgentList();
// Now scan the pair stream and put all Ntm objects into the table.
Basic::List::Item* item = msg->getFirstItem();
while (item != nullptr) {
Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
//std::cerr << "MultiActorAgent::setSlotagentList: slot: " << *pair->slot() << std::endl;
Basic::Ubf::Behavior* b = dynamic_cast<Basic::Ubf::Behavior*>( pair->object() );
if (b != nullptr) {
// We have an object, so put it in the table
addAgent(pair->slot(), b);
}
item = item->getNext();
}
ok = true;
}
return ok;
}