本文整理汇总了C++中Pair::slot方法的典型用法代码示例。如果您正苦于以下问题:C++ Pair::slot方法的具体用法?C++ Pair::slot怎么用?C++ Pair::slot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pair
的用法示例。
在下文中一共展示了Pair::slot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
void Sequence::add(const Pair& p) {
if (_length == 0)
_slot = p.slot();
this->push_back(p);
_back_slot = p.slot();
p.source().add_to_sequence(this);
p.target().add_to_sequence(this);
++_length;
}
示例2: setStMach
// -----------------------------------------------------------------
// Sets the state machine 'name' or zero to clear. Return true
// if successful. If the 'code' is CHK_CUR_STATE or GET_NEXT_STATE
// then we do NOT actually set the stMach, but we only check to
// see if the stMach 'name' exists.
// -----------------------------------------------------------------
bool StateMachine::setStMach(const char* const name, const StateTableCode code)
{
bool ok = false;
if (code == CURR_STATE) {
// Current state is now also the previous state
StateMachine* oldStMach = stMach;
// First, check to see if they're asking for the same state
// as our current state.
ok = (stMachName == nullptr && name == nullptr);
if (!ok && stMachName != nullptr && name != nullptr) {
ok = *stMachName == name;
}
// When they're not the same then we make a switch ...
if (!ok) {
if (name != nullptr) {
Pair* p = findStMachByName(name);
if (p != nullptr) {
stMach = static_cast<StateMachine*>(p->object());
stMachName = p->slot();
ok = true;
}
}
else {
// 'name' is null, so set the new state to null.
stMach = nullptr;
stMachName = nullptr;
ok = true;
}
if (ok) {
pStMach = oldStMach;
}
}
}
else {
// -- only need to look to see if this named state machine exists.
ok = (findStMachByName(name) != nullptr);
}
return ok;
}