本文整理汇总了C++中Patient::getRoom方法的典型用法代码示例。如果您正苦于以下问题:C++ Patient::getRoom方法的具体用法?C++ Patient::getRoom怎么用?C++ Patient::getRoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patient
的用法示例。
在下文中一共展示了Patient::getRoom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SensorSimulator
//-------------------------------------------------- Builder / Destructor
SensorSimulatorSunSpot::SensorSimulatorSunSpot(int id, Subject* r, float minL, float maxL, float minT, float maxT, float minM, float maxM) : SensorSimulator(id, EnOceanSensorAPI::ORG_4BS, r), minLum(minL), maxLum(maxL), minTemp(minT), maxTemp(maxT), minMov(minM), maxMov(maxM) {
// illuminance = rand()%(int)(maxLum-minLum) - minLum;
// voltage = rand()%(int)(maxV-minV) - minV;
// pirStatus = false;
// occupancy = false;
Patient* patient = dynamic_cast<Patient*>(r);
if (patient != 0) {
float t, i, m;
t = patient->getTemperature();
i = patient->getRoom()->getLuminosity();
m = patient->getMovement();
EnOceanSensorAPI::setIlluminance(&frame, i, minLum, maxLum);
EnOceanSensorAPI::setTemperature(&frame, t, minT, maxT);
EnOceanSensorAPI::setMovement(&frame, m, minM, maxM);
cout << "<Sensor Simu n°" << id << "> Créé - Sunspot\n";
} else { subject = NULL; }
} //----- End of SensorSimulatorSunSpot
示例2: update
void SensorSimulatorSunSpot::update() {
// float voltage = t;
// if (voltage > maxV) { t = maxV; }
// else if (voltage < minV) { t = minV; }
Patient* patient = dynamic_cast<Patient*>(subject);
if (patient != 0) {
float t, i, m;
t = patient->getTemperature();
if (t > maxTemp) { t = maxTemp; }
else if (t < minTemp) { t = minTemp; }
i = patient->getRoom()->getLuminosity();
if (i > maxLum) { i = maxLum; }
else if (i < minLum) { i = minLum; }
m = patient->getMovement();
if (m > maxMov) { m = maxMov; }
else if (m < minMov) { m = minMov; }
EnOceanSensorAPI::setIlluminance(&frame, i, minLum, maxLum);
EnOceanSensorAPI::setTemperature(&frame, t, minTemp, maxTemp);
EnOceanSensorAPI::setMovement(&frame, m, minMov, maxMov);
}
}