本文整理汇总了C++中Station::getNom方法的典型用法代码示例。如果您正苦于以下问题:C++ Station::getNom方法的具体用法?C++ Station::getNom怎么用?C++ Station::getNom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Station
的用法示例。
在下文中一共展示了Station::getNom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: avancer
void Rame::avancer()
{
pthread_mutex_lock(&mutex);
if (this->position == 0 && this->sens == Rame::Retour) {
qDebug() << "Changement";
this->setPosition(0);
this->sens = Rame::Aller;
this->position++;
} else if (this->position == this->ligne->getLongueur() && this->sens == Rame::Aller) {
qDebug() << "Changement";
this->setPosition(this->ligne->getLongueur());
this->sens = Rame::Retour;
this->position--;
} else if (this->position < this->ligne->getLongueur()) {
bool aller = true;
if (this->sens == Rame::Retour) {
aller = false;
}
Element * e = this->ligne->getElementAt(this->position, aller);
qDebug() << "Rame " << this->numRame << " \t position : " << this->getPosition();
if (e->getClasse() == "Feu") {
Feux * f = dynamic_cast<Feux *>(e);
f->addSignal(new Signals(this, Signals::Demande));
qDebug() << "Rame " << this->numRame << " \t > envoi signal Feu" << f->getNum() << ".";
if (this->listSignals.empty()) {
qDebug() << "Rame " << this->numRame << " \t attend reponse Feu" << f->getNum() << ".";
}
} else if (e->getClasse() == "Station") {
Station * s = dynamic_cast<Station *>(e);
s->addSignal(new Signals(this, Signals::Demande));
qDebug() << "Rame " << this->numRame << " \t arrive a station " << s->getNom();
} else {
bool obstacle = false;
if (this->position < this->ligne->getLongueur() - 1) {
Element * suivant;
if (aller)
suivant = this->ligne->getElementAt(this->position + 1, aller);
else
suivant = this->ligne->getElementAt(this->position - 1, aller);
if (suivant->getClasse() == "Obstacle") {
obstacle = true;
qDebug() << "Rame " << this->numRame << " \t Obstacle détecté";
}
}
if (!obstacle)
if (this->sens == Rame::Aller) {
this->position++;
} else {
this->position--;
}
}
}
pthread_mutex_unlock(&mutex);
}