int main(int argc, const char * argv[]) { // insert code here... People *p =new People(); p->sayHello(); delete p; return 0; }
int main() { People *p = PeopleInit(ObjectCreate(People),20); p->sayHello(); ObjectDelete(p); return 0; }
bool People::WinThanObj::operator()(const People &A, const People &B) const { if (A.isRetired()) return false; if (B.isRetired()) return true; return A.getVoteCount() > B.getVoteCount(); }
bool DreamGenContext::checkifperson(uint8 x, uint8 y) { People *people = (People *)segRef(data.word(kBuffers)).ptr(kPeoplelist, 0); for (size_t i = 0; i < 12; ++i, ++people) { if (people->b4 == 255) continue; data.word(kReelpointer) = people->reelPointer(); Reel *reel = getreelstart(); if (reel->frame() == 0xffff) ++reel; const Frame *frame = getreelframeax(reel->frame()); uint8 xmin = reel->x + frame->x; uint8 ymin = reel->y + frame->y; uint8 xmax = xmin + frame->width; uint8 ymax = ymin + frame->height; if (x < xmin) continue; if (y < ymin) continue; if (x >= xmax) continue; if (y >= ymax) continue; data.word(kPersondata) = people->routinePointer(); obname(people->b4, 5); return true; } return false; }
void ROOM_SPACE::DeleteOwner(People& p) { ePipeline& OwnerInfo = GetOwnerInfo(); ePipeline& OwnerList = *(ePipeline*)OwnerInfo.GetData(REG_OWNER_LIST); for (int i=0; i<OwnerInfo.Size();i++) { ePipeline* Owner = (ePipeline*)OwnerList.GetData(i); tstring& Cryptograph = *(tstring*)Owner->GetData(2); if (Cryptograph == p.m_Cryptograhp) { OwnerList.EraseEnergy(i,1); return ; } } if(p.GetParentID() == GetSpaceID()){ p.GoOut(); //这里应该有更多处理,p被赶出此空间,那么应该退回到上一个空间 assert(0); return; } }
int main(int argc, const char * argv[]) { People *p = new People(); p->hello(); delete p; return 0; }
int main(int argc, const char * argv[]) { // insert code here... People *p =new People( ); p->sayHello(); // std::cout << "Hello, World!\n"; delete p; return 0; }
int main() { // cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! People * p = new People(); p->sayHi(); return 0; }
int main() { People p; Camera c1; p.UseCamera(&c1); Camera2 c2; p.UseCamera(&c2); }
bool People::operator== (const People &other) { if ( this->id() == other.id() && this->name() == other.name() && this->birthday() == other.birthday() && this->biography() == other.biography() && this->type() == other.type() ) { return true; } return false; }
void MainWindow::editRS() { if( view->currentIndex().isValid() ) { int row = view->currentIndex().row(); People p; model->getRec(p, row); PeopleDialog *dial; dial = new PeopleDialog; dial->setPeople(p); if( dial->exec() == QDialog::Accepted ) { p.setSurname( dial->getSurname() ); p.setName( dial->getName() ); p.setPatronimic( dial->getPatronomic() ); p.setSex( dial->getSex() ); p.setDate( dial->getDate() ); p.setEducation( dial->getEducation() ); p.setMatrialStatus( dial->getMatrial_Status() ); model->editRec(p, row); } delete dial; } }
int main(int argc, const char * argv[]) { // 用命名空间方式来访问类 // jikexueyuan:命名空间 // jikexueyuan::People *p = new jikexueyuan::People(); People *p = new People(); p->sayHello(); //销毁对象 delete p; return 0; }
int main(int argc, const char * argv[]) { //类对象 People *p = new People(); //类方法 p->sayHello(); //销毁对象 delete p; //C语言的分配内存和销毁内存的关键字 //malloc(sizi_t) //free(void *) return 0; }
int main(int argc, const char * argv[]) { People *p = new Man(20); //People *p = new People(20,1); // Let father point to sun's shili. // Use the point to call the function with the // same name in father's p->sayHello(); p->eat(); return 0; }
bool ROOM_SPACE::Logon(int64 SourceID,People& Who){ if(AllowInto(Who)){ Who.GoInto(SourceID,*this); return true; } else return false; }
int main(int argc, const char * argv[]) { // People * p = new People(); // p->sayHello(); // delete p; People* m = new Man(20); m->sayHello(); m->eat(); printf("age : %d\n",m->getAge()); delete m; std::cout << "Hello, World!\n"; return 0; }
int main(int argc, char** argv) { typedef Poco::Tuple<std::string, std::string, int> Person; typedef std::vector<Person> People; // create a session Session session("SQLite", "sample.db"); // drop sample table, if it exists session << "DROP TABLE IF EXISTS Person", now; // (re)create table session << "CREATE TABLE Person (Name VARCHAR(30), Address VARCHAR, Age INTEGER(3))", now; // insert some rows People people; people.push_back(Person("Bart Simpson", "Springfield", 12)); people.push_back(Person("Lisa Simpson", "Springfield", 10)); Statement insert(session); insert << "INSERT INTO Person VALUES(:name, :address, :age)", use(people), now; people.clear(); // a simple query Statement select(session); select << "SELECT Name, Address, Age FROM Person", into(people), now; for (People::const_iterator it = people.begin(); it != people.end(); ++it) { std::cout << "Name: " << it->get<0>() << ", Address: " << it->get<1>() << ", Age: " << it->get<2>() <<std::endl; } return 0; }
/** * @brief Adds a person to the database. * Should not be called directly. * * @param People * @return bool */ bool DatabaseManager::insertNewPeople(People &people) { QSqlQuery l_query(m_db); // If a people with the same name exist, we update it // else we insert if(existPeople(people.name())) { Macaw::DEBUG("[DatabaseManager.insertNewPeople] Name already known"); People l_peopleToUpdate = getOnePeopleByName(people.name()); people.setId(l_peopleToUpdate.id()); if(!updatePeople(people)) { return false; } } else { l_query.prepare("INSERT INTO people (" "name, " "birthday, " "biography, " "imported, " "id_tmdb " ") VALUES (" ":name, " ":birthday, " ":biography, " ":imported, " ":id_tmdb " ")" ); l_query.bindValue(":name", people.name()); l_query.bindValue(":birthday", people.birthday().toString(DATE_FORMAT)); l_query.bindValue(":biography", people.biography()); l_query.bindValue(":imported", people.isImported()); l_query.bindValue(":id_tmdb", people.tmdbId()); if (!l_query.exec()) { Macaw::DEBUG("In insertNewPeople():"); Macaw::DEBUG(l_query.lastError().text()); return false; } people.setId(l_query.lastInsertId().toInt()); } return true; }
// Position message callback. void pos_cb() { cv_mutex_.lock(); int iperson; if (pos_.initialization == 1) { // Create a person with this id and position. people_->addPerson(); iperson = people_->getNumPeople(); people_->setID(pos_.object_id, iperson); } else { // Find the person in my list. If they don't exist, re-create them as above. // If the message is within a short time of the current image, reset the position. iperson = people_->findID(pos_.object_id); if (iperson < 0) { cv_mutex_.unlock(); return; } } people_->setFaceCenter3D(-pos_.pos.y, -pos_.pos.z, pos_.pos.x, iperson); cv_mutex_.unlock(); }
void MainWindow::diagramS() { if(!model) return; int i, n = model->rowCount(); int statistic[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; for(i = 0; i < n; i++ ) { People p; model->getRec(p, i); statistic[p.getMonth()]++; } DiagramDialog *diag; diag = new DiagramDialog(statistic); diag->exec(); delete diag; }
void MainWindow::addRS() { if(!model) return; PeopleDialog *dial; dial = new PeopleDialog; if( dial->exec() == QDialog::Accepted ) { People p; p.setSurname( dial->getSurname() ); p.setName( dial->getName() ); p.setPatronimic( dial->getPatronomic() ); p.setSex( dial->getSex() ); p.setDate( dial->getDate() ); p.setEducation( dial->getEducation() ); p.setMatrialStatus( dial->getMatrial_Status() ); model->addRec(p); } delete dial; }
/** * @brief Adds a person to the database and links it to a movie * * @param People * @param Movie * @return bool */ bool DatabaseManager::addPeopleToMovie(People &people, Movie &movie, const int type) { if (!insertNewPeople(people)) { return false; } QSqlQuery l_query(m_db); l_query.prepare("INSERT INTO movies_people (id_people, id_movie, type) " "VALUES (:id_people, :id_movie, :type)"); l_query.bindValue(":id_people", people.id()); l_query.bindValue(":id_movie", movie.id()); l_query.bindValue(":type", type); if (!l_query.exec()) { Macaw::DEBUG("In addPeopleToMovie():"); Macaw::DEBUG(l_query.lastError().text()); return false; } return true; }
bool ROOM_SPACE::AllowInto(People& p){ if (!IsValid()) { return false; } //如果已经在此空间则直接返回 if(p.GetParentID() == m_ID)return true; int64 ChildID = 0; ePipeline& OwnerInfo = GetOwnerInfo(); SPACE_RIGHT RoomRight = *(SPACE_RIGHT*)OwnerInfo.GetData(REG_RIGHT); ePipeline& OwnerList = *(ePipeline*)OwnerInfo.GetData(REG_OWNER_LIST); for (int i=0; i<OwnerList.Size();i++) { ePipeline* Owner = (ePipeline*)OwnerList.GetData(i); tstring& Cryptograph = *(tstring*)Owner->GetData(2); if (Cryptograph == p.m_Cryptograhp) { SPACE_RIGHT Right = *(SPACE_RIGHT*)Owner->GetData(1); if(Right >= RoomRight){ return true; } break; } } //访问者不是固定注册的拥有者,但只要当前空间不禁止参观也可以进入 bool Allow = false; switch(RoomRight) { case NO_RIGHT: { //能够访问,robot的访问权限保持不变 Allow = true; } break; case VISIT_ONLY: { Allow = true; } break; case VISIT_NOTIFY: { //通知其它人,暂时没有实现 assert(0); } break; case VISIT_APPLY: { //提出申请,暂时没有实现 assert(0); } case USABLE: { Allow = true; } break; case USABLE_NOTIFY: { //通知其它人,暂时没有实现 assert(0); } break; case USABLE_APPLY: { //提出申请,暂时没有实现 assert(0); } break; case HOLD_NOTIFY: { //通知其它人,暂时没有实现 assert(0); } break; case HOLD_APPLY: { //提出申请,暂时没有实现 assert(0); } break; case RIGHT_HOLD: { //显然不允许 } break; } return Allow; }
void Dataread::removeFromFile(const People& p1,const Individual& i1) { //bool atBegin = true; People removed; for (int i = 0; i < p1.getSize(); i++) { if(!(p1.getIndi(i) == i1)) { removed.addIndi(p1.getIndi(i)); } } ofstream file; file.open(filename.c_str()); for (int i = 0; i < removed.getSize()-1; i++) { //cout << atBegin << endl; file << removed.getIndi(i).getSurname() << endl; file << removed.getIndi(i).getName() << endl; file << removed.getIndi(i).getGender() << endl; file << removed.getIndi(i).getBirth() << endl; file << removed.getIndi(i).getDeath()<<endl; } file << removed.getIndi(removed.getSize()-1).getSurname() << endl; file << removed.getIndi(removed.getSize()-1).getName() << endl; file << removed.getIndi(removed.getSize()-1).getGender() << endl; file << removed.getIndi(removed.getSize()-1).getBirth() << endl; file << removed.getIndi(removed.getSize()-1).getDeath(); file.close(); }
int main() { People myPeople; std::cout<<"My name: " << myPeople.GetName(); std::cout<<"My age: " << myPeople.GetAge(); }
boost::optional<IdfObject> ForwardTranslator::translatePeople( People & modelObject ) { IdfObject idfObject(openstudio::IddObjectType::People); m_idfObjects.push_back(idfObject); for (LifeCycleCost lifeCycleCost : modelObject.lifeCycleCosts()){ translateAndMapModelObject(lifeCycleCost); } PeopleDefinition definition = modelObject.peopleDefinition(); idfObject.setString(PeopleFields::Name, modelObject.name().get()); boost::optional<Space> space = modelObject.space(); boost::optional<SpaceType> spaceType = modelObject.spaceType(); if (space){ boost::optional<ThermalZone> thermalZone = space->thermalZone(); if (thermalZone){ idfObject.setString(PeopleFields::ZoneorZoneListName, thermalZone->name().get()); } }else if(spaceType){ idfObject.setString(PeopleFields::ZoneorZoneListName, spaceType->name().get()); } boost::optional<Schedule> schedule = modelObject.numberofPeopleSchedule(); if (schedule){ idfObject.setString(PeopleFields::NumberofPeopleScheduleName, schedule->name().get()); } idfObject.setString(PeopleFields::NumberofPeopleCalculationMethod, definition.numberofPeopleCalculationMethod()); double multiplier = modelObject.multiplier(); OptionalDouble d = definition.numberofPeople(); if (d){ idfObject.setDouble(PeopleFields::NumberofPeople, (*d)*multiplier); } d = definition.peopleperSpaceFloorArea(); if (d){ idfObject.setDouble(PeopleFields::PeopleperZoneFloorArea, (*d)*multiplier); } d = definition.spaceFloorAreaperPerson(); if (d){ idfObject.setDouble(PeopleFields::ZoneFloorAreaperPerson, (*d)*multiplier); } d = definition.fractionRadiant(); if (d){ idfObject.setDouble(PeopleFields::FractionRadiant, *d); } d = definition.sensibleHeatFraction(); if (d){ idfObject.setDouble(PeopleFields::SensibleHeatFraction, *d); } schedule = modelObject.activityLevelSchedule(); if (schedule){ idfObject.setString(PeopleFields::ActivityLevelScheduleName, schedule->name().get()); } if (!definition.isCarbonDioxideGenerationRateDefaulted()){ idfObject.setDouble(PeopleFields::CarbonDioxideGenerationRate, definition.carbonDioxideGenerationRate()); } if (!definition.isEnableASHRAE55ComfortWarningsDefaulted()){ if (definition.enableASHRAE55ComfortWarnings()){ idfObject.setString(PeopleFields::EnableASHRAE55ComfortWarnings, "Yes"); }else{ idfObject.setString(PeopleFields::EnableASHRAE55ComfortWarnings, "No"); } } if (!definition.isMeanRadiantTemperatureCalculationTypeDefaulted()){ idfObject.setString(PeopleFields::MeanRadiantTemperatureCalculationType, definition.meanRadiantTemperatureCalculationType()); } // TODO: Surface Name/Angle Factor List Name schedule = modelObject.workEfficiencySchedule(); if (schedule){ idfObject.setString(PeopleFields::WorkEfficiencyScheduleName, schedule->name().get()); } schedule = modelObject.clothingInsulationSchedule(); if (schedule){ idfObject.setString(PeopleFields::ClothingInsulationScheduleName, schedule->name().get()); } schedule = modelObject.airVelocitySchedule(); if (schedule){ idfObject.setString(PeopleFields::AirVelocityScheduleName, schedule->name().get()); } for (int i = 0, n = definition.numThermalComfortModelTypes(); i < n; ++i) { OptionalString s = definition.getThermalComfortModelType(i); if (s) { idfObject.pushExtensibleGroup(StringVector(1u,*s)); } } return idfObject; }
int main() { People jim; jim.lend(100); }
/// The image callback. For each new image, copy it, perform face detection, and draw the rectangles on the image. void image_cb_all(ros::Time t) { detect_++; if (detect_ % 2) { return; } cv_mutex_.lock(); CvSize im_size; // Convert the images to OpenCV format if (lbridge_.fromImage(limage_,"bgr")) { cv_image_left_ = lbridge_.toIpl(); } if (dbridge_.fromImage(dimage_)) { cv_image_disp_ = dbridge_.toIpl(); } // Convert the stereo calibration into a camera model. if (cam_model_) { delete cam_model_; } double Fx = rcinfo_.P[0]; double Fy = rcinfo_.P[5]; double Clx = rcinfo_.P[2]; double Crx = Clx; double Cy = rcinfo_.P[6]; double Tx = -rcinfo_.P[3]/Fx; cam_model_ = new CvStereoCamModel(Fx,Fy,Tx,Clx,Crx,Cy,1.0/(double)stinfo_.dpp); if ( cv_image_left_ ) { im_size = cvGetSize(cv_image_left_); vector<CvRect> faces_vector = people_->detectAllFaces(cv_image_left_, haar_filename_, 1.0, cv_image_disp_, cam_model_, true); // Get the average disparity in the middle half of the bounding box, and compute the face center in 3d. // Publish the face center as a track point. if (cv_image_disp_ && cam_model_) { int r, c, good_pix; ushort* ptr; double avg_disp; CvRect *one_face; robot_msgs::PositionMeasurement pos; CvMat *uvd = cvCreateMat(1,3,CV_32FC1); CvMat *xyz = cvCreateMat(1,3,CV_32FC1); for (uint iface = 0; iface < faces_vector.size(); iface++) { one_face = &faces_vector[iface]; good_pix = 0; avg_disp = 0; for (r = floor(one_face->y+0.25*one_face->height); r < floor(one_face->y+0.75*one_face->height); r++) { ptr = (ushort*)(cv_image_disp_->imageData + r*cv_image_disp_->widthStep); for (c = floor(one_face->x+0.25*one_face->width); c < floor(one_face->x+0.75*one_face->width); c++) { if (ptr[c] > 0) { avg_disp += ptr[c]; good_pix++; } } } avg_disp /= (double)good_pix; // Take the average. cvmSet(uvd,0,0,one_face->x+one_face->width/2.0); cvmSet(uvd,0,1,one_face->y+one_face->height/2.0); cvmSet(uvd,0,2,avg_disp); cam_model_->dispToCart(uvd,xyz); bool do_publish = true; if (external_init_) { // Check if this person's face is close enough to one of the previously known faces and associate it. // If not, don't publish it. } if (do_publish) { pos.header.stamp = limage_.header.stamp; pos.name = "face_detection"; pos.object_id = "-1"; pos.pos.x = cvmGet(xyz,0,2); pos.pos.y = -1.0*cvmGet(xyz,0,0); pos.pos.z = -1.0*cvmGet(xyz,0,1); pos.header.frame_id = "stereo_link"; pos.reliability = 0.8; pos.initialization = 0; //pos.covariance = ; publish("person_measurement",pos); } } cvReleaseMat(&uvd); cvReleaseMat(&xyz); if (do_display_) { if (!cv_image_disp_out_) { cv_image_disp_out_ = cvCreateImage(im_size,IPL_DEPTH_8U,1); } cvCvtScale(cv_image_disp_,cv_image_disp_out_,4.0/stinfo_.dpp); cvShowImage("Face detector: Face Detection",cv_image_left_); cvShowImage("Face detector: Disparity",cv_image_disp_out_); } } } cv_mutex_.unlock(); }