本文整理汇总了C++中Station类的典型用法代码示例。如果您正苦于以下问题:C++ Station类的具体用法?C++ Station怎么用?C++ Station使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Station类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pthread_mutex_lock
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);
}
示例2: readFile
void readFile(string filePath, Station *stations)
{
fstream inputFile;
inputFile.open(filePath.c_str(), fstream::in);
if(inputFile.fail())
{
cerr << "no such file: " << filePath << endl;
return;
}
string line = "";
int counter = 0;
Station *st;
while(!inputFile.eof())
{
inputFile >> line;
st = new Station(line);
if(st->getTotalQuantity() >= 10.0)
{
stations[counter] = *st;
}
counter++;
}
inputFile.close();
}
示例3: getParent
unsigned long NetThread::userFunc(const LCreal dt)
{
Station* station = (Station*) getParent();
station->processNetworkInputTasks(dt);
station->processNetworkOutputTasks(dt);
return 0;
}
示例4: data
Station
DragMimeData::station() const
{
Station station;
station.setUrl( QString::fromUtf8( data( "item/station" ) ) );
return station;
}
示例5: moveTo
MoveHistory Station::moveTo(Station *destination, const MoveHistory &moveHistory) const
{
// 목적지까지 도달함
if (this == destination)
return moveHistory;
MoveHistory minHistory; // 초기셋, INT_MAX
for (auto it = hoursMap.begin(); it != hoursMap.end(); it++) //모든 이웃한 역에 대하여
{
Station *neighbor = it->first;
MoveHistory myHistory = moveHistory;
// 해당 역으로의 이동이 유의미한지 검사
if (myHistory.moveTo(neighbor) == false)
continue;
// 유의미하다면 이동을 실시
myHistory = neighbor->moveTo(destination, myHistory);
// 현재의 이동내역 소요시간이 최소인가?
if (myHistory.hours < minHistory.hours)
minHistory = myHistory;
}
return minHistory;
}
示例6: stationId
void
CashReconcile::slotShiftClose()
{
QDate date = _date->getDate();
Id station_id = stationId();
Id employee_id = employeeId();
// Posting time is current time if closing for today or 11:59:59 PM
QTime time = QTime::currentTime();
if (date != QDate::currentDate())
time = QTime(23, 59, 59);
QString name;
if (station_id != INVALID_ID) {
Station station;
_quasar->db()->lookup(station_id, station);
name = station.name();
} else if (employee_id != INVALID_ID) {
Employee employee;
_quasar->db()->lookup(employee_id, employee);
name = employee.nameFL();
} else {
name = "<None>";
}
if (name.isEmpty()) name = tr("<blank>");
QString message = "Are you sure you want to ringoff \n\"" + name + "\"";
int choice = QMessageBox::warning(this, tr("Ringoff?"), message,
tr("Yes"), tr("No"));
if (choice != 0) return;
// Create the shift
Shift shift;
shift.setStoreId(_store->getId());
shift.setStationId(station_id);
shift.setEmployeeId(employee_id);
shift.setPostDate(date);
shift.setPostTime(time);
if (!_quasar->db()->create(shift)) {
message = tr("Failed creating shift close transaction");
QMessageBox::critical(this, tr("Error"), message);
return;
}
QApplication::setOverrideCursor(waitCursor);
qApp->processEvents();
bool result = _quasar->db()->shiftClose(shift);
QApplication::restoreOverrideCursor();
if (!result) {
message = tr("Failed setting shift in transactions");
QMessageBox::critical(this, tr("Error"), message);
} else {
message = "The shift for \"" + name + "\"\nhas been closed";
QMessageBox::information(this, tr("Information"), message);
slotRefresh();
}
}
示例7: getTrack
void RockmaxServer::getTrack(const Station& station) {
QNetworkReply* reply = manager->get(QNetworkRequest(QUrl(
station.id() > 0
? QString("http://www.rockmax.cz/stream_%0/all_songs_%0.txt").arg(station.nick())
: QString("http://www.rockmax.cz/stream_live/all_songs.txt")
)));
connect(reply, SIGNAL(finished()), SLOT(processTrack()));
}
示例8: OnStopRecordStation
void OnStopRecordStation(const Station& station)
{
streamrecorder_.StopRecording(station.GetId());
pView_->ClearStationStatus(station.GetId());
pView_->ClearStationTitle(station.GetId());
pView_->DisableStopRecording();
}
示例9: station_get_name
int
station_get_name(LuaState* state)
{
Station* station = rMain()->getMission()->getStation();
wstring stationName = station->getName();
state->PushWString(stationName.c_str());
return 1;
}
示例10: Station
void Car::addNewStation(QString name)
{
Station *station = new Station(-1, name, this);
_stationlist.append(station);
qSort(_stationlist.begin(), _stationlist.end(), sortStationById);
station->save();
emit stationsChanged();
}
示例11: station_count_modules
int
station_count_modules(LuaState* state)
{
Station* station = rMain()->getMission()->getStation();
if(station == NULL) return 0;
state->PushInteger(station->getModuleCount());
return 1;
}
示例12: getStation
// The simulation
Simulation* DataRecorder::getSimulationImp()
{
if (sim == nullptr) {
Station* p = getStation();
if (p != nullptr) sim = p->getSimulation();
}
return sim;
}
示例13: getStation
Simulation* MultiActorAgent::getSimulation()
{
Simulation* sim = nullptr;
Station* s = getStation();
if (s != nullptr) {
sim = s->getSimulation();
}
return sim;
}
示例14: re_stations
void
StationsPluginLondon::handleInfos(const QByteArray & data)
{
QRegExp re_stations("station\\=\\{(.*)\\}\\;");
QRegExp re_items("\\s*(\\w+)\\s*:(.*),");
int ofs = 0;
re_stations.setMinimal(true);
re_items.setMinimal(true);
while ((ofs = re_stations.indexIn(data, ofs)) >= 0) {
bool ok;
int id;
QPointF pos;
Station *station;
QMap<QString, QString> values;
ofs += re_stations.matchedLength();
int station_ofs = 0;
QString station_data = re_stations.capturedTexts().at(1);
while ((station_ofs = re_items.indexIn(station_data, station_ofs)) >= 0) {
QStringList capt = re_items.capturedTexts();
if (capt.size() < 3)
continue ;
station_ofs += re_items.matchedLength();
values[capt.at(1)] = capt.at(2);
values[capt.at(1)].replace("\"", "");
}
id = values["id"].toInt(&ok);
pos = QPointF(values["lat"].toDouble(),
values["long"].toDouble());
if (!ok)
continue ;
station = getOrCreateStation(id);
if (station->name().isEmpty())
station->setName(values["name"]);
if (station->pos().isNull())
station->setPos(pos);
station->setBikes(values["nbBikes"].toInt());
station->setFreeSlots(values["nbEmptyDocks"].toInt());
station->setTotalSlots(station->bikes() + station->freeSlots());
storeOrDropStation(station);
}
emit stationsCreated(stations.values());
emit stationsUpdated(stations.values());
}
示例15: foreach
// write station data to xml streamgenerateBullets();
foreach( QGraphicsItem* item, items() )
{
Station* station = dynamic_cast<Station*>( item );
if ( station )
{
stream->writeEmptyElement( "station" );
stream->writeAttribute( "x", QString("%1").arg(station->x()) );
stream->writeAttribute( "y", QString("%1").arg(station->y()) );
}
}