本文整理汇总了C++中SignalGroup::hasYellow方法的典型用法代码示例。如果您正苦于以下问题:C++ SignalGroup::hasYellow方法的具体用法?C++ SignalGroup::hasYellow怎么用?C++ SignalGroup::hasYellow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignalGroup
的用法示例。
在下文中一共展示了SignalGroup::hasYellow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assConn
std::string
NBLoadedTLDef::buildPhaseState(unsigned int time) const {
unsigned int pos = 0;
std::string state;
// set the green and yellow information first;
// the information whether other have to break needs those masks
// completely filled
for (SignalGroupCont::const_iterator i = mySignalGroups.begin(); i != mySignalGroups.end(); i++) {
SignalGroup* group = (*i).second;
unsigned int linkNo = group->getLinkNo();
bool mayDrive = group->mayDrive(time);
bool hasYellow = group->hasYellow(time);
char c = 'r';
if (mayDrive) {
c = 'g';
}
if (hasYellow) {
c = 'y';
}
for (unsigned int j = 0; j < linkNo; j++) {
const NBConnection& conn = group->getConnection(j);
NBConnection assConn(conn);
// assert that the connection really exists
if (assConn.check(*myEdgeCont)) {
state = state + c;
++pos;
}
}
}
// set the braking mask
pos = 0;
for (SignalGroupCont::const_iterator i = mySignalGroups.begin(); i != mySignalGroups.end(); i++) {
SignalGroup* group = (*i).second;
unsigned int linkNo = group->getLinkNo();
for (unsigned int j = 0; j < linkNo; j++) {
const NBConnection& conn = group->getConnection(j);
NBConnection assConn(conn);
if (assConn.check(*myEdgeCont)) {
if (!mustBrake(assConn, state, pos)) {
if (state[pos] == 'g') {
state[pos] = 'G';
}
if (state[pos] == 'y') {
state[pos] = 'Y';
}
}
pos++;
}
}
}
return state;
}